saasbook

spec_using_factory.rb

Jan 10th, 2012
499
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.43 KB | None | 0 0
  1. # spec/models/movie_spec.rb
  2.  
  3. describe Movie do
  4.   it 'should include rating and year in full name' do
  5.     movie = FactoryGirl.build(:movie, :title => 'Milk', :rating => 'R')
  6.     movie.name_with_rating.should == 'Milk (R)'
  7.   end
  8. end
  9.  
  10. # or if you mix in FactoryGirl's syntax methods (see FactoryGirl README):
  11.  
  12. describe Movie do
  13.   subject { create :movie, :title => 'Milk', :rating => 'R' }
  14.   its :name_with_rating { should == 'Milk (R)' }
  15. end
Add Comment
Please, Sign In to add comment