test/stripe/api_resource_test.rb in stripe-1.20.3 vs test/stripe/api_resource_test.rb in stripe-1.20.4
- old
+ new
@@ -35,10 +35,19 @@
assert_raises Stripe::AuthenticationError do
Stripe::Customer.new("test_customer").refresh
end
end
+ should "using a nil api key should raise an exception" do
+ assert_raises TypeError do
+ Stripe::Customer.all({}, nil)
+ end
+ assert_raises TypeError do
+ Stripe::Customer.all({}, { :api_key => nil })
+ end
+ end
+
should "specifying api credentials containing whitespace should raise an exception" do
Stripe.api_key = "key "
assert_raises Stripe::AuthenticationError do
Stripe::Customer.new("test_customer").refresh
end
@@ -467,10 +476,17 @@
:legal_entity => {
:last_name => 'Smith',
}
})
- @mock.expects(:post).once.with("#{Stripe.api_base}/v1/accounts/myid", nil, 'legal_entity[first_name]=Bob&legal_entity[last_name]=').returns(test_response({"id" => "myid"}))
+ @mock.expects(:post).once.with(
+ "#{Stripe.api_base}/v1/accounts/myid",
+ nil,
+ any_of(
+ 'legal_entity[first_name]=Bob&legal_entity[last_name]=',
+ 'legal_entity[last_name]=&legal_entity[first_name]=Bob'
+ )
+ ).returns(test_response({"id" => "myid"}))
acct.legal_entity = {:first_name => 'Bob'}
acct.save
end