Skip to content

Instantly share code, notes, and snippets.

@hannakalinowska
Created August 1, 2011 08:57
Show Gist options
  • Select an option

  • Save hannakalinowska/1117827 to your computer and use it in GitHub Desktop.

Select an option

Save hannakalinowska/1117827 to your computer and use it in GitHub Desktop.
Love RSpec
class User
has_many :jobs
end
it 'has a job' do
user.should have(1).job
end
@mudge
Copy link

mudge commented Aug 2, 2011

You can even drop the redundant description in this case:

describe User do
  it { should have(1).job }
end

@hannakalinowska
Copy link
Author

Could do. I just love the fact that you can do

user.should have(1).job

rather than

user.jobs.should have(1).item

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment