bellycard/napa — pull request #148 by craigulliott (2014-10-06 15:32:15+00:00)
Title: I find these spec_helpers really useful

I think it might be controversial, but I'm putting these in to start the conversation. I've been using these to make my specs really dry.

```ruby
context 'searching for foos' do
before do
@foo_a = FactoryGirl.create :foo, bar: true
@foo_b = FactoryGirl.create :foo, bar: false
end
it 'returns all results' do
get '/foos'
expect_count_of 2
end
it 'does not return foo which has something' do
get '/foos', bar: true
expect_to_have @foo_a
expect_to_not_have @foo_b
end
it 'returns only the requested foo' do
get "/foos/#{@foo_a.id}"
expect_only @foo_a
end
end
```