baby-braspag 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,21 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ Bundler.setup(:default)
4
+ require 'httpi'
5
+ require 'nokogiri'
6
+ require 'json'
7
+ require 'baby-braspag'
8
+
9
+ require 'fakeweb'
10
+
11
+ ENV["BRASPAG_ENV"] ||= "test"
12
+
13
+ RSpec.configure do |config|
14
+ config.mock_with :rspec
15
+ config.after(:each) do
16
+ FakeWeb.clean_registry
17
+ end
18
+
19
+ HTTPI.log = false
20
+ FakeWeb.allow_net_connect = false
21
+ end
@@ -0,0 +1,47 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe Braspag::Utils do
4
+ describe ".convert_decimal_to_string" do
5
+ it "should convert decimal to string with comma as decimal separator" do
6
+ Braspag::Utils.convert_decimal_to_string(10).should == "10,00"
7
+ Braspag::Utils.convert_decimal_to_string(1).should == "1,00"
8
+ Braspag::Utils.convert_decimal_to_string(0.1).should == "0,10"
9
+ Braspag::Utils.convert_decimal_to_string(0.01).should == "0,01"
10
+ Braspag::Utils.convert_decimal_to_string(9.99999).should == "10,00" # round up
11
+ Braspag::Utils.convert_decimal_to_string(10.9).should == "10,90"
12
+ Braspag::Utils.convert_decimal_to_string(9.1111).should == "9,11"
13
+ end
14
+ end
15
+
16
+ describe ".convert_to_map" do
17
+ let(:document) do
18
+ <<-XML
19
+ <root>
20
+ <foo>blabla</foo>
21
+ <bar>bleble</bar>
22
+ <baz></baz>
23
+ </root>
24
+ XML
25
+ end
26
+
27
+ context "basic document and keys" do
28
+ it "should return a Hash" do
29
+ keys = { :foo => nil, :meu_elemento => "bar", :outro_elemento => "baz" }
30
+ expected = { :foo => "blabla", :meu_elemento => "bleble", :outro_elemento => nil }
31
+
32
+ Braspag::Utils::convert_to_map(document, keys).should == expected
33
+ end
34
+ end
35
+
36
+ context "keys with a Proc" do
37
+ it "should return a Hash" do
38
+ proc = Proc.new { "value returned by Proc" }
39
+
40
+ keys = { :foo => proc, :meu_elemento => "bar", :outro_elemento => "baz" }
41
+ expected = { :foo => "value returned by Proc", :meu_elemento => "bleble", :outro_elemento => nil }
42
+
43
+ Braspag::Utils::convert_to_map(document, keys).should == expected
44
+ end
45
+ end
46
+ end
47
+ end
metadata ADDED
@@ -0,0 +1,269 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: baby-braspag
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.3
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - baby dev
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-01-22 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: httpi
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 0.9.6
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 0.9.6
30
+ - !ruby/object:Gem::Dependency
31
+ name: json
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: 1.6.1
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 1.6.1
46
+ - !ruby/object:Gem::Dependency
47
+ name: nokogiri
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: 1.4.7
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 1.4.7
62
+ - !ruby/object:Gem::Dependency
63
+ name: savon
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: 0.9.9
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: 0.9.9
78
+ - !ruby/object:Gem::Dependency
79
+ name: rake
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: rspec
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: fakeweb
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: shoulda-matchers
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ - !ruby/object:Gem::Dependency
143
+ name: guard-rspec
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ type: :development
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ - !ruby/object:Gem::Dependency
159
+ name: guard-bundler
160
+ requirement: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - ! '>='
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ type: :development
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ! '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ - !ruby/object:Gem::Dependency
175
+ name: debugger
176
+ requirement: !ruby/object:Gem::Requirement
177
+ none: false
178
+ requirements:
179
+ - - ! '>='
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
182
+ type: :development
183
+ prerelease: false
184
+ version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - ! '>='
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
190
+ description: baby braspag gem to use Braspag gateway
191
+ email:
192
+ - ! '"dev-team@baby.com.br"'
193
+ executables: []
194
+ extensions: []
195
+ extra_rdoc_files: []
196
+ files:
197
+ - .gitignore
198
+ - .rspec
199
+ - Gemfile
200
+ - Guardfile
201
+ - README.md
202
+ - RELEASES.md
203
+ - Rakefile
204
+ - baby-braspag.gemspec
205
+ - config/braspag.yml
206
+ - lib/baby-braspag.rb
207
+ - lib/baby-braspag/bill.rb
208
+ - lib/baby-braspag/connection.rb
209
+ - lib/baby-braspag/credit_card.rb
210
+ - lib/baby-braspag/crypto/jar_webservice.rb
211
+ - lib/baby-braspag/crypto/webservice.rb
212
+ - lib/baby-braspag/eft.rb
213
+ - lib/baby-braspag/errors.rb
214
+ - lib/baby-braspag/order.rb
215
+ - lib/baby-braspag/payment_method.rb
216
+ - lib/baby-braspag/poster.rb
217
+ - lib/baby-braspag/protected_credit_card.rb
218
+ - lib/baby-braspag/utils.rb
219
+ - lib/baby-braspag/version.rb
220
+ - lib/generators/braspag/install/install_generator.rb
221
+ - lib/generators/braspag/install/templates/config/braspag.yml
222
+ - spec/bill_spec.rb
223
+ - spec/connection_spec.rb
224
+ - spec/credit_card_spec.rb
225
+ - spec/crypto/jar_webservice_spec.rb
226
+ - spec/crypto/webservice_spec.rb
227
+ - spec/eft_spec.rb
228
+ - spec/order_spec.rb
229
+ - spec/poster_spec.rb
230
+ - spec/protected_credit_card_spec.rb
231
+ - spec/spec_helper.rb
232
+ - spec/utils_spec.rb
233
+ homepage: https://github.com/Baby-com-br/braspag
234
+ licenses: []
235
+ post_install_message:
236
+ rdoc_options: []
237
+ require_paths:
238
+ - lib
239
+ required_ruby_version: !ruby/object:Gem::Requirement
240
+ none: false
241
+ requirements:
242
+ - - ! '>='
243
+ - !ruby/object:Gem::Version
244
+ version: '0'
245
+ required_rubygems_version: !ruby/object:Gem::Requirement
246
+ none: false
247
+ requirements:
248
+ - - ! '>='
249
+ - !ruby/object:Gem::Version
250
+ version: '0'
251
+ requirements: []
252
+ rubyforge_project: baby-braspag
253
+ rubygems_version: 1.8.24
254
+ signing_key:
255
+ specification_version: 3
256
+ summary: baby braspag gem to use Braspag gateway
257
+ test_files:
258
+ - spec/bill_spec.rb
259
+ - spec/connection_spec.rb
260
+ - spec/credit_card_spec.rb
261
+ - spec/crypto/jar_webservice_spec.rb
262
+ - spec/crypto/webservice_spec.rb
263
+ - spec/eft_spec.rb
264
+ - spec/order_spec.rb
265
+ - spec/poster_spec.rb
266
+ - spec/protected_credit_card_spec.rb
267
+ - spec/spec_helper.rb
268
+ - spec/utils_spec.rb
269
+ has_rdoc: