Created
July 29, 2012 07:49
-
-
Save gal-at-aljazeera/3196554 to your computer and use it in GitHub Desktop.
test rspec db polutions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe 'Example with let' do | |
let(:status) { create(:status, :screen_name => 'test_status from let')} | |
it 'should be a status' do | |
status.should be_a(Status) | |
end | |
end | |
describe 'Example with let!' do | |
let!(:status) { create(:status, :screen_name => 'test_status from let! with a bang')} | |
it 'should be a status' do | |
status.should be_a(Status) | |
end | |
end | |
describe 'example with before :each' do | |
before :each do | |
@status = create(:status, :screen_name => 'test status from before :each') | |
end | |
it 'should be a status' do | |
@status.should be_a(Status) | |
end | |
end | |
describe 'example with an exception' do | |
before :each do | |
@status = create(:status, :screen_name => 'test status with an exception') | |
end | |
it 'should be a status' do | |
@status.should be_a(Status) | |
raise "some exception!" | |
end | |
end | |
describe 'example with before :all' do | |
before :all do | |
@status = create(:status, :screen_name => 'test status from before :all') | |
end | |
it 'should be a status' do | |
@status.should be_a(Status) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment