Skip to content

Instantly share code, notes, and snippets.

@jeffkreeftmeijer
Forked from joshk/squareup_spec.rb
Created January 31, 2011 20:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffkreeftmeijer/804772 to your computer and use it in GitHub Desktop.
Save jeffkreeftmeijer/804772 to your computer and use it in GitHub Desktop.
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