Module: SpreedlyCore::TestHelper
- Extended by:
- TestHelper
- Included in:
- TestHelper
- Defined in:
- lib/spreedly-core-ruby/test_extensions.rb
Instance Method Summary collapse
- #cc_data(cc_type, options = {}) ⇒ Object
-
#mocked_base_uri_string ⇒ Object
Return the base uri as a mocking framework would expect.
Instance Method Details
#cc_data(cc_type, options = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/spreedly-core-ruby/test_extensions.rb', line 8 def cc_data(cc_type, ={}) card_numbers = {:master => [5555555555554444, 5105105105105100], :visa => [4111111111111111, 4012888888881881], :american_express => [378282246310005, 371449635398431], :discover => [6011111111111117, 6011000990139424] } card_number = [:card_number] == :failed ? :last : :first number = card_numbers[cc_type].send(card_number) { :credit_card => { :first_name => "John", :last_name => "Foo", :card_type => cc_type, :number => number, :verification_value => 123, :month => 4, :year => Time.now.year + 1 }.merge([:credit_card] || {}) } end |
#mocked_base_uri_string ⇒ Object
Return the base uri as a mocking framework would expect
31 32 33 34 35 36 37 |
# File 'lib/spreedly-core-ruby/test_extensions.rb', line 31 def mocked_base_uri_string uri = URI.parse(Base.base_uri) auth_params = Base.[:basic_auth] uri.user = auth_params[:username] uri.password = auth_params[:password] uri.to_s end |