benmabey.com

Bryan talked about the differences between imperative and declarative scenarios. In my opinion, both styles have benefits and should be...

When you write a custom RSpec matcher a good place to store them is to create one file per matcher...

To test whether a hash includes an expected sub-hash: expect(user.attributes).to match(hash_including('name' => 'Bruce Wayne'))

jeffkreeftmeijer.com

Back when Steak was first released, Capybara didn’t have any of the nice RSpec helpers it does now. A...

Note that you cannot currently use Ruby 1.9.2 with Rails 2 applications that use RSpec, so don't upgrade if...

If in your application your users pass along params that result in filenames, like invoices/generated?number=123. This could be...

The attached RSpec matcher exist_in_database checks if a given record still exists in the database and has not...

We are maintaining some vintage projects with tests written in Test::Unit instead of RSpec. Mocks and stubs are not...

track down warnings and to see failing specs immediately or to get an overview of the core...

So you are comparing two Time objects in an RSpec example, and they are not equal, although they look equal...

makandra dev
innig.net

If you want to get a deep understanding of how closures, blocks, procs & lambdas in Ruby work, check out the...

To test whether two arrays have the same elements regardless of order, you can use the =~ matcher in RSpec < 2.11...

Update: This trick probably isn't very useful anymore in Ruby 2.x. The Ruby GC has improved a lot...

justinfrench.com

If you’re testing the behavior of deprecated code in your Ruby project, the warning messages littered throughout your spec...

In RSpec 2 shared_examples_for can have parameters. You can simply hand over arguments from it_behaves...

You can usually just use the eq matched to compare two numbers: expect(deal.total).to eq(120)

RSpec 1, RSpec 2 To test whether two arrays have the same elements regardless of order, RSpec 1 and 2...

If your controller spec never reaches your controller code: Make sure you are signed in. Make sure you are actually...

Plugins (and gems) are typically tested using a complete sample rails application that lives in the spec folder of the...

If a controller action responds to other formats than HTML (XML, PDF, Excel, JSON, ...), you can reach that code in...

You will need to upgrade to RSpec >= 2 and rspec-rails >= 2 for Rails 3. Here are some hints to...

Inside before :each blocks you can refer to variables that you introduce via let later on. They do not need...

RSpec's context (which is basically an alias for describe) takes over your whole application. No object may have its...

web.archive.org

With its you can switch the subject of an example to a method value of the current subject: describe Array...