Skip to content

Instantly share code, notes, and snippets.

@gal-at-aljazeera
Created July 29, 2012 07:49
Show Gist options
  • Save gal-at-aljazeera/3196554 to your computer and use it in GitHub Desktop.
Save gal-at-aljazeera/3196554 to your computer and use it in GitHub Desktop.
test rspec db polutions
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