rspec-mocks 2.12.1 → 2.12.2
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.
- data/Changelog.md +17 -0
 - data/lib/rspec/mocks.rb +8 -0
 - data/lib/rspec/mocks/message_expectation.rb +6 -11
 - data/lib/rspec/mocks/method_double.rb +19 -2
 - data/lib/rspec/mocks/mutate_const.rb +1 -1
 - data/lib/rspec/mocks/proxy.rb +1 -1
 - data/lib/rspec/mocks/version.rb +1 -1
 - data/lib/spec/mocks.rb +4 -0
 - data/spec/rspec/mocks/and_call_original_spec.rb +22 -0
 - data/spec/rspec/mocks/and_yield_spec.rb +7 -7
 - data/spec/rspec/mocks/any_instance/message_chains_spec.rb +6 -6
 - data/spec/rspec/mocks/any_instance_spec.rb +94 -94
 - data/spec/rspec/mocks/any_number_of_times_spec.rb +2 -2
 - data/spec/rspec/mocks/argument_expectation_spec.rb +3 -3
 - data/spec/rspec/mocks/at_least_spec.rb +15 -15
 - data/spec/rspec/mocks/at_most_spec.rb +7 -7
 - data/spec/rspec/mocks/block_return_value_spec.rb +6 -6
 - data/spec/rspec/mocks/bug_report_10260_spec.rb +1 -1
 - data/spec/rspec/mocks/bug_report_10263_spec.rb +6 -4
 - data/spec/rspec/mocks/bug_report_11545_spec.rb +1 -1
 - data/spec/rspec/mocks/bug_report_600_spec.rb +1 -1
 - data/spec/rspec/mocks/bug_report_7611_spec.rb +1 -1
 - data/spec/rspec/mocks/bug_report_8165_spec.rb +4 -4
 - data/spec/rspec/mocks/bug_report_830_spec.rb +2 -2
 - data/spec/rspec/mocks/bug_report_957_spec.rb +2 -2
 - data/spec/rspec/mocks/configuration_spec.rb +4 -4
 - data/spec/rspec/mocks/double_spec.rb +1 -1
 - data/spec/rspec/mocks/failing_argument_matchers_spec.rb +1 -1
 - data/spec/rspec/mocks/hash_excluding_matcher_spec.rb +13 -13
 - data/spec/rspec/mocks/hash_including_matcher_spec.rb +30 -30
 - data/spec/rspec/mocks/mock_ordering_spec.rb +8 -8
 - data/spec/rspec/mocks/mock_space_spec.rb +4 -4
 - data/spec/rspec/mocks/mock_spec.rb +94 -90
 - data/spec/rspec/mocks/multiple_return_value_spec.rb +21 -21
 - data/spec/rspec/mocks/mutate_const_spec.rb +112 -102
 - data/spec/rspec/mocks/nil_expectation_warning_spec.rb +6 -12
 - data/spec/rspec/mocks/null_object_mock_spec.rb +12 -12
 - data/spec/rspec/mocks/once_counts_spec.rb +7 -7
 - data/spec/rspec/mocks/options_hash_spec.rb +6 -6
 - data/spec/rspec/mocks/partial_mock_spec.rb +15 -15
 - data/spec/rspec/mocks/partial_mock_using_mocks_directly_spec.rb +17 -17
 - data/spec/rspec/mocks/passing_argument_matchers_spec.rb +6 -6
 - data/spec/rspec/mocks/precise_counts_spec.rb +7 -7
 - data/spec/rspec/mocks/record_messages_spec.rb +4 -4
 - data/spec/rspec/mocks/serialization_spec.rb +3 -3
 - data/spec/rspec/mocks/stash_spec.rb +1 -1
 - data/spec/rspec/mocks/stub_chain_spec.rb +22 -22
 - data/spec/rspec/mocks/stub_implementation_spec.rb +10 -10
 - data/spec/rspec/mocks/stub_spec.rb +50 -31
 - data/spec/rspec/mocks/stubbed_message_expectations_spec.rb +3 -3
 - data/spec/rspec/mocks/test_double_spec.rb +3 -3
 - data/spec/rspec/mocks/to_ary_spec.rb +7 -7
 - data/spec/rspec/mocks/twice_counts_spec.rb +8 -8
 - data/spec/rspec/mocks_spec.rb +13 -4
 - data/spec/spec_helper.rb +4 -0
 - metadata +5 -5
 
| 
         @@ -24,7 +24,7 @@ describe "AnyNumberOfTimes" do 
     | 
|
| 
       24 
24 
     | 
    
         
             
              it "returns the mocked value when called after a similar stub" do
         
     | 
| 
       25 
25 
     | 
    
         
             
                @mock.stub(:message).and_return :stub_value
         
     | 
| 
       26 
26 
     | 
    
         
             
                @mock.should_receive(:message).any_number_of_times.and_return(:mock_value)
         
     | 
| 
       27 
     | 
    
         
            -
                @mock.message. 
     | 
| 
       28 
     | 
    
         
            -
                @mock.message. 
     | 
| 
      
 27 
     | 
    
         
            +
                expect(@mock.message).to eq :mock_value
         
     | 
| 
      
 28 
     | 
    
         
            +
                expect(@mock.message).to eq :mock_value
         
     | 
| 
       29 
29 
     | 
    
         
             
              end
         
     | 
| 
       30 
30 
     | 
    
         
             
            end
         
     | 
| 
         @@ -9,7 +9,7 @@ module RSpec 
     | 
|
| 
       9 
9 
     | 
    
         
             
                    obj = double("matcher")
         
     | 
| 
       10 
10 
     | 
    
         
             
                    obj.stub(:respond_to?).with(:matches?).and_return(true)
         
     | 
| 
       11 
11 
     | 
    
         
             
                    obj.stub(:respond_to?).with(:failure_message_for_should).and_return(true)
         
     | 
| 
       12 
     | 
    
         
            -
                    argument_expectation.send(:is_matcher?, obj). 
     | 
| 
      
 12 
     | 
    
         
            +
                    expect(argument_expectation.send(:is_matcher?, obj)).to be_true
         
     | 
| 
       13 
13 
     | 
    
         
             
                  end
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
                  it "considers an object that responds to #matches? and #failure_message to be a matcher for backward compatibility" do
         
     | 
| 
         @@ -18,7 +18,7 @@ module RSpec 
     | 
|
| 
       18 
18 
     | 
    
         
             
                    obj.stub(:respond_to?).with(:matches?).and_return(true)
         
     | 
| 
       19 
19 
     | 
    
         
             
                    obj.stub(:respond_to?).with(:failure_message_for_should).and_return(false)
         
     | 
| 
       20 
20 
     | 
    
         
             
                    obj.stub(:respond_to?).with(:failure_message).and_return(true)
         
     | 
| 
       21 
     | 
    
         
            -
                    argument_expectation.send(:is_matcher?, obj). 
     | 
| 
      
 21 
     | 
    
         
            +
                    expect(argument_expectation.send(:is_matcher?, obj)).to be_true
         
     | 
| 
       22 
22 
     | 
    
         
             
                  end
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
24 
     | 
    
         
             
                  it "does NOT consider an object that only responds to #matches? to be a matcher" do
         
     | 
| 
         @@ -27,7 +27,7 @@ module RSpec 
     | 
|
| 
       27 
27 
     | 
    
         
             
                    obj.stub(:respond_to?).with(:matches?).and_return(true)
         
     | 
| 
       28 
28 
     | 
    
         
             
                    obj.stub(:respond_to?).with(:failure_message_for_should).and_return(false)
         
     | 
| 
       29 
29 
     | 
    
         
             
                    obj.stub(:respond_to?).with(:failure_message).and_return(false)
         
     | 
| 
       30 
     | 
    
         
            -
                    argument_expectation.send(:is_matcher?, obj). 
     | 
| 
      
 30 
     | 
    
         
            +
                    expect(argument_expectation.send(:is_matcher?, obj)).to be_false
         
     | 
| 
       31 
31 
     | 
    
         
             
                  end
         
     | 
| 
       32 
32 
     | 
    
         
             
                end
         
     | 
| 
       33 
33 
     | 
    
         
             
              end
         
     | 
| 
         @@ -7,9 +7,9 @@ module RSpec 
     | 
|
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
                  it "fails if method is never called" do
         
     | 
| 
       9 
9 
     | 
    
         
             
                    @double.should_receive(:do_something).at_least(4).times
         
     | 
| 
       10 
     | 
    
         
            -
                     
     | 
| 
      
 10 
     | 
    
         
            +
                    expect {
         
     | 
| 
       11 
11 
     | 
    
         
             
                      @double.rspec_verify
         
     | 
| 
       12 
     | 
    
         
            -
                     
     | 
| 
      
 12 
     | 
    
         
            +
                    }.to raise_error(RSpec::Mocks::MockExpectationError)
         
     | 
| 
       13 
13 
     | 
    
         
             
                  end
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
                  it "fails when called less than n times" do
         
     | 
| 
         @@ -17,31 +17,31 @@ module RSpec 
     | 
|
| 
       17 
17 
     | 
    
         
             
                    @double.do_something
         
     | 
| 
       18 
18 
     | 
    
         
             
                    @double.do_something
         
     | 
| 
       19 
19 
     | 
    
         
             
                    @double.do_something
         
     | 
| 
       20 
     | 
    
         
            -
                     
     | 
| 
      
 20 
     | 
    
         
            +
                    expect {
         
     | 
| 
       21 
21 
     | 
    
         
             
                      @double.rspec_verify
         
     | 
| 
       22 
     | 
    
         
            -
                     
     | 
| 
      
 22 
     | 
    
         
            +
                    }.to raise_error(RSpec::Mocks::MockExpectationError)
         
     | 
| 
       23 
23 
     | 
    
         
             
                  end
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
25 
     | 
    
         
             
                  it "fails when at least once method is never called" do
         
     | 
| 
       26 
26 
     | 
    
         
             
                    @double.should_receive(:do_something).at_least(:once)
         
     | 
| 
       27 
     | 
    
         
            -
                     
     | 
| 
      
 27 
     | 
    
         
            +
                    expect {
         
     | 
| 
       28 
28 
     | 
    
         
             
                      @double.rspec_verify
         
     | 
| 
       29 
     | 
    
         
            -
                     
     | 
| 
      
 29 
     | 
    
         
            +
                    }.to raise_error(RSpec::Mocks::MockExpectationError)
         
     | 
| 
       30 
30 
     | 
    
         
             
                  end
         
     | 
| 
       31 
31 
     | 
    
         | 
| 
       32 
32 
     | 
    
         
             
                  it "fails when at least twice method is called once" do
         
     | 
| 
       33 
33 
     | 
    
         
             
                    @double.should_receive(:do_something).at_least(:twice)
         
     | 
| 
       34 
34 
     | 
    
         
             
                    @double.do_something
         
     | 
| 
       35 
     | 
    
         
            -
                     
     | 
| 
      
 35 
     | 
    
         
            +
                    expect {
         
     | 
| 
       36 
36 
     | 
    
         
             
                      @double.rspec_verify
         
     | 
| 
       37 
     | 
    
         
            -
                     
     | 
| 
      
 37 
     | 
    
         
            +
                    }.to raise_error(RSpec::Mocks::MockExpectationError)
         
     | 
| 
       38 
38 
     | 
    
         
             
                  end
         
     | 
| 
       39 
39 
     | 
    
         | 
| 
       40 
40 
     | 
    
         
             
                  it "fails when at least twice method is never called" do
         
     | 
| 
       41 
41 
     | 
    
         
             
                    @double.should_receive(:do_something).at_least(:twice)
         
     | 
| 
       42 
     | 
    
         
            -
                     
     | 
| 
      
 42 
     | 
    
         
            +
                    expect {
         
     | 
| 
       43 
43 
     | 
    
         
             
                      @double.rspec_verify
         
     | 
| 
       44 
     | 
    
         
            -
                     
     | 
| 
      
 44 
     | 
    
         
            +
                    }.to raise_error(RSpec::Mocks::MockExpectationError)
         
     | 
| 
       45 
45 
     | 
    
         
             
                  end
         
     | 
| 
       46 
46 
     | 
    
         | 
| 
       47 
47 
     | 
    
         
             
                  it "passes when at least n times method is called exactly n times" do
         
     | 
| 
         @@ -93,7 +93,7 @@ module RSpec 
     | 
|
| 
       93 
93 
     | 
    
         | 
| 
       94 
94 
     | 
    
         
             
                  it "returns the value given by a block when the at least once method is called" do
         
     | 
| 
       95 
95 
     | 
    
         
             
                    @double.should_receive(:to_s).at_least(:once) { "testing" }
         
     | 
| 
       96 
     | 
    
         
            -
                    @double.to_s. 
     | 
| 
      
 96 
     | 
    
         
            +
                    expect(@double.to_s).to eq "testing"
         
     | 
| 
       97 
97 
     | 
    
         
             
                    @double.rspec_verify
         
     | 
| 
       98 
98 
     | 
    
         
             
                  end
         
     | 
| 
       99 
99 
     | 
    
         | 
| 
         @@ -127,15 +127,15 @@ module RSpec 
     | 
|
| 
       127 
127 
     | 
    
         
             
                  it "uses a stub value if no value set" do
         
     | 
| 
       128 
128 
     | 
    
         
             
                    @double.stub(:do_something => 'foo')
         
     | 
| 
       129 
129 
     | 
    
         
             
                    @double.should_receive(:do_something).at_least(:once)
         
     | 
| 
       130 
     | 
    
         
            -
                    @double.do_something. 
     | 
| 
       131 
     | 
    
         
            -
                    @double.do_something. 
     | 
| 
      
 130 
     | 
    
         
            +
                    expect(@double.do_something).to eq 'foo'
         
     | 
| 
      
 131 
     | 
    
         
            +
                    expect(@double.do_something).to eq 'foo'
         
     | 
| 
       132 
132 
     | 
    
         
             
                  end
         
     | 
| 
       133 
133 
     | 
    
         | 
| 
       134 
134 
     | 
    
         
             
                  it "prefers its own return value over a stub" do
         
     | 
| 
       135 
135 
     | 
    
         
             
                    @double.stub(:do_something => 'foo')
         
     | 
| 
       136 
136 
     | 
    
         
             
                    @double.should_receive(:do_something).at_least(:once).and_return('bar')
         
     | 
| 
       137 
     | 
    
         
            -
                    @double.do_something. 
     | 
| 
       138 
     | 
    
         
            -
                    @double.do_something. 
     | 
| 
      
 137 
     | 
    
         
            +
                    expect(@double.do_something).to eq 'bar'
         
     | 
| 
      
 138 
     | 
    
         
            +
                    expect(@double.do_something).to eq 'bar'
         
     | 
| 
       139 
139 
     | 
    
         
             
                  end
         
     | 
| 
       140 
140 
     | 
    
         
             
                end
         
     | 
| 
       141 
141 
     | 
    
         
             
              end
         
     | 
| 
         @@ -56,7 +56,7 @@ module RSpec 
     | 
|
| 
       56 
56 
     | 
    
         | 
| 
       57 
57 
     | 
    
         
             
                  it "returns the value given by a block when at_most(:once) method is called" do
         
     | 
| 
       58 
58 
     | 
    
         
             
                    @double.should_receive(:to_s).at_most(:once) { "testing" }
         
     | 
| 
       59 
     | 
    
         
            -
                    @double.to_s. 
     | 
| 
      
 59 
     | 
    
         
            +
                    expect(@double.to_s).to eq "testing"
         
     | 
| 
       60 
60 
     | 
    
         
             
                    @double.rspec_verify
         
     | 
| 
       61 
61 
     | 
    
         
             
                  end
         
     | 
| 
       62 
62 
     | 
    
         | 
| 
         @@ -64,26 +64,26 @@ module RSpec 
     | 
|
| 
       64 
64 
     | 
    
         
             
                    @double.should_receive(:do_something).at_most(2).times
         
     | 
| 
       65 
65 
     | 
    
         
             
                    @double.do_something
         
     | 
| 
       66 
66 
     | 
    
         
             
                    @double.do_something
         
     | 
| 
       67 
     | 
    
         
            -
                     
     | 
| 
      
 67 
     | 
    
         
            +
                    expect {
         
     | 
| 
       68 
68 
     | 
    
         
             
                      @double.do_something
         
     | 
| 
       69 
     | 
    
         
            -
                     
     | 
| 
      
 69 
     | 
    
         
            +
                    }.to raise_error(RSpec::Mocks::MockExpectationError)
         
     | 
| 
       70 
70 
     | 
    
         
             
                  end
         
     | 
| 
       71 
71 
     | 
    
         | 
| 
       72 
72 
     | 
    
         
             
                  it "fails fast when at_most(:once) and is called twice" do
         
     | 
| 
       73 
73 
     | 
    
         
             
                    @double.should_receive(:do_something).at_most(:once)
         
     | 
| 
       74 
74 
     | 
    
         
             
                    @double.do_something
         
     | 
| 
       75 
     | 
    
         
            -
                     
     | 
| 
      
 75 
     | 
    
         
            +
                    expect {
         
     | 
| 
       76 
76 
     | 
    
         
             
                      @double.do_something
         
     | 
| 
       77 
     | 
    
         
            -
                     
     | 
| 
      
 77 
     | 
    
         
            +
                    }.to raise_error(RSpec::Mocks::MockExpectationError)
         
     | 
| 
       78 
78 
     | 
    
         
             
                  end
         
     | 
| 
       79 
79 
     | 
    
         | 
| 
       80 
80 
     | 
    
         
             
                  it "fails fast when at_most(:twice) and is called three times" do
         
     | 
| 
       81 
81 
     | 
    
         
             
                    @double.should_receive(:do_something).at_most(:twice)
         
     | 
| 
       82 
82 
     | 
    
         
             
                    @double.do_something
         
     | 
| 
       83 
83 
     | 
    
         
             
                    @double.do_something
         
     | 
| 
       84 
     | 
    
         
            -
                     
     | 
| 
      
 84 
     | 
    
         
            +
                    expect {
         
     | 
| 
       85 
85 
     | 
    
         
             
                      @double.do_something
         
     | 
| 
       86 
     | 
    
         
            -
                     
     | 
| 
      
 86 
     | 
    
         
            +
                    }.to raise_error(RSpec::Mocks::MockExpectationError)
         
     | 
| 
       87 
87 
     | 
    
         
             
                  end
         
     | 
| 
       88 
88 
     | 
    
         
             
                end
         
     | 
| 
       89 
89 
     | 
    
         
             
              end
         
     | 
| 
         @@ -5,7 +5,7 @@ describe "a double declaration with a block handed to:" do 
     | 
|
| 
       5 
5 
     | 
    
         
             
                it "returns the value of executing the block" do
         
     | 
| 
       6 
6 
     | 
    
         
             
                  obj = Object.new
         
     | 
| 
       7 
7 
     | 
    
         
             
                  obj.should_receive(:foo) { 'bar' }
         
     | 
| 
       8 
     | 
    
         
            -
                  obj.foo. 
     | 
| 
      
 8 
     | 
    
         
            +
                  expect(obj.foo).to eq('bar')
         
     | 
| 
       9 
9 
     | 
    
         
             
                end
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
11 
     | 
    
         
             
                it "works when a multi-return stub has already been set" do
         
     | 
| 
         @@ -13,7 +13,7 @@ describe "a double declaration with a block handed to:" do 
     | 
|
| 
       13 
13 
     | 
    
         
             
                  return_value = Object.new
         
     | 
| 
       14 
14 
     | 
    
         
             
                  obj.stub(:foo).and_return(return_value, nil)
         
     | 
| 
       15 
15 
     | 
    
         
             
                  obj.should_receive(:foo) { return_value }
         
     | 
| 
       16 
     | 
    
         
            -
                  obj.foo. 
     | 
| 
      
 16 
     | 
    
         
            +
                  expect(obj.foo).to be(return_value)
         
     | 
| 
       17 
17 
     | 
    
         
             
                end
         
     | 
| 
       18 
18 
     | 
    
         
             
              end
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
         @@ -21,7 +21,7 @@ describe "a double declaration with a block handed to:" do 
     | 
|
| 
       21 
21 
     | 
    
         
             
                it "returns the value of executing the block" do
         
     | 
| 
       22 
22 
     | 
    
         
             
                  obj = Object.new
         
     | 
| 
       23 
23 
     | 
    
         
             
                  obj.stub(:foo) { 'bar' }
         
     | 
| 
       24 
     | 
    
         
            -
                  obj.foo. 
     | 
| 
      
 24 
     | 
    
         
            +
                  expect(obj.foo).to eq('bar')
         
     | 
| 
       25 
25 
     | 
    
         
             
                end
         
     | 
| 
       26 
26 
     | 
    
         
             
              end
         
     | 
| 
       27 
27 
     | 
    
         | 
| 
         @@ -29,7 +29,7 @@ describe "a double declaration with a block handed to:" do 
     | 
|
| 
       29 
29 
     | 
    
         
             
                it "returns the value of executing the block" do
         
     | 
| 
       30 
30 
     | 
    
         
             
                  obj = Object.new
         
     | 
| 
       31 
31 
     | 
    
         
             
                  obj.stub(:foo).with('baz') { 'bar' }
         
     | 
| 
       32 
     | 
    
         
            -
                  obj.foo('baz'). 
     | 
| 
      
 32 
     | 
    
         
            +
                  expect(obj.foo('baz')).to eq('bar')
         
     | 
| 
       33 
33 
     | 
    
         
             
                end
         
     | 
| 
       34 
34 
     | 
    
         
             
              end
         
     | 
| 
       35 
35 
     | 
    
         | 
| 
         @@ -38,7 +38,7 @@ describe "a double declaration with a block handed to:" do 
     | 
|
| 
       38 
38 
     | 
    
         
             
                  it "returns the value of executing the block" do
         
     | 
| 
       39 
39 
     | 
    
         
             
                    obj = Object.new
         
     | 
| 
       40 
40 
     | 
    
         
             
                    obj.stub(:foo).send(method) { 'bar' }
         
     | 
| 
       41 
     | 
    
         
            -
                    obj.foo. 
     | 
| 
      
 41 
     | 
    
         
            +
                    expect(obj.foo).to eq('bar')
         
     | 
| 
       42 
42 
     | 
    
         
             
                  end
         
     | 
| 
       43 
43 
     | 
    
         
             
                end
         
     | 
| 
       44 
44 
     | 
    
         
             
              end
         
     | 
| 
         @@ -47,7 +47,7 @@ describe "a double declaration with a block handed to:" do 
     | 
|
| 
       47 
47 
     | 
    
         
             
                it "returns the value of executing the block" do
         
     | 
| 
       48 
48 
     | 
    
         
             
                  obj = Object.new
         
     | 
| 
       49 
49 
     | 
    
         
             
                  obj.stub(:foo).at_least(1).times { 'bar' }
         
     | 
| 
       50 
     | 
    
         
            -
                  obj.foo('baz'). 
     | 
| 
      
 50 
     | 
    
         
            +
                  expect(obj.foo('baz')).to eq('bar')
         
     | 
| 
       51 
51 
     | 
    
         
             
                end
         
     | 
| 
       52 
52 
     | 
    
         
             
              end
         
     | 
| 
       53 
53 
     | 
    
         
             
            end
         
     | 
| 
         @@ -3,6 +3,6 @@ require 'spec_helper' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            describe "An RSpec Mock" do
         
     | 
| 
       4 
4 
     | 
    
         
             
              it "hides internals in its inspect representation" do
         
     | 
| 
       5 
5 
     | 
    
         
             
                m = double('cup')
         
     | 
| 
       6 
     | 
    
         
            -
                m.inspect. 
     | 
| 
      
 6 
     | 
    
         
            +
                expect(m.inspect).to match /#<RSpec::Mocks::Mock:0x[a-f0-9.]+ @name="cup">/
         
     | 
| 
       7 
7 
     | 
    
         
             
              end
         
     | 
| 
       8 
8 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,16 +1,18 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
       1 
3 
     | 
    
         
             
            describe "Double" do
         
     | 
| 
       2 
4 
     | 
    
         
             
              let(:test_double) { double }
         
     | 
| 
       3 
5 
     | 
    
         | 
| 
       4 
6 
     | 
    
         
             
              specify "when one example has an expectation inside the block passed to should_receive" do
         
     | 
| 
       5 
7 
     | 
    
         
             
                test_double.should_receive(:msg) do |arg|
         
     | 
| 
       6 
     | 
    
         
            -
                  arg. 
     | 
| 
      
 8 
     | 
    
         
            +
                  expect(arg).to be_true #this call exposes the problem
         
     | 
| 
       7 
9 
     | 
    
         
             
                end
         
     | 
| 
       8 
10 
     | 
    
         
             
                begin
         
     | 
| 
       9 
11 
     | 
    
         
             
                  test_double.msg(false)
         
     | 
| 
       10 
12 
     | 
    
         
             
                rescue Exception
         
     | 
| 
       11 
13 
     | 
    
         
             
                end
         
     | 
| 
       12 
14 
     | 
    
         
             
              end
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
       14 
16 
     | 
    
         
             
              specify "then the next example should behave as expected instead of saying" do
         
     | 
| 
       15 
17 
     | 
    
         
             
                test_double.should_receive(:foobar)
         
     | 
| 
       16 
18 
     | 
    
         
             
                test_double.foobar
         
     | 
| 
         @@ -18,8 +20,8 @@ describe "Double" do 
     | 
|
| 
       18 
20 
     | 
    
         
             
                begin
         
     | 
| 
       19 
21 
     | 
    
         
             
                  test_double.foobar
         
     | 
| 
       20 
22 
     | 
    
         
             
                rescue Exception => e
         
     | 
| 
       21 
     | 
    
         
            -
                  e.message. 
     | 
| 
      
 23 
     | 
    
         
            +
                  expect(e.message).to eq "Double received unexpected message :foobar with (no args)"
         
     | 
| 
       22 
24 
     | 
    
         
             
                end
         
     | 
| 
       23 
     | 
    
         
            -
              end 
     | 
| 
      
 25 
     | 
    
         
            +
              end
         
     | 
| 
       24 
26 
     | 
    
         
             
            end
         
     | 
| 
       25 
27 
     | 
    
         | 
| 
         @@ -26,7 +26,7 @@ describe 'should_receive' do 
     | 
|
| 
       26 
26 
     | 
    
         
             
              end
         
     | 
| 
       27 
27 
     | 
    
         | 
| 
       28 
28 
     | 
    
         
             
              it 'cleans up after itself' do
         
     | 
| 
       29 
     | 
    
         
            -
                (class << LiarLiarPantsOnFire; self; end).instance_methods. 
     | 
| 
      
 29 
     | 
    
         
            +
                expect((class << LiarLiarPantsOnFire; self; end).instance_methods).not_to include("something")
         
     | 
| 
       30 
30 
     | 
    
         
             
              end
         
     | 
| 
       31 
31 
     | 
    
         
             
            end
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
         @@ -16,16 +16,16 @@ describe "An object where respond_to? is true and does not have method" do 
     | 
|
| 
       16 
16 
     | 
    
         
             
                obj = Object.new
         
     | 
| 
       17 
17 
     | 
    
         
             
                obj.should_receive(:respond_to?).with(:foobar).and_return(true)
         
     | 
| 
       18 
18 
     | 
    
         
             
                obj.should_receive(:foobar).and_return(:baz)
         
     | 
| 
       19 
     | 
    
         
            -
                obj.respond_to?(:foobar). 
     | 
| 
       20 
     | 
    
         
            -
                obj.foobar. 
     | 
| 
      
 19 
     | 
    
         
            +
                expect(obj.respond_to?(:foobar)).to be_true
         
     | 
| 
      
 20 
     | 
    
         
            +
                expect(obj.foobar).to eq :baz
         
     | 
| 
       21 
21 
     | 
    
         
             
              end
         
     | 
| 
       22 
22 
     | 
    
         | 
| 
       23 
23 
     | 
    
         
             
              it "does not raise an exception for mock" do
         
     | 
| 
       24 
24 
     | 
    
         
             
                obj = double("obj")
         
     | 
| 
       25 
25 
     | 
    
         
             
                obj.should_receive(:respond_to?).with(:foobar).and_return(true)
         
     | 
| 
       26 
26 
     | 
    
         
             
                obj.should_receive(:foobar).and_return(:baz)
         
     | 
| 
       27 
     | 
    
         
            -
                obj.respond_to?(:foobar). 
     | 
| 
       28 
     | 
    
         
            -
                obj.foobar. 
     | 
| 
      
 27 
     | 
    
         
            +
                expect(obj.respond_to?(:foobar)).to be_true
         
     | 
| 
      
 28 
     | 
    
         
            +
                expect(obj.foobar).to eq :baz
         
     | 
| 
       29 
29 
     | 
    
         
             
              end
         
     | 
| 
       30 
30 
     | 
    
         | 
| 
       31 
31 
     | 
    
         
             
            end
         
     | 
| 
         @@ -12,9 +12,9 @@ module RSpec 
     | 
|
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
                  it 'still reports mock failures' do
         
     | 
| 
       14 
14 
     | 
    
         
             
                    Foo.should_not_receive :bar
         
     | 
| 
       15 
     | 
    
         
            -
                     
     | 
| 
      
 15 
     | 
    
         
            +
                    expect {
         
     | 
| 
       16 
16 
     | 
    
         
             
                      Foo.foo
         
     | 
| 
       17 
     | 
    
         
            -
                     
     | 
| 
      
 17 
     | 
    
         
            +
                    }.to raise_error(RSpec::Mocks::MockExpectationError)
         
     | 
| 
       18 
18 
     | 
    
         
             
                  end
         
     | 
| 
       19 
19 
     | 
    
         
             
                end
         
     | 
| 
       20 
20 
     | 
    
         
             
              end
         
     | 
| 
         @@ -11,11 +11,11 @@ module RSpec 
     | 
|
| 
       11 
11 
     | 
    
         
             
                  end
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
                  it "returns the value for the stub on the base class" do
         
     | 
| 
       14 
     | 
    
         
            -
                    @base_class.find. 
     | 
| 
      
 14 
     | 
    
         
            +
                    expect(@base_class.find).to eq "stubbed_value"
         
     | 
| 
       15 
15 
     | 
    
         
             
                  end
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
                  it "returns the value for the descendent class" do
         
     | 
| 
       18 
     | 
    
         
            -
                    @concrete_class.find. 
     | 
| 
      
 18 
     | 
    
         
            +
                    expect(@concrete_class.find).to eq "stubbed_value"
         
     | 
| 
       19 
19 
     | 
    
         
             
                  end
         
     | 
| 
       20 
20 
     | 
    
         
             
                end
         
     | 
| 
       21 
21 
     | 
    
         
             
              end
         
     | 
| 
         @@ -12,13 +12,13 @@ module RSpec 
     | 
|
| 
       12 
12 
     | 
    
         
             
                  end
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
                  it 'adds stub and should_receive to the given modules' do
         
     | 
| 
       15 
     | 
    
         
            -
                    instance_methods_of(mod_1). 
     | 
| 
       16 
     | 
    
         
            -
                    instance_methods_of(mod_2). 
     | 
| 
      
 15 
     | 
    
         
            +
                    expect(instance_methods_of(mod_1)).not_to include(:stub, :should_receive)
         
     | 
| 
      
 16 
     | 
    
         
            +
                    expect(instance_methods_of(mod_2)).not_to include(:stub, :should_receive)
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         
             
                    config.add_stub_and_should_receive_to(mod_1, mod_2)
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
                    instance_methods_of(mod_1). 
     | 
| 
       21 
     | 
    
         
            -
                    instance_methods_of(mod_2). 
     | 
| 
      
 20 
     | 
    
         
            +
                    expect(instance_methods_of(mod_1)).to include(:stub, :should_receive)
         
     | 
| 
      
 21 
     | 
    
         
            +
                    expect(instance_methods_of(mod_2)).to include(:stub, :should_receive)
         
     | 
| 
       22 
22 
     | 
    
         
             
                  end
         
     | 
| 
       23 
23 
     | 
    
         
             
                end
         
     | 
| 
       24 
24 
     | 
    
         
             
              end
         
     | 
| 
         @@ -85,7 +85,7 @@ module RSpec 
     | 
|
| 
       85 
85 
     | 
    
         | 
| 
       86 
86 
     | 
    
         
             
                  it "fails with block matchers" do
         
     | 
| 
       87 
87 
     | 
    
         
             
                    expect do
         
     | 
| 
       88 
     | 
    
         
            -
                      @double.should_receive(:msg).with {|arg| arg. 
     | 
| 
      
 88 
     | 
    
         
            +
                      @double.should_receive(:msg).with {|arg| expect(arg).to eq :received }
         
     | 
| 
       89 
89 
     | 
    
         
             
                      @double.msg :no_msg_for_you
         
     | 
| 
       90 
90 
     | 
    
         
             
                    end.to raise_error(RSpec::Expectations::ExpectationNotMetError, /expected: :received.*\s*.*got: :no_msg_for_you/)
         
     | 
| 
       91 
91 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -6,59 +6,59 @@ module RSpec 
     | 
|
| 
       6 
6 
     | 
    
         
             
                  describe HashExcludingMatcher do
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
                    it "describes itself properly" do
         
     | 
| 
       9 
     | 
    
         
            -
                      HashExcludingMatcher.new(:a => 5).description. 
     | 
| 
      
 9 
     | 
    
         
            +
                      expect(HashExcludingMatcher.new(:a => 5).description).to eq "hash_not_including(:a=>5)"
         
     | 
| 
       10 
10 
     | 
    
         
             
                    end      
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
                    describe "passing" do
         
     | 
| 
       13 
13 
     | 
    
         
             
                      it "matches a hash without the specified key" do
         
     | 
| 
       14 
     | 
    
         
            -
                        hash_not_including(:c). 
     | 
| 
      
 14 
     | 
    
         
            +
                        expect(hash_not_including(:c)).to eq({:a => 1, :b => 2})
         
     | 
| 
       15 
15 
     | 
    
         
             
                      end
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
                      it "matches a hash with the specified key, but different value" do
         
     | 
| 
       18 
     | 
    
         
            -
                        hash_not_including(:b => 3). 
     | 
| 
      
 18 
     | 
    
         
            +
                        expect(hash_not_including(:b => 3)).to eq({:a => 1, :b => 2})
         
     | 
| 
       19 
19 
     | 
    
         
             
                      end
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
21 
     | 
    
         
             
                      it "matches a hash without the specified key, given as anything()" do
         
     | 
| 
       22 
     | 
    
         
            -
                        hash_not_including(:c => anything). 
     | 
| 
      
 22 
     | 
    
         
            +
                        expect(hash_not_including(:c => anything)).to eq({:a => 1, :b => 2})
         
     | 
| 
       23 
23 
     | 
    
         
             
                      end
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
25 
     | 
    
         
             
                      it "matches an empty hash" do
         
     | 
| 
       26 
     | 
    
         
            -
                        hash_not_including(:a). 
     | 
| 
      
 26 
     | 
    
         
            +
                        expect(hash_not_including(:a)).to eq({})
         
     | 
| 
       27 
27 
     | 
    
         
             
                      end
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
29 
     | 
    
         
             
                      it "matches a hash without any of the specified keys" do
         
     | 
| 
       30 
     | 
    
         
            -
                        hash_not_including(:a, :b, :c). 
     | 
| 
      
 30 
     | 
    
         
            +
                        expect(hash_not_including(:a, :b, :c)).to eq(:d => 7)
         
     | 
| 
       31 
31 
     | 
    
         
             
                      end
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
       33 
33 
     | 
    
         
             
                    end
         
     | 
| 
       34 
34 
     | 
    
         | 
| 
       35 
35 
     | 
    
         
             
                    describe "failing" do
         
     | 
| 
       36 
36 
     | 
    
         
             
                      it "does not match a non-hash" do
         
     | 
| 
       37 
     | 
    
         
            -
                        hash_not_including(:a => 1). 
     | 
| 
      
 37 
     | 
    
         
            +
                        expect(hash_not_including(:a => 1)).not_to eq 1
         
     | 
| 
       38 
38 
     | 
    
         
             
                      end
         
     | 
| 
       39 
39 
     | 
    
         | 
| 
       40 
40 
     | 
    
         
             
                      it "does not match a hash with a specified key" do
         
     | 
| 
       41 
     | 
    
         
            -
                        hash_not_including(:b). 
     | 
| 
      
 41 
     | 
    
         
            +
                        expect(hash_not_including(:b)).not_to eq(:b => 2)
         
     | 
| 
       42 
42 
     | 
    
         
             
                      end
         
     | 
| 
       43 
43 
     | 
    
         | 
| 
       44 
44 
     | 
    
         
             
                      it "does not match a hash with the specified key/value pair" do
         
     | 
| 
       45 
     | 
    
         
            -
                        hash_not_including(:b => 2). 
     | 
| 
      
 45 
     | 
    
         
            +
                        expect(hash_not_including(:b => 2)).not_to eq(:a => 1, :b => 2)
         
     | 
| 
       46 
46 
     | 
    
         
             
                      end
         
     | 
| 
       47 
47 
     | 
    
         | 
| 
       48 
48 
     | 
    
         
             
                      it "does not match a hash with the specified key" do
         
     | 
| 
       49 
     | 
    
         
            -
                        hash_not_including(:a, :b => 3). 
     | 
| 
      
 49 
     | 
    
         
            +
                        expect(hash_not_including(:a, :b => 3)).not_to eq(:a => 1, :b => 2)
         
     | 
| 
       50 
50 
     | 
    
         
             
                      end
         
     | 
| 
       51 
51 
     | 
    
         | 
| 
       52 
52 
     | 
    
         
             
                      it "does not match a hash with one of the specified keys" do
         
     | 
| 
       53 
     | 
    
         
            -
                        hash_not_including(:a, :b). 
     | 
| 
      
 53 
     | 
    
         
            +
                        expect(hash_not_including(:a, :b)).not_to eq(:b => 2)
         
     | 
| 
       54 
54 
     | 
    
         
             
                      end
         
     | 
| 
       55 
55 
     | 
    
         | 
| 
       56 
56 
     | 
    
         
             
                      it "does not match a hash with some of the specified keys" do
         
     | 
| 
       57 
     | 
    
         
            -
                        hash_not_including(:a, :b, :c). 
     | 
| 
      
 57 
     | 
    
         
            +
                        expect(hash_not_including(:a, :b, :c)).not_to eq(:a => 1, :b => 2)
         
     | 
| 
       58 
58 
     | 
    
         
             
                      end
         
     | 
| 
       59 
59 
     | 
    
         | 
| 
       60 
60 
     | 
    
         
             
                      it "does not match a hash with one key/value pair included" do
         
     | 
| 
       61 
     | 
    
         
            -
                        hash_not_including(:a, :b, :c, :d => 7). 
     | 
| 
      
 61 
     | 
    
         
            +
                        expect(hash_not_including(:a, :b, :c, :d => 7)).not_to eq(:d => 7)
         
     | 
| 
       62 
62 
     | 
    
         
             
                      end
         
     | 
| 
       63 
63 
     | 
    
         
             
                    end
         
     | 
| 
       64 
64 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -4,84 +4,84 @@ module RSpec 
     | 
|
| 
       4 
4 
     | 
    
         
             
              module Mocks
         
     | 
| 
       5 
5 
     | 
    
         
             
                module ArgumentMatchers
         
     | 
| 
       6 
6 
     | 
    
         
             
                  describe HashIncludingMatcher do
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
       8 
8 
     | 
    
         
             
                    it "describes itself properly" do
         
     | 
| 
       9 
     | 
    
         
            -
                      HashIncludingMatcher.new(:a => 1).description. 
     | 
| 
       10 
     | 
    
         
            -
                    end 
     | 
| 
      
 9 
     | 
    
         
            +
                      expect(HashIncludingMatcher.new(:a => 1).description).to eq "hash_including(:a=>1)"
         
     | 
| 
      
 10 
     | 
    
         
            +
                    end
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
                    describe "passing" do
         
     | 
| 
       13 
13 
     | 
    
         
             
                      it "matches the same hash" do
         
     | 
| 
       14 
     | 
    
         
            -
                        hash_including(:a => 1). 
     | 
| 
      
 14 
     | 
    
         
            +
                        expect(hash_including(:a => 1)).to eq({:a => 1})
         
     | 
| 
       15 
15 
     | 
    
         
             
                      end
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
                      it "matches a hash with extra stuff" do
         
     | 
| 
       18 
     | 
    
         
            -
                        hash_including(:a => 1). 
     | 
| 
      
 18 
     | 
    
         
            +
                        expect(hash_including(:a => 1)).to eq({:a => 1, :b => 2})
         
     | 
| 
       19 
19 
     | 
    
         
             
                      end
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
       21 
21 
     | 
    
         
             
                      describe "when matching against other matchers" do
         
     | 
| 
       22 
22 
     | 
    
         
             
                        it "matches an int against anything()" do
         
     | 
| 
       23 
     | 
    
         
            -
                          hash_including(:a => anything, :b => 2). 
     | 
| 
      
 23 
     | 
    
         
            +
                          expect(hash_including(:a => anything, :b => 2)).to eq({:a => 1, :b => 2})
         
     | 
| 
       24 
24 
     | 
    
         
             
                        end
         
     | 
| 
       25 
25 
     | 
    
         | 
| 
       26 
26 
     | 
    
         
             
                        it "matches a string against anything()" do
         
     | 
| 
       27 
     | 
    
         
            -
                          hash_including(:a => anything, :b => 2). 
     | 
| 
      
 27 
     | 
    
         
            +
                          expect(hash_including(:a => anything, :b => 2)).to eq({:a => "1", :b => 2})
         
     | 
| 
       28 
28 
     | 
    
         
             
                        end
         
     | 
| 
       29 
29 
     | 
    
         
             
                      end
         
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
       31 
31 
     | 
    
         
             
                      describe "when passed only keys or keys mixed with key/value pairs" do
         
     | 
| 
       32 
32 
     | 
    
         
             
                        it "matches if the key is present" do
         
     | 
| 
       33 
     | 
    
         
            -
                          hash_including(:a). 
     | 
| 
      
 33 
     | 
    
         
            +
                          expect(hash_including(:a)).to eq({:a => 1, :b => 2})
         
     | 
| 
       34 
34 
     | 
    
         
             
                        end
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
       36 
36 
     | 
    
         
             
                        it "matches if more keys are present" do
         
     | 
| 
       37 
     | 
    
         
            -
                          hash_including(:a, :b). 
     | 
| 
      
 37 
     | 
    
         
            +
                          expect(hash_including(:a, :b)).to eq({:a => 1, :b => 2, :c => 3})
         
     | 
| 
       38 
38 
     | 
    
         
             
                        end
         
     | 
| 
       39 
39 
     | 
    
         | 
| 
       40 
40 
     | 
    
         
             
                        it "matches a string against a given key" do
         
     | 
| 
       41 
     | 
    
         
            -
                          hash_including(:a). 
     | 
| 
      
 41 
     | 
    
         
            +
                          expect(hash_including(:a)).to eq({:a => "1", :b => 2})
         
     | 
| 
       42 
42 
     | 
    
         
             
                        end
         
     | 
| 
       43 
43 
     | 
    
         | 
| 
       44 
44 
     | 
    
         
             
                        it "matches if passed one key and one key/value pair" do
         
     | 
| 
       45 
     | 
    
         
            -
                          hash_including(:a, :b => 2). 
     | 
| 
      
 45 
     | 
    
         
            +
                          expect(hash_including(:a, :b => 2)).to eq({:a => 1, :b => 2})
         
     | 
| 
       46 
46 
     | 
    
         
             
                        end
         
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
       48 
48 
     | 
    
         
             
                        it "matches if passed many keys and one key/value pair" do
         
     | 
| 
       49 
     | 
    
         
            -
                          hash_including(:a, :b, :c => 3). 
     | 
| 
      
 49 
     | 
    
         
            +
                          expect(hash_including(:a, :b, :c => 3)).to eq({:a => 1, :b => 2, :c => 3, :d => 4})
         
     | 
| 
       50 
50 
     | 
    
         
             
                        end
         
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
       52 
52 
     | 
    
         
             
                        it "matches if passed many keys and many key/value pairs" do
         
     | 
| 
       53 
     | 
    
         
            -
                          hash_including(:a, :b, :c => 3, :e => 5). 
     | 
| 
      
 53 
     | 
    
         
            +
                          expect(hash_including(:a, :b, :c => 3, :e => 5)).to eq({:a => 1, :b => 2, :c => 3, :d => 4, :e => 5})
         
     | 
| 
       54 
54 
     | 
    
         
             
                        end
         
     | 
| 
       55 
55 
     | 
    
         
             
                      end
         
     | 
| 
       56 
56 
     | 
    
         
             
                    end
         
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
       58 
58 
     | 
    
         
             
                    describe "failing" do
         
     | 
| 
       59 
59 
     | 
    
         
             
                      it "does not match a non-hash" do
         
     | 
| 
       60 
     | 
    
         
            -
                        hash_including(:a => 1). 
     | 
| 
      
 60 
     | 
    
         
            +
                        expect(hash_including(:a => 1)).not_to eq 1
         
     | 
| 
       61 
61 
     | 
    
         
             
                      end
         
     | 
| 
       62 
62 
     | 
    
         | 
| 
       63 
63 
     | 
    
         
             
                      it "does not match a hash with a missing key" do
         
     | 
| 
       64 
     | 
    
         
            -
                        hash_including(:a => 1). 
     | 
| 
      
 64 
     | 
    
         
            +
                        expect(hash_including(:a => 1)).not_to eq(:b => 2)
         
     | 
| 
       65 
65 
     | 
    
         
             
                      end
         
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
       67 
67 
     | 
    
         
             
                      it "does not match a hash with a missing key" do
         
     | 
| 
       68 
     | 
    
         
            -
                        hash_including(:a). 
     | 
| 
      
 68 
     | 
    
         
            +
                        expect(hash_including(:a)).not_to eq(:b => 2)
         
     | 
| 
       69 
69 
     | 
    
         
             
                      end
         
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
       71 
71 
     | 
    
         
             
                      it "does not match an empty hash with a given key" do
         
     | 
| 
       72 
     | 
    
         
            -
                        hash_including(:a). 
     | 
| 
      
 72 
     | 
    
         
            +
                        expect(hash_including(:a)).not_to eq({})
         
     | 
| 
       73 
73 
     | 
    
         
             
                      end
         
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
       75 
75 
     | 
    
         
             
                      it "does not match a hash with a missing key when one pair is matching" do
         
     | 
| 
       76 
     | 
    
         
            -
                        hash_including(:a, :b => 2). 
     | 
| 
      
 76 
     | 
    
         
            +
                        expect(hash_including(:a, :b => 2)).not_to eq(:b => 2)
         
     | 
| 
       77 
77 
     | 
    
         
             
                      end
         
     | 
| 
       78 
     | 
    
         
            -
             
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
       79 
79 
     | 
    
         
             
                      it "does not match a hash with an incorrect value" do
         
     | 
| 
       80 
     | 
    
         
            -
                        hash_including(:a => 1, :b => 2). 
     | 
| 
      
 80 
     | 
    
         
            +
                        expect(hash_including(:a => 1, :b => 2)).not_to eq(:a => 1, :b => 3)
         
     | 
| 
       81 
81 
     | 
    
         
             
                      end
         
     | 
| 
       82 
82 
     | 
    
         | 
| 
       83 
83 
     | 
    
         
             
                      it "does not match when values are nil but keys are different" do
         
     | 
| 
       84 
     | 
    
         
            -
                        hash_including(:a => nil). 
     | 
| 
      
 84 
     | 
    
         
            +
                        expect(hash_including(:a => nil)).not_to eq(:b => nil)
         
     | 
| 
       85 
85 
     | 
    
         
             
                      end
         
     | 
| 
       86 
86 
     | 
    
         
             
                    end
         
     | 
| 
       87 
87 
     | 
    
         
             
                  end
         
     |