Created
January 11, 2018 19:17
-
-
Save zdennis/16c843f4f05f7b2b54031d7afdd4112b to your computer and use it in GitHub Desktop.
rspec-given's Given! behaves differently than rspec's let!
This file contains hidden or 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' | |
RSpec.describe "Foo" do | |
before do | |
puts "Was bananas called yet?" | |
end | |
Given(:bar) { puts "bar" } | |
Given!(:bananas) { puts "bananas" } | |
When do | |
bar | |
bananas | |
bar | |
bananas | |
end | |
Then do | |
true | |
end | |
end | |
RSpec.describe "Foo" do | |
let(:bar) { puts "bar" } | |
let!(:bananas) { puts "bananas" } | |
before do | |
puts "Was bananas called yet?" | |
end | |
it 'does stuff' do | |
bar | |
bananas | |
bar | |
bananas | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment