webmock_method 1.1.0 → 1.1.1
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.
- checksums.yaml +8 -8
- data/CHANGES +4 -0
- data/lib/webmock_method/version.rb +1 -1
- data/lib/webmock_method/webmock_method.rb +13 -4
- data/webmock_method.gemspec +30 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ODk4MzJkOWEyNTA3YzI4Y2Y2YzgxZGY5ZDAzNDQ0ZGFhNTEyMmJlMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NTRiYTEwNGMyNzAyNzc4M2YyYmRiZGM5NzYyNTY4YzY3NmNlYTg3MQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MWEwNTUxN2I3Mjk2ODRhMmQ2MjI0NTJhZWM3MWM2M2JhMjI1MDQyYmViNTk3
|
10
|
+
NjdlZDEzMTIzYmJkMDRhYjNhODMwNGU1ZjMwNGZlNDI3ZGM2MzIyNzYwYzM1
|
11
|
+
Njg4NWM5ZjBiNmQwNWI5N2NkMjRiYTEwNjg3YWY5MDQ4ZGFmNzI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZDAwMGY3ODhjOTllNDMzYTU0NWI2MzNlZDQxZmI1ZDJlM2JmMWIyNDBlODM1
|
14
|
+
YTlmZjY2ODExODk3MDYwNDMyYWVhZDdhMmJhNTRmOTQ2ZTExZmY0MThhOTFk
|
15
|
+
NTExZDQ5MDAzOGQ2OGM5YjRmZDA0YmQwZWYzMmZiYThlZTk1NWM=
|
data/CHANGES
CHANGED
@@ -10,12 +10,12 @@ module WebmockMethod
|
|
10
10
|
attr_accessor :url
|
11
11
|
end
|
12
12
|
|
13
|
-
def webmock_method(method_name, param_names, response_proc, url
|
14
|
-
|
13
|
+
def webmock_method(method_name, param_names, response_proc, url=nil)
|
14
|
+
current_class = self
|
15
15
|
|
16
16
|
define_method("#{method_name}_with_webmock_method") do |*args|
|
17
17
|
param_names.each_with_index do |param_name, index|
|
18
|
-
|
18
|
+
current_class.define_attribute(self, param_name, args[index])
|
19
19
|
end
|
20
20
|
|
21
21
|
yield(self, *args) if block_given?
|
@@ -32,15 +32,24 @@ module WebmockMethod
|
|
32
32
|
else
|
33
33
|
response = response_proc.call(binding)
|
34
34
|
|
35
|
+
#$responses ||= []
|
36
|
+
#
|
37
|
+
#$responses << response
|
38
|
+
|
35
39
|
WebMock.stub_request(:any, request_url).to_return(:body => response)
|
36
40
|
end
|
37
41
|
|
38
42
|
send("#{method_name}_without_webmock_method", *args)
|
39
43
|
rescue Exception => e
|
40
|
-
# puts e.message
|
41
44
|
raise e
|
42
45
|
ensure
|
43
46
|
WebMock.reset!
|
47
|
+
|
48
|
+
#$responses.pop
|
49
|
+
#
|
50
|
+
#previous_response = $responses.last
|
51
|
+
#
|
52
|
+
#stub_request(:any, StubWebMethod.stubbed_url(ignore_get_params, self.url)).to_return(:body => response) if previous_response
|
44
53
|
end
|
45
54
|
end
|
46
55
|
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + '/lib/webmock_method/version')
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "webmock_method"
|
7
|
+
spec.summary = %q{Extension for webmock to make stubbed methods.}
|
8
|
+
spec.description = %q{Extension for webmock to make stubbed methods.}
|
9
|
+
spec.email = "alexander.shvets@gmail.com"
|
10
|
+
spec.authors = ["Alexander Shvets"]
|
11
|
+
spec.homepage = "http://github.com/shvets/webmock_method"
|
12
|
+
|
13
|
+
spec.files = `git ls-files`.split($\)
|
14
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
15
|
+
spec.require_paths = ["lib"]
|
16
|
+
spec.version = WebmockMethod::VERSION
|
17
|
+
spec.license = "MIT"
|
18
|
+
|
19
|
+
|
20
|
+
spec.add_runtime_dependency "webmock", [">= 0"]
|
21
|
+
spec.add_runtime_dependency "haml", [">= 0"]
|
22
|
+
spec.add_runtime_dependency "meta_methods", [">= 0"]
|
23
|
+
spec.add_development_dependency "gemspec_deps_gen", [">= 0"]
|
24
|
+
spec.add_development_dependency "gemcutter", [">= 0"]
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webmock_method
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Shvets
|
@@ -116,6 +116,7 @@ files:
|
|
116
116
|
- spec/stubs/payment_gateway.rb
|
117
117
|
- spec/stubs/templates/purchase_response.xml.erb
|
118
118
|
- spec/stubs/templates/quote_response.json.erb
|
119
|
+
- webmock_method.gemspec
|
119
120
|
- webmock_method.gemspec.erb
|
120
121
|
homepage: http://github.com/shvets/webmock_method
|
121
122
|
licenses:
|