Skip to content

Instantly share code, notes, and snippets.

@rounders
Created January 17, 2012 09:16
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 rounders/1625808 to your computer and use it in GitHub Desktop.
Save rounders/1625808 to your computer and use it in GitHub Desktop.
problem with build_source
context "#build_source" do
let(:payment_method) { Factory(:bogus_payment_method) }
it "should build the payment's source" do
params = { :amount => 100, :payment_method_id => payment_method.id,
:source_attributes => {:year=>"2012", :month =>"1", :number => '1234567890123',:verification_value => '123'}}
payment = Spree::Payment.new(params)
payment.should be_valid
payment.source.should_not be_nil
end
context "with the params hash ordered differently" do
it "should build the payment's source" do
params = {
:source_attributes => {:year=>"2012", :month =>"1", :number => '1234567890123',:verification_value => '123'},
:amount => 100, :payment_method_id => payment_method.id
}
payment = Spree::Payment.new(params)
payment.should be_valid
payment.source.should_not be_nil
end
end
end
@rounders
Copy link
Author

ruby 1.8.7p352 - both tests pass
ree - sometimes fails, sometimes passes
ruby 1.8.7p357 - sometimes fails, sometimes passes
ruby 1.9.2p290 - 1st test passes, 2nd test fails
ruby 1.9.3p0 - 1st test passes, 2nd test fails

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment