-
-
Save jeffkreeftmeijer/804772 to your computer and use it in GitHub Desktop.
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
module PaymentExampleHelpers | |
def when_amount_is(amount, &block) | |
context "with an amount of $#{amount}" do | |
instance_eval(&block) | |
end | |
end | |
end | |
RSpec.configure do |config| | |
config.extend(PaymentExampleHelpers) | |
end | |
describe 'Payment' do | |
when_amount_is(10.00) do | |
it { should == "with an amount of $10.0" } | |
end | |
context "with an amount of $42.00" do | |
it { should == "with an amount of $42.00" } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment