Posts By: Jimm

Disabling Groups of RSpec Examples

During the process of updating the code, I thought it might be better to have a test suite that more closely matches our production code. I wanted the rspec command to be inclusive of all features in the production environment, but I didn’t want to remove the specs not being used since we may implement… Read more »

Shared Examples for Testing Session Links

When I was adding tests for user authentication, I noticed an opportunity to DRY up the code a little by moving some duplicate tests into a shared example group. The tests expect to find different links in the header depending on the whether or not a user was signed in: #partials_spec.rb shared_examples "it has signed… Read more »

Adding Dynamic Versions to the Policy Factory

FactoryGirl provides a lot of flexibility when it comes to creating associations, so following their example, TOSBack is using an after(:create) callback to produce some content in the tests that appears to be changing over time: factory :policy_with_sites_and_versions do ignore do sites_count 5 versions_count 5 end after(:create) do |policy, eval| eval.sites_count.times { policy.sites << FactoryGirl.create(:site)… Read more »

Screenshot Tour of New TOSBack Features

TOSBack has seen several updates lately, and I want to present a glimpse of what has been changing! But instead of having you set it all up, here are some screenshots from my local environment! Sessions TOSBack has some basic authentication and authorization now. In the header is a link to sign in: Trying to… Read more »

Version Callbacks for ToSBack Policies

Our ToSBack policies now have some automatic versioning when the “detail” attribute is changed! Here’s an example policy in my development environment. Its current version is stored as an attribute in the policy model (detail), but it’s also represented in the versions model: 1.9.3-p327 :001 > pol = Policy.first 1.9.3-p327 :009 > pol.detail => "… Read more »

Help Us Develop the New ToSBack!

We could use your help building the new Rails version of ToSBack! The hackathon page has a good overview of basic site functionality if you aren’t familiar, but this page should help you see how the components come together. Open your favorite text editor and start contributing! What We Want to Build Here’s a basic… Read more »

Troubleshooting ToSBack File Handling

For the past few days, ToSBack has been running so smoothly! Every day, I scroll through the latest “Crawl” commit to see what’s new and to decide which rules need to be updated. And every day this week, I’ve been pleasantly surprised to find that not many files are being modified! ~# tail -f rubytosback/tosback2/logs/run.log… Read more »

Adding a Method to Check for Previous Crawl Data

I added a new feature to the script that will hopefully make the TOSBack crawls more reliable! The app has had some intermittent problems downloading pages; in some cases, the crawl data would come back blank even if the document had downloaded properly before. I decided to right a couple methods that would check for… Read more »

Passing Arguments to TOSBack

Over time, I’ve added some features to TOSBack that you access by passing arguments to the script. The quickest way to test out new rules/XPath info is to run the script like this: rubycode$ ruby tosback.rb ../rules/abercrombie.com.xml Instead of writing the policy to file, it will just print it on the screen for verification. If… Read more »

Searching Crawl Data for Empty Files

I needed a way to scan the crawl data programmatically and determine if there were blank policies that I didn’t know about. With around 1000 rules in the TOSBack app, I need some ways to double check the data that comes back from the web scraping. I decided to set up a class method that… Read more »