laundry 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/laundry.gemspec CHANGED
@@ -19,7 +19,6 @@ Gem::Specification.new do |gem|
19
19
  gem.add_dependency 'savon'
20
20
 
21
21
  gem.add_development_dependency 'rspec'
22
- gem.add_development_dependency 'factory_girl'
23
22
  gem.add_development_dependency 'debugger'
24
23
 
25
24
  end
data/lib/laundry.rb CHANGED
@@ -28,6 +28,15 @@ module Laundry
28
28
  false
29
29
  end
30
30
 
31
+ def self.mock(type, merge = {})
32
+ o = YAML::load_file(File.expand_path(File.join(__FILE__, "..", "..", "spec", "fixtures", "#{type.to_s}.yml")))
33
+ o.merchant = self.mock(:merchant) if o.respond_to?(:merchant=)
34
+ if merge && !merge.empty?
35
+ o.record = o.record.merge(merge)
36
+ end
37
+ o
38
+ end
39
+
31
40
  end
32
41
 
33
42
  # Lib
@@ -1,13 +1,4 @@
1
1
  require "rspec/mocks/standalone"
2
- require 'factory_girl'
3
- begin
4
- factories_dir = File.expand_path File.join(__FILE__, "..", "..", "..", "spec", "factories")
5
- FactoryGirl.definition_file_paths = [factories_dir]
6
- FactoryGirl.find_definitions
7
- rescue FactoryGirl::DuplicateDefinitionError
8
- puts "Factories already loaded."
9
- end
10
- include FactoryGirl::Syntax::Methods
11
2
 
12
3
  class Module
13
4
  def subclasses
@@ -29,16 +20,18 @@ def stub_all
29
20
  end
30
21
 
31
22
  # Stub client driver
32
- Laundry::PaymentsGateway::ClientDriver.any_instance.stub(:find).and_return(build(:client))
33
- Laundry::PaymentsGateway::ClientDriver.any_instance.stub(:create!).and_return(build(:client).id)
34
-
23
+ Laundry::PaymentsGateway::ClientDriver.any_instance.stub(:find).and_return(Laundry.mock(:client))
24
+ Laundry::PaymentsGateway::ClientDriver.any_instance.stub(:create!).and_return(Laundry.mock(:client).id)
35
25
 
36
26
  # Stub account driver
37
- Laundry::PaymentsGateway::AccountDriver.any_instance.stub(:find).and_return(build(:account))
38
- Laundry::PaymentsGateway::AccountDriver.any_instance.stub(:create!).and_return(build(:account).id)
27
+ Laundry::PaymentsGateway::AccountDriver.any_instance.stub(:find).and_return(Laundry.mock(:account))
28
+ Laundry::PaymentsGateway::AccountDriver.any_instance.stub(:create!).and_return(Laundry.mock(:account).id)
29
+
30
+ # Stub transaction driver
31
+ Laundry::PaymentsGateway::TransactionDriver.any_instance.stub(:find).and_return(Laundry.mock(:transaction))
39
32
 
40
33
  # Stub performing transactions.
41
- Laundry::PaymentsGateway::Account.any_instance.stub(:perform_transaction).and_return(build(:transaction_response))
34
+ Laundry::PaymentsGateway::Account.any_instance.stub(:perform_transaction).and_return(Laundry.mock(:transaction_response))
42
35
 
43
36
  Laundry.stub(:stubbed?).and_return true
44
37
  end
@@ -1,3 +1,3 @@
1
1
  module Laundry
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -0,0 +1,15 @@
1
+ --- !ruby/object:Laundry::PaymentsGateway::Account
2
+ record:
3
+ :merchant_id: '1'
4
+ :client_id: '1'
5
+ :payment_method_id: '1'
6
+ :acct_holder_name: John Quincy Adams
7
+ :cc_card_number:
8
+ :cc_expiration_date:
9
+ :cc_card_type:
10
+ :cc_procurement_card: false
11
+ :ec_account_number: XXXXXX1234
12
+ :ec_account_trn: '1234565678'
13
+ :ec_account_type: CHECKING
14
+ :note:
15
+ :is_default: false
@@ -0,0 +1,29 @@
1
+ --- !ruby/object:Laundry::PaymentsGateway::Client
2
+ record:
3
+ :merchant_id: '1'
4
+ :client_id: '1'
5
+ :first_name: Test
6
+ :last_name: Person
7
+ :company_name:
8
+ :address1:
9
+ :address2:
10
+ :city:
11
+ :state:
12
+ :postal_code:
13
+ :country_code:
14
+ :phone_number:
15
+ :fax_number:
16
+ :email_address:
17
+ :shipto_first_name:
18
+ :shipto_last_name:
19
+ :shipto_company_name:
20
+ :shipto_address1:
21
+ :shipto_address2:
22
+ :shipto_city:
23
+ :shipto_state:
24
+ :shipto_postal_code:
25
+ :shipto_country_code:
26
+ :shipto_phone_number:
27
+ :shipto_fax_number:
28
+ :consumer_id:
29
+ :status: Active
@@ -0,0 +1,13 @@
1
+ --- !ruby/object:Laundry::PaymentsGateway::TransactionResponse
2
+ record:
3
+ :pg_response_type: E
4
+ :pg_response_code: E10
5
+ :pg_response_description: MANDITORY FIELD MISSING
6
+ :pg_authorization_code: '12345678'
7
+ :pg_trace_number: AAABCCED-C99D-4971-A218-49308439DABCD
8
+ :pg_merchant_id: '1'
9
+ :pg_transaction_type: '23'
10
+ :pg_total_amount: '25.0'
11
+ :ecom_consumerorderid: order21
12
+ :pg_client_id: '1'
13
+ :pg_payment_method_id: '1'
@@ -0,0 +1,5 @@
1
+ --- !ruby/object:Laundry::PaymentsGateway::Merchant
2
+ id: '123456'
3
+ api_login_id: abc123
4
+ api_password: secretsauce
5
+ transaction_password: moneymoneymoney
@@ -0,0 +1,73 @@
1
+ --- !ruby/object:Laundry::PaymentsGateway::Transaction
2
+ record:
3
+ :account_type: C
4
+ :acct_trn: '1234153465'
5
+ :amount: '25'
6
+ :attempt_number: '1'
7
+ :billto_address:
8
+ :billto_address2:
9
+ :billto_city:
10
+ :billto_company_name:
11
+ :billto_email_address:
12
+ :billto_first_name: John
13
+ :billto_last_name: Q. Public
14
+ :billto_phone:
15
+ :billto_postal_code:
16
+ :billto_state:
17
+ :card_exp_date:
18
+ :card_type:
19
+ :cardholder_name:
20
+ :check_number:
21
+ :consumer_id:
22
+ :consumer_order_id: transaction432
23
+ :convenience_fee: '0'
24
+ :convenience_fee_principal: '0'
25
+ :debit_credit: C
26
+ :entered_by:
27
+ :entry_class_code:
28
+ :entry_description:
29
+ :ip_address: 192.168.1.1
30
+ :item_description:
31
+ :line_items:
32
+ :merchant_data1:
33
+ :merchant_data2:
34
+ :merchant_data3:
35
+ :merchant_data4:
36
+ :merchant_data5:
37
+ :merchant_data6:
38
+ :merchant_data7:
39
+ :merchant_data8:
40
+ :merchant_data9:
41
+ :merchant_id: '1'
42
+ :origination_date: !ruby/object:DateTime 2012-08-28 17:00:00.000000000 -07:00
43
+ :response:
44
+ :auth_code: '1234235'
45
+ :avs_result:
46
+ :last4: '1234'
47
+ :merchant_client_id: '1'
48
+ :preauth_code:
49
+ :preauth_description:
50
+ :preauth_neg_report:
51
+ :preauth_result:
52
+ :response_code: A01
53
+ :response_description: APPROVED
54
+ :response_type: A
55
+ :status: Funded
56
+ :transaction_id: gewragwegew-34-fqwf4fa
57
+ :sales_tax_amount: '0'
58
+ :service_fee: '0'
59
+ :service_fee_principal: '0'
60
+ :shipto_address:
61
+ :shipto_address2:
62
+ :shipto_city:
63
+ :shipto_freight_amount: '0'
64
+ :shipto_name:
65
+ :shipto_postal_code:
66
+ :shipto_state:
67
+ :total_amount: '25'
68
+ :transaction_id: gewragwegew-34-fqwf4fa
69
+ :ts_created: !ruby/object:DateTime 2012-08-28 17:00:00.000000000 -07:00
70
+ :updated_date: !ruby/object:DateTime 2012-08-28 17:00:00.000000000 -07:00
71
+ :user_defined:
72
+ :wallet_id:
73
+ :@xmlns:i: http://www.w3.org/2001/XMLSchema-instance
@@ -0,0 +1,13 @@
1
+ --- !ruby/object:Laundry::PaymentsGateway::TransactionResponse
2
+ record:
3
+ :pg_response_type: A
4
+ :pg_response_code: A01
5
+ :pg_response_description: APPROVED
6
+ :pg_authorization_code: '12345678'
7
+ :pg_trace_number: AAABCCED-C99D-4971-A218-49308439DABCD
8
+ :pg_merchant_id: '1'
9
+ :pg_transaction_type: '23'
10
+ :pg_total_amount: '25.0'
11
+ :ecom_consumerorderid: order21
12
+ :pg_client_id: '1'
13
+ :pg_payment_method_id: '1'
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe Laundry::PaymentsGateway::Merchant do
4
4
 
5
- let(:merchant) { build :merchant }
5
+ let(:merchant) { Laundry.mock :merchant }
6
6
 
7
7
  describe "#find" do
8
8
  before do
data/spec/spec_helper.rb CHANGED
@@ -4,15 +4,13 @@
4
4
  # loaded once.
5
5
  #
6
6
  # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
- require 'factory_girl'
7
+ require 'yaml'
8
8
 
9
9
  RSpec.configure do |config|
10
10
  config.treat_symbols_as_metadata_keys_with_true_values = true
11
11
  config.run_all_when_everything_filtered = true
12
12
  config.filter_run :focus
13
- config.include FactoryGirl::Syntax::Methods
14
13
  end
15
14
 
16
15
  require_relative "../lib/laundry"
17
- FactoryGirl.find_definitions
18
- Laundry.stub!
16
+ Laundry.stub!
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: laundry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-10 00:00:00.000000000 Z
12
+ date: 2012-09-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: savon
@@ -43,22 +43,6 @@ dependencies:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
- - !ruby/object:Gem::Dependency
47
- name: factory_girl
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: '0'
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
46
  - !ruby/object:Gem::Dependency
63
47
  name: debugger
64
48
  requirement: !ruby/object:Gem::Requirement
@@ -108,10 +92,12 @@ files:
108
92
  - lib/laundry/payments_gateway/payments_gateway.rb
109
93
  - lib/laundry/stubbed.rb
110
94
  - lib/laundry/version.rb
111
- - spec/factories/accounts_factory.rb
112
- - spec/factories/clients_factory.rb
113
- - spec/factories/merchants_factory.rb
114
- - spec/factories/transaction_response_factory.rb
95
+ - spec/fixtures/account.yml
96
+ - spec/fixtures/client.yml
97
+ - spec/fixtures/failing_transaction_response.yml
98
+ - spec/fixtures/merchant.yml
99
+ - spec/fixtures/transaction.yml
100
+ - spec/fixtures/transaction_response.yml
115
101
  - spec/laundry/merchant_spec.rb
116
102
  - spec/spec_helper.rb
117
103
  homepage: https://github.com/wilg/laundry
@@ -128,7 +114,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
128
114
  version: '0'
129
115
  segments:
130
116
  - 0
131
- hash: -483635044022324010
117
+ hash: -2420189650168298610
132
118
  required_rubygems_version: !ruby/object:Gem::Requirement
133
119
  none: false
134
120
  requirements:
@@ -137,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
123
  version: '0'
138
124
  segments:
139
125
  - 0
140
- hash: -483635044022324010
126
+ hash: -2420189650168298610
141
127
  requirements: []
142
128
  rubyforge_project:
143
129
  rubygems_version: 1.8.24
@@ -145,9 +131,11 @@ signing_key:
145
131
  specification_version: 3
146
132
  summary: A soapy interface to ACH Direct's PaymentsGateway.com service.
147
133
  test_files:
148
- - spec/factories/accounts_factory.rb
149
- - spec/factories/clients_factory.rb
150
- - spec/factories/merchants_factory.rb
151
- - spec/factories/transaction_response_factory.rb
134
+ - spec/fixtures/account.yml
135
+ - spec/fixtures/client.yml
136
+ - spec/fixtures/failing_transaction_response.yml
137
+ - spec/fixtures/merchant.yml
138
+ - spec/fixtures/transaction.yml
139
+ - spec/fixtures/transaction_response.yml
152
140
  - spec/laundry/merchant_spec.rb
153
141
  - spec/spec_helper.rb
@@ -1,10 +0,0 @@
1
- # Read about factories at http://github.com/thoughtbot/factory_girl
2
-
3
- FactoryGirl.define do
4
- factory :account, class: Laundry::PaymentsGateway::Client do
5
- payment_method_id '1'
6
- initialize_with do
7
- Laundry::PaymentsGateway::Account.from_response({get_payment_method_response: {get_payment_method_result: {payment_method: attributes}}}, FactoryGirl.build(:merchant))
8
- end
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- # Read about factories at http://github.com/thoughtbot/factory_girl
2
-
3
- FactoryGirl.define do
4
- factory :client, class: Laundry::PaymentsGateway::Client do
5
- client_id '1'
6
- initialize_with do
7
- Laundry::PaymentsGateway::Client.from_response({get_client_response: {get_client_result: {client_record: attributes}}}, FactoryGirl.build(:merchant))
8
- end
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- # Read about factories at http://github.com/thoughtbot/factory_girl
2
-
3
- FactoryGirl.define do
4
- factory :merchant, class: Laundry::PaymentsGateway::Merchant do
5
- id '123456'
6
- api_login_id 'abc123'
7
- api_password 'secretsauce'
8
- transaction_password 'moneymoneymoney'
9
- end
10
- end
@@ -1,8 +0,0 @@
1
- # Read about factories at http://github.com/thoughtbot/factory_girl
2
-
3
- FactoryGirl.define do
4
- factory :transaction_response, class: Laundry::PaymentsGateway::TransactionResponse do
5
- pg_response_type "A"
6
- initialize_with { Laundry::PaymentsGateway::TransactionResponse.from_response(attributes, FactoryGirl.build(:merchant)) }
7
- end
8
- end