my_moip-rails 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -35,7 +35,7 @@ class BaseControllerTest < ActionController::TestCase
35
35
  alias_method :original_params, :params
36
36
  end
37
37
  @controller.class.send(:define_method, :params) do
38
- { status_pagamento: '5' }
38
+ { status_pagamento: '1' }
39
39
  end
40
40
  a_stub = stub
41
41
  a_stub.expects(:done!).never
@@ -43,4 +43,88 @@ class BaseControllerTest < ActionController::TestCase
43
43
  a_stub.done!
44
44
  end
45
45
  end
46
+
47
+ test "canceled method run its block when params variable has status_pagamento 5" do
48
+ @controller.class.class_eval do
49
+ alias_method :original_params, :params
50
+ end
51
+ @controller.class.send(:define_method, :params) do
52
+ { status_pagamento: '5' }
53
+ end
54
+ a_stub = stub
55
+ a_stub.expects(:canceled!).once
56
+ @controller.canceled do
57
+ a_stub.canceled!
58
+ end
59
+ end
60
+
61
+ test "canceled method don't run its block when params variable has status_pagamento other than 4" do
62
+ @controller.class.class_eval do
63
+ alias_method :original_params, :params
64
+ end
65
+ @controller.class.send(:define_method, :params) do
66
+ { status_pagamento: '1' }
67
+ end
68
+ a_stub = stub
69
+ a_stub.expects(:canceled!).never
70
+ @controller.canceled do
71
+ a_stub.canceled!
72
+ end
73
+ end
74
+
75
+ test "reversed method run its block when params variable has status_pagamento 7" do
76
+ @controller.class.class_eval do
77
+ alias_method :original_params, :params
78
+ end
79
+ @controller.class.send(:define_method, :params) do
80
+ { status_pagamento: '7' }
81
+ end
82
+ a_stub = stub
83
+ a_stub.expects(:reversed!).once
84
+ @controller.reversed do
85
+ a_stub.reversed!
86
+ end
87
+ end
88
+
89
+ test "reversed method don't run its block when params variable has status_pagamento other than 7" do
90
+ @controller.class.class_eval do
91
+ alias_method :original_params, :params
92
+ end
93
+ @controller.class.send(:define_method, :params) do
94
+ { status_pagamento: '1' }
95
+ end
96
+ a_stub = stub
97
+ a_stub.expects(:reversed!).never
98
+ @controller.reversed do
99
+ a_stub.reversed!
100
+ end
101
+ end
102
+
103
+ test "refunded method run its block when params variable has status_pagamento 9" do
104
+ @controller.class.class_eval do
105
+ alias_method :original_params, :params
106
+ end
107
+ @controller.class.send(:define_method, :params) do
108
+ { status_pagamento: '9' }
109
+ end
110
+ a_stub = stub
111
+ a_stub.expects(:refunded!).once
112
+ @controller.refunded do
113
+ a_stub.refunded!
114
+ end
115
+ end
116
+
117
+ test "refunded method don't run its block when params variable has status_pagamento other than 9" do
118
+ @controller.class.class_eval do
119
+ alias_method :original_params, :params
120
+ end
121
+ @controller.class.send(:define_method, :params) do
122
+ { status_pagamento: '1' }
123
+ end
124
+ a_stub = stub
125
+ a_stub.expects(:refunded!).never
126
+ @controller.refunded do
127
+ a_stub.refunded!
128
+ end
129
+ end
46
130
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: my_moip-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-12-15 00:00:00.000000000 Z
13
+ date: 2013-01-21 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -44,7 +44,7 @@ dependencies:
44
44
  - - ! '>='
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0'
47
- description: Deals with Moip's payment notifications
47
+ description: MyMoip extras for Rails projects
48
48
  email:
49
49
  - irio.musskopf@caixadeideias.com.br
50
50
  - bruno.pazzim@caixadeideias.com.br
@@ -83,6 +83,8 @@ files:
83
83
  - test/dummy/config/locales/en.yml
84
84
  - test/dummy/config/routes.rb
85
85
  - test/dummy/config.ru
86
+ - test/dummy/db/test.sqlite3
87
+ - test/dummy/log/development.log
86
88
  - test/dummy/log/test.log
87
89
  - test/dummy/public/404.html
88
90
  - test/dummy/public/422.html
@@ -111,7 +113,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
111
113
  version: '0'
112
114
  segments:
113
115
  - 0
114
- hash: 252846519108905363
116
+ hash: 4550767958225056503
115
117
  required_rubygems_version: !ruby/object:Gem::Requirement
116
118
  none: false
117
119
  requirements:
@@ -120,13 +122,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
122
  version: '0'
121
123
  segments:
122
124
  - 0
123
- hash: 252846519108905363
125
+ hash: 4550767958225056503
124
126
  requirements: []
125
127
  rubyforge_project:
126
- rubygems_version: 1.8.24
128
+ rubygems_version: 1.8.23
127
129
  signing_key:
128
130
  specification_version: 3
129
- summary: MyMoip extras for Rails projects
131
+ summary: Payment's notifications
130
132
  test_files:
131
133
  - test/dummy/app/assets/javascripts/application.js
132
134
  - test/dummy/app/assets/stylesheets/application.css
@@ -149,6 +151,8 @@ test_files:
149
151
  - test/dummy/config/locales/en.yml
150
152
  - test/dummy/config/routes.rb
151
153
  - test/dummy/config.ru
154
+ - test/dummy/db/test.sqlite3
155
+ - test/dummy/log/development.log
152
156
  - test/dummy/log/test.log
153
157
  - test/dummy/public/404.html
154
158
  - test/dummy/public/422.html