wirecardmapper 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +5 -3
- data/lib/wirecardmapper/models/base.rb +10 -1
- data/lib/wirecardmapper/models/mongo_mapper.rb +11 -8
- data/lib/wirecardmapper/version.rb +1 -1
- data/spec/fixtures/vcr_cassettes/WirecardMapper/_change_card_status/should_set_status.yml +170 -0
- data/spec/fixtures/vcr_cassettes/WirecardMapper/_change_card_status/should_switch_status.yml +279 -0
- data/spec/fixtures/vcr_cassettes/WirecardMapper/_submit_payment/should_load_card.yml +173 -0
- data/spec/fixtures/vcr_cassettes/WirecardMapper/_submit_payment/unload/should_unload_card.yml +223 -0
- data/spec/fixtures/vcr_cassettes/WirecardMapper/should_create_card.yml +58 -0
- data/spec/fixtures/vcr_cassettes/WirecardMapper/should_get_card_info.yml +123 -0
- data/spec/fixtures/vcr_cassettes/WirecardMapper/should_get_payment_info.yml +106 -0
- data/spec/fixtures/vcr_cassettes/WirecardMapper/should_update_card_info.yml +105 -0
- data/spec/fixtures/vcr_cassettes/WirecardMapper_Model_Base/_payment_info/should_get_info.yml +104 -0
- data/spec/fixtures/vcr_cassettes/WirecardMapper_Model_Base/change_status/should_activate_card.yml +167 -0
- data/spec/fixtures/vcr_cassettes/WirecardMapper_Model_Base/change_status/should_block_card.yml +167 -0
- data/spec/fixtures/vcr_cassettes/WirecardMapper_Model_Base/change_status/should_cancelled_card.yml +167 -0
- data/spec/fixtures/vcr_cassettes/WirecardMapper_Model_Base/load_amount/should_get_balance.yml +171 -0
- data/spec/fixtures/vcr_cassettes/WirecardMapper_Model_Base/should_get_expiration_year.yml +120 -0
- data/spec/fixtures/vcr_cassettes/WirecardMapper_Model_Base/unload_amount/should_get_balance.yml +284 -0
- data/spec/fixtures/vcr_cassettes/WirecardMapper_Model_Base/unload_amount/should_unload_card_with_comment.yml +222 -0
- data/spec/fixtures/vcr_cassettes/WirecardMapper_Model_MongoMapper/caching/should_get_status_from_the_database.yml +276 -0
- data/spec/fixtures/vcr_cassettes/WirecardMapper_Model_MongoMapper/should_create_card.yml +167 -0
- data/spec/fixtures/vcr_cassettes/WirecardMapper_Model_MongoMapper/with_missing_card_id/should_not_create_card.yml +167 -0
- data/spec/fixtures/vcr_cassettes/WirecardMapper_Model_MongoMapper/with_wirecard_error_response/should_not_create_card.yml +49 -0
- data/spec/functional/models/base_spec.rb +8 -2
- data/spec/functional/models/mongo_mapper_spec.rb +31 -4
- data/spec/functional/wirecardmapper_spec.rb +1 -1
- data/spec/spec_helper.rb +7 -15
- metadata +23 -3
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe WirecardMapper::Model::Base do
|
3
|
+
describe WirecardMapper::Model::Base, :vcr do
|
4
4
|
|
5
5
|
before(:all) do
|
6
6
|
@klass = Class.new
|
@@ -19,7 +19,13 @@ describe WirecardMapper::Model::Base do
|
|
19
19
|
let(:card) { @klass.new(WirecardMapper.create_card.card_id, 2200) }
|
20
20
|
|
21
21
|
it "should get expiration year" do
|
22
|
-
card.expiration_year.should eql(
|
22
|
+
card.expiration_year.should eql(2013)
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "#payment_info" do
|
26
|
+
it "should get info" do
|
27
|
+
card.payment_info(1.year.ago, Time.now).return_code eql?(0)
|
28
|
+
end
|
23
29
|
end
|
24
30
|
|
25
31
|
describe "change status" do
|
@@ -1,6 +1,21 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe WirecardMapper::Model::MongoMapper do
|
3
|
+
describe WirecardMapper::Model::MongoMapper, :vcr do
|
4
|
+
|
5
|
+
before(:all) do
|
6
|
+
MongoMapper.connection = Mongo::Connection.new('127.0.0.1', 27017)
|
7
|
+
MongoMapper.database = "wirecardmapper_test"
|
8
|
+
|
9
|
+
DatabaseCleaner[:mongo_mapper].strategy = :truncation
|
10
|
+
end
|
11
|
+
|
12
|
+
before(:each) do
|
13
|
+
DatabaseCleaner.start
|
14
|
+
end
|
15
|
+
|
16
|
+
after(:each) do
|
17
|
+
DatabaseCleaner.clean
|
18
|
+
end
|
4
19
|
|
5
20
|
before(:all) do
|
6
21
|
@klass = Class.new
|
@@ -14,17 +29,29 @@ describe WirecardMapper::Model::MongoMapper do
|
|
14
29
|
key :card_id, String
|
15
30
|
key :number, String
|
16
31
|
key :security_code, Integer
|
32
|
+
key :status, String
|
17
33
|
end
|
18
34
|
end
|
19
35
|
|
36
|
+
let(:card) { @klass.create! }
|
20
37
|
|
21
38
|
it "should create card" do
|
22
|
-
card = @klass.new
|
23
|
-
|
24
|
-
card.save.should be_true
|
25
39
|
card.card_id.should_not be_blank
|
26
40
|
card.number.should_not be_blank
|
27
41
|
card.security_code.should_not be_blank
|
28
42
|
end
|
29
43
|
|
44
|
+
context "with wirecard error response" do
|
45
|
+
it "should not create card" do
|
46
|
+
expect { @klass.create! }.to raise_exception(WirecardMapper::Exception, "Request cannot be accepted with the current status of the card.")
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe "caching" do
|
51
|
+
it "should get status from the database" do
|
52
|
+
card.blocked?.should be_true
|
53
|
+
card.activated!
|
54
|
+
card.activated?.should be_true
|
55
|
+
end
|
56
|
+
end
|
30
57
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -6,6 +6,7 @@ require 'mongo_mapper'
|
|
6
6
|
require 'wirecardmapper'
|
7
7
|
require 'rspec'
|
8
8
|
require 'database_cleaner'
|
9
|
+
require 'vcr'
|
9
10
|
|
10
11
|
FIXTURES_PATH = "#{File.dirname(__FILE__)}/fixtures"
|
11
12
|
|
@@ -19,21 +20,12 @@ WirecardMapper::Config.product_id = 11
|
|
19
20
|
WirecardMapper::Config.currency = "EUR"
|
20
21
|
|
21
22
|
RSpec.configure do |config|
|
23
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
22
24
|
config.mock_with :rspec
|
23
|
-
|
24
|
-
config.before(:suite) do
|
25
|
-
MongoMapper.connection = Mongo::Connection.new('127.0.0.1', 27017)
|
26
|
-
MongoMapper.database = "wirecardmapper_test"
|
27
|
-
|
28
|
-
DatabaseCleaner[:mongo_mapper].strategy = :truncation
|
29
|
-
end
|
30
|
-
|
31
|
-
config.before(:each) do
|
32
|
-
DatabaseCleaner.start
|
33
|
-
end
|
34
|
-
|
35
|
-
config.after(:each) do
|
36
|
-
DatabaseCleaner.clean
|
37
|
-
end
|
38
25
|
end
|
39
26
|
|
27
|
+
VCR.configure do |c|
|
28
|
+
c.cassette_library_dir = "#{FIXTURES_PATH}/vcr_cassettes"
|
29
|
+
c.hook_into :webmock
|
30
|
+
c.configure_rspec_metadata!
|
31
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wirecardmapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
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:
|
12
|
+
date: 2013-01-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -147,6 +147,26 @@ files:
|
|
147
147
|
- spec/unit/request_spec.rb
|
148
148
|
- spec/unit/response_spec.rb
|
149
149
|
- spec/unit/config_spec.rb
|
150
|
+
- spec/fixtures/vcr_cassettes/WirecardMapper_Model_MongoMapper/caching/should_get_status_from_the_database.yml
|
151
|
+
- spec/fixtures/vcr_cassettes/WirecardMapper_Model_MongoMapper/with_wirecard_error_response/should_not_create_card.yml
|
152
|
+
- spec/fixtures/vcr_cassettes/WirecardMapper_Model_MongoMapper/should_create_card.yml
|
153
|
+
- spec/fixtures/vcr_cassettes/WirecardMapper_Model_MongoMapper/with_missing_card_id/should_not_create_card.yml
|
154
|
+
- spec/fixtures/vcr_cassettes/WirecardMapper/should_get_payment_info.yml
|
155
|
+
- spec/fixtures/vcr_cassettes/WirecardMapper/_submit_payment/should_load_card.yml
|
156
|
+
- spec/fixtures/vcr_cassettes/WirecardMapper/_submit_payment/unload/should_unload_card.yml
|
157
|
+
- spec/fixtures/vcr_cassettes/WirecardMapper/_change_card_status/should_set_status.yml
|
158
|
+
- spec/fixtures/vcr_cassettes/WirecardMapper/_change_card_status/should_switch_status.yml
|
159
|
+
- spec/fixtures/vcr_cassettes/WirecardMapper/should_get_card_info.yml
|
160
|
+
- spec/fixtures/vcr_cassettes/WirecardMapper/should_create_card.yml
|
161
|
+
- spec/fixtures/vcr_cassettes/WirecardMapper/should_update_card_info.yml
|
162
|
+
- spec/fixtures/vcr_cassettes/WirecardMapper_Model_Base/_payment_info/should_get_info.yml
|
163
|
+
- spec/fixtures/vcr_cassettes/WirecardMapper_Model_Base/should_get_expiration_year.yml
|
164
|
+
- spec/fixtures/vcr_cassettes/WirecardMapper_Model_Base/load_amount/should_get_balance.yml
|
165
|
+
- spec/fixtures/vcr_cassettes/WirecardMapper_Model_Base/change_status/should_activate_card.yml
|
166
|
+
- spec/fixtures/vcr_cassettes/WirecardMapper_Model_Base/change_status/should_cancelled_card.yml
|
167
|
+
- spec/fixtures/vcr_cassettes/WirecardMapper_Model_Base/change_status/should_block_card.yml
|
168
|
+
- spec/fixtures/vcr_cassettes/WirecardMapper_Model_Base/unload_amount/should_unload_card_with_comment.yml
|
169
|
+
- spec/fixtures/vcr_cassettes/WirecardMapper_Model_Base/unload_amount/should_get_balance.yml
|
150
170
|
- spec/fixtures/wirecard_server_down.xml
|
151
171
|
- spec/fixtures/config/wirecardmapper.yml
|
152
172
|
- spec/fixtures/create_card.xml
|
@@ -172,7 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
172
192
|
version: '0'
|
173
193
|
requirements: []
|
174
194
|
rubyforge_project:
|
175
|
-
rubygems_version: 1.8.
|
195
|
+
rubygems_version: 1.8.24
|
176
196
|
signing_key:
|
177
197
|
specification_version: 3
|
178
198
|
summary: A Ruby Object Mapper for Wirecard XML interface
|