webmock_method 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NDMzZjE3NDEyMTJmZWIyN2NkNTA4ZjgwOTdhNTlmMzJiZmQ1NTI3NA==
4
+ YjY3N2ZjOTUyYzQyZGExNzc5OTQ3ODhiMmU1NmU4MDkwNjQzZDgzMg==
5
5
  data.tar.gz: !binary |-
6
- MGY0M2M1YTc4M2JhMGFkNjNiZmQ5ZDYyYzRjNWUyYTFiYzI1ZTA2NA==
7
- !binary "U0hBNTEy":
6
+ OGMyMGFjNTQ5Y2JlNzIwYWMwMmQyODZmNDFhMWVlYzg0ZDVhYjQ1Yw==
7
+ SHA512:
8
8
  metadata.gz: !binary |-
9
- ZTJjZjkyMGRkMGQ1NzhhYzEyNWM2MTQwYTNjODYwNzc0ZGM2ZGVlMDViMGE1
10
- OTZlOTdhODNlNzEyMTVmY2E2ZTljOGE2OGNlNWZjZjZhYjMwMTFhM2ViNjVm
11
- OWU4YWVmMTdmY2FmZjZiNjc0MGVjMzcyMWE3MDc0OGIwMTk1MmE=
9
+ NmNjZDJmNzYyZWFiYmJmZTVkYjQ5ZWJhOTE5MjQ1YjQ4OTQ4MzBlMmIwNDU0
10
+ ZGM3NDNmODU1ZjMxMjBiYWFlNzc2NzZkODM3ZGQ1YWIwZWMzOWY5Zjc0OTlj
11
+ MWYyNjlmYTFhYThhZTE5ZjY0MWRmNDQ1MDlkYTM4NTM0ZWFkYTM=
12
12
  data.tar.gz: !binary |-
13
- NmUxYWJmZjc0OTI4YWUxNWE1NGVjMjUwYTYzNjJlZGRjNTNhMDI1ZmM4NjY1
14
- NDcxMjExNzNhODc1MzdjNjgyMDc4NzA2YWNkZGQ1MTQ0MjNkYjRkNTU4NTVh
15
- YjY4MzYxZDAwZTkzNGExNTlkZmQzYTdlYjI4YTc2MmU4ZTY3YTY=
13
+ ZmU1OGE0NzNiZmRhMTYyMDVlZWU5OGM5MDc2ZDU5ZmU1ZWI1MzA5YzQ0NzZi
14
+ M2E5MjQyMjIxYzYzYjQwMjVkN2IyZTdjMDk0YTUyODkyYjAxMWFmNWExNzRh
15
+ ZmVjYzg1YzVjYWJjZDIyMjA4ODZjMjk3YWNjZmE1MmVlZDY3OWU=
data/.idea/.rakeTasks CHANGED
@@ -1,7 +1,7 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
2
  <Settings><!--This file was automatically generated by Ruby plugin.
3
3
  You are allowed to:
4
4
  1. Remove rake task
5
5
  2. Add existing rake tasks
6
6
  To add existing rake tasks automatically delete this file and reload the project.
7
- --><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>
7
+ --><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>
@@ -10,7 +10,7 @@
10
10
  </facet>
11
11
  </component>
12
12
  <component name="ModuleRunConfigurationManager">
13
- <configuration default="false" name="PaymentGateway: webmock_method" type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true">
13
+ <configuration default="false" name="open_weather_spec: webmock_method" type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true">
14
14
  <predefined_log_file id="RUBY_RSPEC" enabled="true" />
15
15
  <module name="webmock_method" />
16
16
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
@@ -30,16 +30,17 @@
30
30
  </EXTENSION>
31
31
  <EXTENSION ID="org.jetbrains.plugins.ruby.motion.run.MotionSimulatorRunExtension" />
32
32
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
33
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$MODULE_DIR$/spec/payment_gateway_spec.rb" />
33
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$MODULE_DIR$/spec/open_weather_map_service_spec.rb" />
34
34
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
35
35
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="**/*_spec.rb" />
36
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="PaymentGateway" />
36
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="" />
37
37
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
38
38
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
39
39
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
40
40
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
41
41
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
42
42
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ZEUS" VALUE="false" />
43
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPRING" VALUE="false" />
43
44
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
44
45
  <RunnerSettings RunnerId="RubyDebugRunner" />
45
46
  <RunnerSettings RunnerId="RubyRunner" />
@@ -47,7 +48,7 @@
47
48
  <ConfigurationWrapper RunnerId="RubyRunner" />
48
49
  <method />
49
50
  </configuration>
50
- <configuration default="false" name="open_weather_spec: webmock_method" type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true">
51
+ <configuration default="false" name="PaymentGateway#purchase returns error response if amount is negative: webmock_method" type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true">
51
52
  <predefined_log_file id="RUBY_RSPEC" enabled="true" />
52
53
  <module name="webmock_method" />
53
54
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
@@ -58,7 +59,7 @@
58
59
  <envs>
59
60
  <env name="JRUBY_OPTS" value="-X+O" />
60
61
  </envs>
61
- <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
62
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="true" />
62
63
  <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
63
64
  <EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
64
65
  <COVERAGE_PATTERN ENABLED="true">
@@ -67,46 +68,23 @@
67
68
  </EXTENSION>
68
69
  <EXTENSION ID="org.jetbrains.plugins.ruby.motion.run.MotionSimulatorRunExtension" />
69
70
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
70
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$MODULE_DIR$/spec/open_weather_map_service_spec.rb" />
71
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$MODULE_DIR$/spec/payment_gateway_spec.rb" />
71
72
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
72
73
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="**/*_spec.rb" />
73
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="" />
74
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="PaymentGateway#purchase returns error response if amount is negative" />
74
75
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
75
76
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
76
77
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
77
78
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
78
79
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
79
80
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ZEUS" VALUE="false" />
81
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPRING" VALUE="false" />
80
82
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
81
- <RunnerSettings RunnerId="RubyDebugRunner" />
82
83
  <RunnerSettings RunnerId="RubyRunner" />
83
- <ConfigurationWrapper RunnerId="RubyDebugRunner" />
84
84
  <ConfigurationWrapper RunnerId="RubyRunner" />
85
85
  <method />
86
86
  </configuration>
87
- <configuration default="false" name="payment_gateway" type="RubyRunConfigurationType" factoryName="Ruby" temporary="true">
88
- <module name="webmock_method" />
89
- <RUBY_RUN_CONFIG NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
90
- <RUBY_RUN_CONFIG NAME="WORK DIR" VALUE="$MODULE_DIR$/spec/stubs" />
91
- <RUBY_RUN_CONFIG NAME="SHOULD_USE_SDK" VALUE="false" />
92
- <RUBY_RUN_CONFIG NAME="ALTERN_SDK_NAME" VALUE="" />
93
- <RUBY_RUN_CONFIG NAME="myPassParentEnvs" VALUE="true" />
94
- <envs />
95
- <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
96
- <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
97
- <EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
98
- <COVERAGE_PATTERN ENABLED="true">
99
- <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
100
- </COVERAGE_PATTERN>
101
- </EXTENSION>
102
- <EXTENSION ID="org.jetbrains.plugins.ruby.motion.run.MotionSimulatorRunExtension" />
103
- <RUBY_RUN_CONFIG NAME="SCRIPT_PATH" VALUE="$MODULE_DIR$/spec/stubs/payment_gateway.rb" />
104
- <RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
105
- <RunnerSettings RunnerId="RubyRunner" />
106
- <ConfigurationWrapper RunnerId="RubyRunner" />
107
- <method />
108
- </configuration>
109
- <configuration default="false" name="OpenWeather#quote tests: webmock_method" type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true">
87
+ <configuration default="false" name="Run spec 'payment_gateway_spec': webmock_method" type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true">
110
88
  <predefined_log_file id="RUBY_RSPEC" enabled="true" />
111
89
  <module name="webmock_method" />
112
90
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
@@ -117,7 +95,7 @@
117
95
  <envs>
118
96
  <env name="JRUBY_OPTS" value="-X+O" />
119
97
  </envs>
120
- <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
98
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="true" />
121
99
  <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
122
100
  <EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
123
101
  <COVERAGE_PATTERN ENABLED="true">
@@ -126,22 +104,23 @@
126
104
  </EXTENSION>
127
105
  <EXTENSION ID="org.jetbrains.plugins.ruby.motion.run.MotionSimulatorRunExtension" />
128
106
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
129
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$MODULE_DIR$/spec/open_weather_map_service_spec.rb" />
107
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$MODULE_DIR$/spec/payment_gateway_spec.rb" />
130
108
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
131
109
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="**/*_spec.rb" />
132
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="OpenWeather#quote tests" />
110
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="" />
133
111
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
134
112
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
135
113
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
136
114
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
137
115
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
138
116
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ZEUS" VALUE="false" />
117
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPRING" VALUE="false" />
139
118
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
140
119
  <RunnerSettings RunnerId="RubyRunner" />
141
120
  <ConfigurationWrapper RunnerId="RubyRunner" />
142
121
  <method />
143
122
  </configuration>
144
- <configuration default="false" name="payment_gateway_spec: webmock_method" type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true">
123
+ <configuration default="false" name="MetaMethods: webmock_method" type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true">
145
124
  <predefined_log_file id="RUBY_RSPEC" enabled="true" />
146
125
  <module name="webmock_method" />
147
126
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
@@ -152,7 +131,7 @@
152
131
  <envs>
153
132
  <env name="JRUBY_OPTS" value="-X+O" />
154
133
  </envs>
155
- <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
134
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="true" />
156
135
  <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
157
136
  <EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
158
137
  <COVERAGE_PATTERN ENABLED="true">
@@ -161,45 +140,73 @@
161
140
  </EXTENSION>
162
141
  <EXTENSION ID="org.jetbrains.plugins.ruby.motion.run.MotionSimulatorRunExtension" />
163
142
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
164
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$MODULE_DIR$/spec/payment_gateway_spec.rb" />
143
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$MODULE_DIR$/spec/meta_methods_spec.rb" />
165
144
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
166
145
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="**/*_spec.rb" />
167
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="" />
146
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="MetaMethods" />
168
147
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
169
148
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
170
149
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
171
150
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
172
151
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
173
152
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ZEUS" VALUE="false" />
153
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPRING" VALUE="false" />
174
154
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
175
155
  <RunnerSettings RunnerId="RubyRunner" />
176
156
  <ConfigurationWrapper RunnerId="RubyRunner" />
177
157
  <method />
178
158
  </configuration>
159
+ <configuration default="false" name="payment_gateway" type="RubyRunConfigurationType" factoryName="Ruby" temporary="true">
160
+ <module name="webmock_method" />
161
+ <RUBY_RUN_CONFIG NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
162
+ <RUBY_RUN_CONFIG NAME="WORK DIR" VALUE="$MODULE_DIR$/spec/stubs" />
163
+ <RUBY_RUN_CONFIG NAME="SHOULD_USE_SDK" VALUE="false" />
164
+ <RUBY_RUN_CONFIG NAME="ALTERN_SDK_NAME" VALUE="" />
165
+ <RUBY_RUN_CONFIG NAME="myPassParentEnvs" VALUE="true" />
166
+ <envs />
167
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="true" />
168
+ <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
169
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
170
+ <COVERAGE_PATTERN ENABLED="true">
171
+ <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
172
+ </COVERAGE_PATTERN>
173
+ </EXTENSION>
174
+ <EXTENSION ID="org.jetbrains.plugins.ruby.motion.run.MotionSimulatorRunExtension" />
175
+ <RUBY_RUN_CONFIG NAME="SCRIPT_PATH" VALUE="$MODULE_DIR$/spec/stubs/payment_gateway.rb" />
176
+ <RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
177
+ <RunnerSettings RunnerId="RubyDebugRunner" />
178
+ <RunnerSettings RunnerId="RubyRunner" />
179
+ <ConfigurationWrapper RunnerId="RubyDebugRunner" />
180
+ <ConfigurationWrapper RunnerId="RubyRunner" />
181
+ <method />
182
+ </configuration>
179
183
  </component>
180
184
  <component name="NewModuleRootManager">
181
185
  <content url="file://$MODULE_DIR$/../docs" />
182
186
  <content url="file://$MODULE_DIR$" />
183
- <orderEntry type="jdk" jdkName="RVM: ruby-1.9.3-p448 [webmock_method]" jdkType="RUBY_SDK" />
187
+ <orderEntry type="jdk" jdkName="RVM: ruby-1.9.3-p545 [webmock_method]" jdkType="RUBY_SDK" />
184
188
  <orderEntry type="sourceFolder" forTests="false" />
185
- <orderEntry type="library" scope="PROVIDED" name="addressable (v2.3.5, RVM: ruby-1.9.3-p448 [webmock_method]) [gem]" level="application" />
186
- <orderEntry type="library" scope="PROVIDED" name="awesome_print (v1.2.0, RVM: ruby-1.9.3-p448 [webmock_method]) [gem]" level="application" />
187
- <orderEntry type="library" scope="PROVIDED" name="bundler (v1.3.5, RVM: ruby-1.9.3-p448 [webmock_method]) [gem]" level="application" />
188
- <orderEntry type="library" scope="PROVIDED" name="crack (v0.4.1, RVM: ruby-1.9.3-p448 [webmock_method]) [gem]" level="application" />
189
- <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.2.4, RVM: ruby-1.9.3-p448 [webmock_method]) [gem]" level="application" />
190
- <orderEntry type="library" scope="PROVIDED" name="file_utils (v1.0.7, RVM: ruby-1.9.3-p448 [webmock_method]) [gem]" level="application" />
191
- <orderEntry type="library" scope="PROVIDED" name="gemcutter (v0.7.1, RVM: ruby-1.9.3-p448 [webmock_method]) [gem]" level="application" />
192
- <orderEntry type="library" scope="PROVIDED" name="gemspec_deps_gen (v1.1.2, RVM: ruby-1.9.3-p448 [webmock_method]) [gem]" level="application" />
193
- <orderEntry type="library" scope="PROVIDED" name="json_pure (v1.8.1, RVM: ruby-1.9.3-p448 [webmock_method]) [gem]" level="application" />
194
- <orderEntry type="library" scope="PROVIDED" name="metaclass (v0.0.1, RVM: ruby-1.9.3-p448 [webmock_method]) [gem]" level="application" />
195
- <orderEntry type="library" scope="PROVIDED" name="mocha (v0.14.0, RVM: ruby-1.9.3-p448 [webmock_method]) [gem]" level="application" />
196
- <orderEntry type="library" scope="PROVIDED" name="rspec (v2.14.1, RVM: ruby-1.9.3-p448 [webmock_method]) [gem]" level="application" />
197
- <orderEntry type="library" scope="PROVIDED" name="rspec-core (v2.14.6, RVM: ruby-1.9.3-p448 [webmock_method]) [gem]" level="application" />
198
- <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v2.14.3, RVM: ruby-1.9.3-p448 [webmock_method]) [gem]" level="application" />
199
- <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v2.14.4, RVM: ruby-1.9.3-p448 [webmock_method]) [gem]" level="application" />
200
- <orderEntry type="library" scope="PROVIDED" name="safe_yaml (v0.9.7, RVM: ruby-1.9.3-p448 [webmock_method]) [gem]" level="application" />
201
- <orderEntry type="library" scope="PROVIDED" name="webmock (v1.15.0, RVM: ruby-1.9.3-p448 [webmock_method]) [gem]" level="application" />
202
- <orderEntry type="library" scope="PROVIDED" name="xml-simple (v1.1.2, RVM: ruby-1.9.3-p448 [webmock_method]) [gem]" level="application" />
189
+ <orderEntry type="library" scope="PROVIDED" name="addressable (v2.3.5, RVM: ruby-1.9.3-p545 [webmock_method]) [gem]" level="application" />
190
+ <orderEntry type="library" scope="PROVIDED" name="awesome_print (v1.2.0, RVM: ruby-1.9.3-p545 [webmock_method]) [gem]" level="application" />
191
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v1.5.3, RVM: ruby-1.9.3-p545 [webmock_method]) [gem]" level="application" />
192
+ <orderEntry type="library" scope="PROVIDED" name="crack (v0.4.2, RVM: ruby-1.9.3-p545 [webmock_method]) [gem]" level="application" />
193
+ <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.2.5, RVM: ruby-1.9.3-p545 [webmock_method]) [gem]" level="application" />
194
+ <orderEntry type="library" scope="PROVIDED" name="file_utils (v1.0.7, RVM: ruby-1.9.3-p545 [webmock_method]) [gem]" level="application" />
195
+ <orderEntry type="library" scope="PROVIDED" name="gemcutter (v0.7.1, RVM: ruby-1.9.3-p545 [webmock_method]) [gem]" level="application" />
196
+ <orderEntry type="library" scope="PROVIDED" name="gemspec_deps_gen (v1.1.2, RVM: ruby-1.9.3-p545 [webmock_method]) [gem]" level="application" />
197
+ <orderEntry type="library" scope="PROVIDED" name="haml (v4.0.5, RVM: ruby-1.9.3-p545 [webmock_method]) [gem]" level="application" />
198
+ <orderEntry type="library" scope="PROVIDED" name="json_pure (v1.8.1, RVM: ruby-1.9.3-p545 [webmock_method]) [gem]" level="application" />
199
+ <orderEntry type="library" scope="PROVIDED" name="meta_methods (v1.1.0, RVM: ruby-1.9.3-p545 [webmock_method]) [gem]" level="application" />
200
+ <orderEntry type="library" scope="PROVIDED" name="metaclass (v0.0.4, RVM: ruby-1.9.3-p545 [webmock_method]) [gem]" level="application" />
201
+ <orderEntry type="library" scope="PROVIDED" name="mocha (v1.0.0, RVM: ruby-1.9.3-p545 [webmock_method]) [gem]" level="application" />
202
+ <orderEntry type="library" scope="PROVIDED" name="rspec (v2.14.1, RVM: ruby-1.9.3-p545 [webmock_method]) [gem]" level="application" />
203
+ <orderEntry type="library" scope="PROVIDED" name="rspec-core (v2.14.8, RVM: ruby-1.9.3-p545 [webmock_method]) [gem]" level="application" />
204
+ <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v2.14.5, RVM: ruby-1.9.3-p545 [webmock_method]) [gem]" level="application" />
205
+ <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v2.14.6, RVM: ruby-1.9.3-p545 [webmock_method]) [gem]" level="application" />
206
+ <orderEntry type="library" scope="PROVIDED" name="safe_yaml (v1.0.1, RVM: ruby-1.9.3-p545 [webmock_method]) [gem]" level="application" />
207
+ <orderEntry type="library" scope="PROVIDED" name="tilt (v2.0.1, RVM: ruby-1.9.3-p545 [webmock_method]) [gem]" level="application" />
208
+ <orderEntry type="library" scope="PROVIDED" name="webmock (v1.17.4, RVM: ruby-1.9.3-p545 [webmock_method]) [gem]" level="application" />
209
+ <orderEntry type="library" scope="PROVIDED" name="xml-simple (v1.1.3, RVM: ruby-1.9.3-p545 [webmock_method]) [gem]" level="application" />
203
210
  </component>
204
211
  </module>
205
212
 
data/CHANGES CHANGED
@@ -7,4 +7,10 @@
7
7
 
8
8
  == Version 1.0.1
9
9
 
10
- * Small bug fixes.
10
+ * Small bug fixes.
11
+
12
+ == Version 1.1.0
13
+
14
+ * Externalizing meta_methods.
15
+ * Adding tests for error path.
16
+ * Adding haml as supported renderer.
data/Gemfile CHANGED
@@ -2,6 +2,8 @@ source "https://rubygems.org"
2
2
 
3
3
  group :default do
4
4
  gem "webmock"
5
+ gem "haml"
6
+ gem "meta_methods"
5
7
  end
6
8
 
7
9
  group :development do
data/README.md CHANGED
@@ -27,7 +27,7 @@ require 'webmock'
27
27
 
28
28
  WebMock.stub_request(:any, "www.example.com").to_return(:body => "some body")
29
29
 
30
- puts Net::HTTP.get("www.example.com", "/") # some body
30
+ expect(Net::HTTP.get("www.example.com", "/")).to eq "some body"
31
31
  ```
32
32
 
33
33
  It will stub all http verbs (GET, POST, PUT etc.) thanks to **:any** parameter.
@@ -80,8 +80,8 @@ require 'services/open_weather_map_service.rb'
80
80
  class OpenWeatherMapService
81
81
  extend WebmockMethod
82
82
 
83
- webmock_method :quote, [:location, :units], lambda { |binding|
84
- RenderHelper.render :json, "#{File.dirname(__FILE__)}/stubs/templates/quote_response.json.erb", binding
83
+ webmock_method :quote, [:location, :units], lambda { |_|
84
+ File.open "#{File.dirname(__FILE__)}/stubs/templates/quote_response.json.erb"
85
85
  }, /#{WebmockMethod.url}/
86
86
  end
87
87
  ```
@@ -94,19 +94,19 @@ end
94
94
  * **url** to remote service (optional).
95
95
 
96
96
  You can build responses of arbitrary complexity with your own code or you can use **RenderHelper**, that comes with this
97
- gem. Currently it supports 2 formats only: **json** and **xml**. Here is example of how to build xml response:
97
+ gem. Currently it supports **erb** renderer only. Here is example of how to build xml response:
98
98
 
99
99
  ```ruby
100
100
  webmock_method :purchase, [:amount, :credit_card], lambda { |binding|
101
- RenderHelper.render :xml, "#{File.dirname(__FILE__)}/templates/purchase_response.xml.erb", binding
101
+ RenderHelper.render :erb, "#{File.dirname(__FILE__)}/templates/purchase_response.xml.erb", binding
102
102
  }
103
103
  ```
104
104
 
105
- You can tweak you response on the fly:
105
+ It's possible to tweak your response on the fly:
106
106
 
107
107
  ```ruby
108
108
  webmock_method :purchase, [:amount, :credit_card], lambda { |binding|
109
- RenderHelper.render :xml, "#{File.dirname(__FILE__)}/templates/purchase_response.xml.erb", binding
109
+ RenderHelper.render :erb, "#{File.dirname(__FILE__)}/templates/purchase_response.xml.erb", binding
110
110
  } do |parent, _, credit_card|
111
111
  if credit_card.card_type == "VISA"
112
112
  define_attribute(parent, :success, true)
@@ -117,7 +117,7 @@ You can tweak you response on the fly:
117
117
  end
118
118
  ```
119
119
 
120
- and then, use new defined attributes, such as **success** and **error_message** inside your template:
120
+ and then, use newly defined attributes, such as **success** and **error_message** inside your template:
121
121
 
122
122
  ```xml
123
123
  <!-- stubs/templates/purchase_response.xml.erb -->
@@ -130,7 +130,7 @@ and then, use new defined attributes, such as **success** and **error_message**
130
130
  </PurchaseResponse>
131
131
  ```
132
132
 
133
- **url** parameter is optional. If you don't specify it, it will try to use **url** attribute defined
133
+ **url** parameter is optional. If you don't specify it, gem will try to use **url** attribute defined
134
134
  on your service or you can define **url** parameter for WebmockMethod:
135
135
 
136
136
  ```ruby
@@ -1,18 +1,19 @@
1
1
  require 'erb'
2
+ require 'haml'
2
3
 
3
4
  module RenderHelper
4
5
  extend self
5
6
 
6
7
  def render format, template, binding
7
- body = File.read(template)
8
+ body = File.read(template)
8
9
 
9
10
  case format
10
- when :json
11
- body
12
- when :xml
11
+ when :erb
13
12
  ERB.new(body).result binding
13
+ when :haml
14
+ Haml::Engine.new(body).render binding
14
15
  else
15
- throw "Unsupported format: #{format}"
16
+ body
16
17
  end
17
18
  end
18
- end
19
+ end
@@ -1,3 +1,3 @@
1
1
  module WebmockMethod
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -1,35 +1,43 @@
1
1
  require 'webmock'
2
- require 'meta_methods/meta_methods'
2
+ require 'meta_methods'
3
3
 
4
4
  module WebmockMethod
5
- include MetaMethods
5
+ include MetaMethods::Core
6
+
7
+ extend self
6
8
 
7
9
  class << self
8
10
  attr_accessor :url
9
11
  end
10
12
 
11
13
  def webmock_method(method_name, param_names, response_proc, url = nil)
14
+ object = self
15
+
12
16
  define_method("#{method_name}_with_webmock_method") do |*args|
13
17
  param_names.each_with_index do |param_name, index|
14
- MetaMethods.define_attribute(self, param_name, args[index])
18
+ object.define_attribute(self, param_name, args[index])
15
19
  end
16
20
 
17
21
  yield(self, *args) if block_given?
18
22
 
19
23
  begin
20
- response = response_proc.call(binding)
21
-
22
24
  request_url = url
23
- request_url = @url if url.nil?
25
+ request_url = @url if request_url.nil?
24
26
  request_url = WebmockMethod.url if request_url.nil?
25
27
 
26
28
  throw "Url is not defined." unless request_url
27
29
 
28
- WebMock.stub_request(:any, request_url).to_return(:body => response)
30
+ if defined?(error)
31
+ WebMock.stub_request(:any, request_url).to_raise(error)
32
+ else
33
+ response = response_proc.call(binding)
34
+
35
+ WebMock.stub_request(:any, request_url).to_return(:body => response)
36
+ end
29
37
 
30
38
  send("#{method_name}_without_webmock_method", *args)
31
39
  rescue Exception => e
32
- puts e.message
40
+ # puts e.message
33
41
  raise e
34
42
  ensure
35
43
  WebMock.reset!
@@ -26,13 +26,16 @@ require 'json'
26
26
  class OpenWeatherMapService
27
27
  extend WebmockMethod
28
28
 
29
- webmock_method :quote, [:location, :units], lambda { |binding|
30
- RenderHelper.render :json, "#{File.dirname(__FILE__)}/stubs/templates/quote_response.json.erb", binding
29
+ webmock_method :quote, [:location, :units], lambda { |_|
30
+ File.open "#{File.dirname(__FILE__)}/stubs/templates/quote_response.json.erb"
31
31
  }, /#{WebmockMethod.url}/
32
32
  end
33
33
 
34
34
  # 3. Test service mock
35
35
 
36
+ # Make sure we don't hit external service: when stub is commented, test should fail
37
+ WebMock.disable_net_connect!(allow_localhost: true)
38
+
36
39
  describe OpenWeatherMapService do
37
40
  describe "#quote" do
38
41
  it "gets the quote" do
@@ -17,6 +17,10 @@ describe PaymentGateway do
17
17
  expect(response['success'][0]).to eq('false')
18
18
  expect(response['error_message'][0]).to eq('Unsupported Credit Card Type')
19
19
  end
20
+
21
+ it "returns error response if amount is negative" do
22
+ expect{subject.purchase(-1000, valid_credit_card)}.to raise_exception(Exception)
23
+ end
20
24
  end
21
25
 
22
26
  private
data/spec/spec_helper.rb CHANGED
@@ -2,4 +2,4 @@ RSpec.configure do |config|
2
2
 
3
3
  config.mock_with :mocha
4
4
 
5
- end
5
+ end
@@ -5,9 +5,13 @@ require "services/payment_gateway.rb"
5
5
  class PaymentGateway
6
6
  extend WebmockMethod
7
7
 
8
- webmock_method :purchase, [:amount, :credit_card], lambda { |binding|
9
- RenderHelper.render :xml, "#{File.dirname(__FILE__)}/templates/purchase_response.xml.erb", binding
10
- } do |parent, _, credit_card|
8
+ webmock_method :purchase, [:amount, :credit_card],
9
+ lambda { |binding|
10
+ template = "#{File.dirname(__FILE__)}/templates/purchase_response.xml.erb"
11
+ RenderHelper.render :erb, template, binding
12
+ } do |parent, amount, credit_card|
13
+ define_attribute(parent, :error, create_error(parent, "Negative amount")) if amount < 0
14
+
11
15
  if credit_card.card_type == "VISA"
12
16
  define_attribute(parent, :success, true)
13
17
  else
@@ -16,4 +20,8 @@ class PaymentGateway
16
20
  end
17
21
  end
18
22
 
23
+ def self.create_error parent, reason
24
+ define_attribute(parent, :error, Exception.new(reason))
25
+ end
26
+
19
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webmock_method
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Shvets
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-26 00:00:00.000000000 Z
11
+ date: 2014-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: webmock
@@ -24,6 +24,34 @@ dependencies:
24
24
  - - ! '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: haml
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: meta_methods
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: gemspec_deps_gen
29
57
  requirement: !ruby/object:Gem::Requirement
@@ -76,12 +104,10 @@ files:
76
104
  - LICENSE.txt
77
105
  - README.md
78
106
  - Rakefile
79
- - lib/meta_methods/meta_methods.rb
80
107
  - lib/webmock_method.rb
81
108
  - lib/webmock_method/render_helper.rb
82
109
  - lib/webmock_method/version.rb
83
110
  - lib/webmock_method/webmock_method.rb
84
- - spec/meta_methods_spec.rb
85
111
  - spec/open_weather_map_service_spec.rb
86
112
  - spec/payment_gateway_spec.rb
87
113
  - spec/services/payment_gateway.rb
@@ -111,12 +137,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
137
  version: '0'
112
138
  requirements: []
113
139
  rubyforge_project:
114
- rubygems_version: 2.0.7
140
+ rubygems_version: 2.2.2
115
141
  signing_key:
116
142
  specification_version: 4
117
143
  summary: Extension for webmock to make stubbed methods.
118
144
  test_files:
119
- - spec/meta_methods_spec.rb
120
145
  - spec/open_weather_map_service_spec.rb
121
146
  - spec/payment_gateway_spec.rb
122
147
  - spec/services/payment_gateway.rb
@@ -1,15 +0,0 @@
1
- module MetaMethods
2
- extend self
3
-
4
- def define_attribute(object, key, value)
5
- object.singleton_class.send :attr_accessor, key.to_sym # creates accessor
6
-
7
- object.send "#{key}=".to_sym, value # sets up value for attribute
8
- end
9
-
10
- def define_attributes(object, hash)
11
- hash.each_pair do |key, value|
12
- define_attribute(object, key, value)
13
- end
14
- end
15
- end
@@ -1,28 +0,0 @@
1
- require 'meta_methods/meta_methods'
2
-
3
- describe MetaMethods do
4
- subject { MetaMethods }
5
-
6
- describe "#define_attribute" do
7
- it "creates new attribute on object" do
8
- object = Object.new
9
-
10
- subject.define_attribute object, :new_attribute, "new_attribute_value"
11
-
12
- expect(object.new_attribute).to eq("new_attribute_value")
13
- end
14
- end
15
-
16
- describe "#define_attributes" do
17
- it "creates new attributes on object" do
18
- object = Object.new
19
-
20
- subject.define_attributes object,
21
- {new_attribute1: "new_attribute_value1",
22
- new_attribute2: "new_attribute_value2" }
23
-
24
- expect(object.new_attribute1).to eq("new_attribute_value1")
25
- expect(object.new_attribute2).to eq("new_attribute_value2")
26
- end
27
- end
28
- end