webmock 1.15.0 → 1.15.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.15.2
4
+
5
+ * Fixed `hash_including` to accept a splat of solitary keys.
6
+
7
+ Thanks to [Tamir Duberstein](https://github.com/tamird) and [https://github.com/strongriley](https://github.com/strongriley)
8
+
3
9
  ## 1.15.0
4
10
 
5
11
  * Excon >= 0.27.5 compatibility.
data/README.md CHANGED
@@ -862,6 +862,8 @@ People who submitted patches and new features or suggested improvements. Many th
862
862
  * Florian Dütsch
863
863
  * Manuel Meurer
864
864
  * Brian D. Burns
865
+ * Riley Strong
866
+ * Tamir Duberstein
865
867
 
866
868
  For a full list of contributors you can visit the
867
869
  [contributors](https://github.com/bblimke/webmock/contributors) page.
@@ -17,7 +17,6 @@ module WebMock
17
17
  alias :request :a_request
18
18
  end
19
19
 
20
-
21
20
  def assert_requested(*args, &block)
22
21
  if not args[0].is_a?(WebMock::RequestStub)
23
22
  args = convert_uri_method_and_options_to_request_and_options(*args, &block)
@@ -36,11 +35,9 @@ module WebMock
36
35
  assert_request_not_requested(*args)
37
36
  end
38
37
 
39
- def hash_including(expected)
40
- if defined?(::RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher)
41
- RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher.new(expected)
42
- elsif defined?(::Spec::Mocks::ArgumentMatchers::HashIncludingMatcher)
43
- Spec::Mocks::ArgumentMatchers::HashIncludingMatcher.new(expected)
38
+ def hash_including(*expected)
39
+ if defined?(super)
40
+ super
44
41
  else
45
42
  WebMock::Matchers::HashIncludingMatcher.new(expected)
46
43
  end
@@ -1,3 +1,3 @@
1
1
  module WebMock
2
- VERSION = '1.15.0' unless defined?(::WebMock::VERSION)
2
+ VERSION = '1.15.2' unless defined?(::WebMock::VERSION)
3
3
  end
@@ -29,11 +29,11 @@ describe "errors" do
29
29
  end
30
30
 
31
31
  it "should not be caught by a rescue block without arguments" do
32
- request_signature = mock(:to_s => "aaa")
33
- request_stub = mock
34
- WebMock::RequestStub.stub!(:from_request_signature).and_return(request_stub)
35
- WebMock::StubRequestSnippet.stub!(:new).
36
- with(request_stub).and_return(mock(:to_s => "bbb"))
32
+ request_signature = double(:to_s => "aaa")
33
+ request_stub = double
34
+ WebMock::RequestStub.stub(:from_request_signature).and_return(request_stub)
35
+ WebMock::StubRequestSnippet.stub(:new).
36
+ with(request_stub).and_return(double(:to_s => "bbb"))
37
37
 
38
38
  exception = WebMock::NetConnectNotAllowedError.new(request_signature)
39
39
 
@@ -0,0 +1,37 @@
1
+ require 'spec_helper'
2
+
3
+ describe WebMock::API do
4
+ describe '#hash_including' do
5
+ subject { klass.new.hash_including(*args) }
6
+
7
+ let(:args) { %w(foo bar) }
8
+
9
+ context 'when mixed into a class that does not define `hash_including`' do
10
+ let(:klass) do
11
+ Class.new do
12
+ include WebMock::API
13
+ end
14
+ end
15
+
16
+ it 'uses WebMock::Matchers::HashIncludingMatcher' do
17
+ expect(subject).to be_a(WebMock::Matchers::HashIncludingMatcher)
18
+ end
19
+ end
20
+
21
+ context 'when mixed into a class with a parent that defines `hash_including`' do
22
+ let(:klass) do
23
+ Class.new(
24
+ Class.new do
25
+ def hash_including(*args)
26
+ args
27
+ end
28
+ end
29
+ ) { include WebMock::API }
30
+ end
31
+
32
+ it 'uses super and passes the args untampered' do
33
+ expect(subject).to eq(args)
34
+ end
35
+ end
36
+ end
37
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webmock
3
3
  version: !ruby/object:Gem::Version
4
- hash: 43
4
+ hash: 47
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 15
9
- - 0
10
- version: 1.15.0
9
+ - 2
10
+ version: 1.15.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Bartosz Blimke
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-10-15 00:00:00 Z
18
+ date: 2013-10-30 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: addressable
@@ -294,6 +294,7 @@ files:
294
294
  - spec/unit/errors_spec.rb
295
295
  - spec/unit/http_lib_adapters/http_lib_adapter_registry_spec.rb
296
296
  - spec/unit/http_lib_adapters/http_lib_adapter_spec.rb
297
+ - spec/unit/include_spec.rb
297
298
  - spec/unit/rack_response_spec.rb
298
299
  - spec/unit/request_execution_verifier_spec.rb
299
300
  - spec/unit/request_pattern_spec.rb
@@ -383,6 +384,7 @@ test_files:
383
384
  - spec/unit/errors_spec.rb
384
385
  - spec/unit/http_lib_adapters/http_lib_adapter_registry_spec.rb
385
386
  - spec/unit/http_lib_adapters/http_lib_adapter_spec.rb
387
+ - spec/unit/include_spec.rb
386
388
  - spec/unit/rack_response_spec.rb
387
389
  - spec/unit/request_execution_verifier_spec.rb
388
390
  - spec/unit/request_pattern_spec.rb