This works in modern RSpecs (RSpec >= 2.x) and Cucumbers: rspec spec/models/node_spec.rb:294:322 cucumber features/nodes.feature:543:563:579

Never name your shared example group *_spec.rb. Otherwise rspec will try to load your example group as a spec and...

Be careful when stubbing out attributes on records that are defined by associations. Nothing is as it seems to be...

When you develop a gem and you have a Gemfile in your project directory, you might be surprised that your...

makandra dev

Consul 0.4.0 comes with some new features. Dependencies Consul no longer requires assignable_values, it's optional for when you...

makandra dev

Test suites usually grow over time as more and more development time is spent on a projects. Overall run-time...

If you use rails_admin, your specs pass with the rspec binary, but not using rake spec (or rake parallel...

makandra dev

RSpec's be_false behaves unexpectedly: nil.should be_false # passes, as the expectation returns true If you want to check...

All our projects have enum-like requirements like this: An attribute value must be included in a given set of...

This only applies to RSpec below version 1.3.2. The issue has been fixed in RSpec 1.3.2, and most likely RSpec...

When your model is using a callback like before_save or before_validation to calculate an aggregated value from its...

Imagine you have 2 HTML boxes. The first one has a margin-bottom of let's say 30px and the...

You probably know about the possibility to tag scenarios in Cucumber to run your own piece of code before the...

In order to save the original value of a constant, set the new value and restore the old value after...

Ever seen this error when using Graticule? Numerical argument out of domain - acos Similarly to the to_sql problem for...

Possible Reason 1: parallel_tests - running more processes than features If you run old versions of parallel_tests with more...

Views are normally (for good reason) not rendered in controller specs. If you need it to happen, use:

blog.bitcrowd.net

To make the RSpec matcher of the authorization solution Consul work with Rspec 2.x read the following blog post...

github.com

When internationalizing your Rails app, you'll be replacing strings like 'Please enter your name' with t('.name_prompt'). You...

RSpec 1 (Rails 2) With the most recent spec_candy.rb helpers you can say: User.stub_any_instance(:foo => :bar) user = User.new...

RSpec lets you define the arguments with which you expect a method to be invoked: subject.should_receive(:say).with('hello...

makandra dev

Never use raise_error without specifying the Error you expect. expect { do_a_lot_of_complicated_stuff }.to raise_error...

Hint: There's another card with this helper for Cucumber features. Sometimes you feel like you need to stub some...

If you're writing a spec for an application using Resque, you may need to work off queues manually without...