webmock_method 1.1.0 → 1.1.1

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
- YjY3N2ZjOTUyYzQyZGExNzc5OTQ3ODhiMmU1NmU4MDkwNjQzZDgzMg==
4
+ ODk4MzJkOWEyNTA3YzI4Y2Y2YzgxZGY5ZDAzNDQ0ZGFhNTEyMmJlMA==
5
5
  data.tar.gz: !binary |-
6
- OGMyMGFjNTQ5Y2JlNzIwYWMwMmQyODZmNDFhMWVlYzg0ZDVhYjQ1Yw==
6
+ NTRiYTEwNGMyNzAyNzc4M2YyYmRiZGM5NzYyNTY4YzY3NmNlYTg3MQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NmNjZDJmNzYyZWFiYmJmZTVkYjQ5ZWJhOTE5MjQ1YjQ4OTQ4MzBlMmIwNDU0
10
- ZGM3NDNmODU1ZjMxMjBiYWFlNzc2NzZkODM3ZGQ1YWIwZWMzOWY5Zjc0OTlj
11
- MWYyNjlmYTFhYThhZTE5ZjY0MWRmNDQ1MDlkYTM4NTM0ZWFkYTM=
9
+ MWEwNTUxN2I3Mjk2ODRhMmQ2MjI0NTJhZWM3MWM2M2JhMjI1MDQyYmViNTk3
10
+ NjdlZDEzMTIzYmJkMDRhYjNhODMwNGU1ZjMwNGZlNDI3ZGM2MzIyNzYwYzM1
11
+ Njg4NWM5ZjBiNmQwNWI5N2NkMjRiYTEwNjg3YWY5MDQ4ZGFmNzI=
12
12
  data.tar.gz: !binary |-
13
- ZmU1OGE0NzNiZmRhMTYyMDVlZWU5OGM5MDc2ZDU5ZmU1ZWI1MzA5YzQ0NzZi
14
- M2E5MjQyMjIxYzYzYjQwMjVkN2IyZTdjMDk0YTUyODkyYjAxMWFmNWExNzRh
15
- ZmVjYzg1YzVjYWJjZDIyMjA4ODZjMjk3YWNjZmE1MmVlZDY3OWU=
13
+ ZDAwMGY3ODhjOTllNDMzYTU0NWI2MzNlZDQxZmI1ZDJlM2JmMWIyNDBlODM1
14
+ YTlmZjY2ODExODk3MDYwNDMyYWVhZDdhMmJhNTRmOTQ2ZTExZmY0MThhOTFk
15
+ NTExZDQ5MDAzOGQ2OGM5YjRmZDA0YmQwZWYzMmZiYThlZTk1NWM=
data/CHANGES CHANGED
@@ -14,3 +14,7 @@
14
14
  * Externalizing meta_methods.
15
15
  * Adding tests for error path.
16
16
  * Adding haml as supported renderer.
17
+
18
+ == Version 1.2.0
19
+
20
+ * Small change in API.
@@ -1,3 +1,3 @@
1
1
  module WebmockMethod
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
@@ -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 = nil)
14
- object = self
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
- object.define_attribute(self, param_name, args[index])
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.0
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: