rspec-mocks 2.99.4 → 3.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. checksums.yaml +14 -6
  2. checksums.yaml.gz.sig +2 -0
  3. data.tar.gz.sig +1 -0
  4. data/Changelog.md +89 -105
  5. data/License.txt +1 -0
  6. data/README.md +77 -57
  7. data/features/argument_matchers/explicit.feature +5 -5
  8. data/features/argument_matchers/general_matchers.feature +10 -10
  9. data/features/argument_matchers/type_matchers.feature +3 -3
  10. data/features/message_expectations/allow_any_instance_of.feature +1 -1
  11. data/features/message_expectations/any_instance.feature +27 -5
  12. data/features/message_expectations/call_original.feature +2 -2
  13. data/features/message_expectations/expect_message_using_expect.feature +2 -2
  14. data/features/message_expectations/expect_message_using_should_receive.feature +2 -2
  15. data/features/message_expectations/receive_counts.feature +7 -7
  16. data/features/message_expectations/warn_when_expectation_is_set_on_nil.feature +3 -3
  17. data/features/method_stubs/README.md +3 -0
  18. data/features/method_stubs/any_instance.feature +11 -11
  19. data/features/method_stubs/as_null_object.feature +4 -4
  20. data/features/method_stubs/simple_return_value_with_stub.feature +7 -7
  21. data/features/method_stubs/stub_chain.feature +3 -3
  22. data/features/method_stubs/stub_implementation.feature +2 -2
  23. data/features/method_stubs/to_ary.feature +2 -2
  24. data/features/mutating_constants/hiding_defined_constant.feature +2 -2
  25. data/features/mutating_constants/stub_defined_constant.feature +5 -5
  26. data/features/mutating_constants/stub_undefined_constant.feature +6 -6
  27. data/features/outside_rspec/configuration.feature +0 -2
  28. data/features/outside_rspec/standalone.feature +1 -1
  29. data/features/spies/spy_partial_mock_method.feature +2 -2
  30. data/features/spies/spy_pure_mock_method.feature +5 -5
  31. data/features/spies/spy_unstubbed_method.feature +1 -1
  32. data/features/support/env.rb +10 -1
  33. data/features/test_frameworks/test_unit.feature +1 -1
  34. data/features/verifying_doubles/class_doubles.feature +88 -0
  35. data/features/verifying_doubles/dynamic_classes.feature +72 -0
  36. data/features/verifying_doubles/introduction.feature +85 -0
  37. data/features/verifying_doubles/object_doubles.feature +65 -0
  38. data/features/verifying_doubles/partial_doubles.feature +34 -0
  39. data/lib/rspec/mocks.rb +8 -34
  40. data/lib/rspec/mocks/any_instance/chain.rb +4 -34
  41. data/lib/rspec/mocks/any_instance/expectation_chain.rb +14 -4
  42. data/lib/rspec/mocks/any_instance/message_chains.rb +27 -12
  43. data/lib/rspec/mocks/any_instance/recorder.rb +23 -31
  44. data/lib/rspec/mocks/any_instance/stub_chain.rb +9 -4
  45. data/lib/rspec/mocks/argument_list_matcher.rb +8 -1
  46. data/lib/rspec/mocks/argument_matchers.rb +26 -12
  47. data/lib/rspec/mocks/arity_calculator.rb +66 -0
  48. data/lib/rspec/mocks/configuration.rb +42 -14
  49. data/lib/rspec/mocks/error_generator.rb +34 -10
  50. data/lib/rspec/mocks/example_methods.rb +64 -19
  51. data/lib/rspec/mocks/extensions/marshal.rb +0 -15
  52. data/lib/rspec/mocks/framework.rb +4 -4
  53. data/lib/rspec/mocks/instance_method_stasher.rb +80 -62
  54. data/lib/rspec/mocks/matchers/have_received.rb +18 -14
  55. data/lib/rspec/mocks/matchers/receive.rb +29 -7
  56. data/lib/rspec/mocks/matchers/receive_messages.rb +72 -0
  57. data/lib/rspec/mocks/message_expectation.rb +95 -148
  58. data/lib/rspec/mocks/method_double.rb +77 -139
  59. data/lib/rspec/mocks/method_reference.rb +95 -0
  60. data/lib/rspec/mocks/mock.rb +1 -1
  61. data/lib/rspec/mocks/mutate_const.rb +12 -9
  62. data/lib/rspec/mocks/object_reference.rb +90 -0
  63. data/lib/rspec/mocks/order_group.rb +49 -7
  64. data/lib/rspec/mocks/proxy.rb +72 -33
  65. data/lib/rspec/mocks/proxy_for_nil.rb +2 -2
  66. data/lib/rspec/mocks/space.rb +13 -18
  67. data/lib/rspec/mocks/stub_chain.rb +2 -2
  68. data/lib/rspec/mocks/syntax.rb +61 -36
  69. data/lib/rspec/mocks/targets.rb +40 -19
  70. data/lib/rspec/mocks/test_double.rb +12 -56
  71. data/lib/rspec/mocks/verifying_double.rb +77 -0
  72. data/lib/rspec/mocks/verifying_message_expecation.rb +60 -0
  73. data/lib/rspec/mocks/verifying_proxy.rb +151 -0
  74. data/lib/rspec/mocks/version.rb +1 -1
  75. data/spec/rspec/mocks/and_call_original_spec.rb +34 -30
  76. data/spec/rspec/mocks/and_yield_spec.rb +2 -2
  77. data/spec/rspec/mocks/any_instance/message_chains_spec.rb +1 -1
  78. data/spec/rspec/mocks/any_instance_spec.rb +53 -260
  79. data/spec/rspec/mocks/argument_expectation_spec.rb +4 -4
  80. data/spec/rspec/mocks/arity_calculator_spec.rb +95 -0
  81. data/spec/rspec/mocks/array_including_matcher_spec.rb +41 -0
  82. data/spec/rspec/mocks/at_least_spec.rb +4 -32
  83. data/spec/rspec/mocks/block_return_value_spec.rb +4 -135
  84. data/spec/rspec/mocks/combining_implementation_instructions_spec.rb +10 -11
  85. data/spec/rspec/mocks/configuration_spec.rb +79 -0
  86. data/spec/rspec/mocks/double_spec.rb +10 -78
  87. data/spec/rspec/mocks/extensions/marshal_spec.rb +0 -8
  88. data/spec/rspec/mocks/failing_argument_matchers_spec.rb +49 -4
  89. data/spec/rspec/mocks/instance_method_stasher_spec.rb +20 -3
  90. data/spec/rspec/mocks/matchers/have_received_spec.rb +74 -0
  91. data/spec/rspec/mocks/matchers/receive_messages_spec.rb +140 -0
  92. data/spec/rspec/mocks/matchers/receive_spec.rb +82 -42
  93. data/spec/rspec/mocks/methods_spec.rb +1 -1
  94. data/spec/rspec/mocks/{bug_report_830_spec.rb → mock_expectation_error_spec.rb} +4 -3
  95. data/spec/rspec/mocks/mock_ordering_spec.rb +11 -0
  96. data/spec/rspec/mocks/mock_space_spec.rb +10 -1
  97. data/spec/rspec/mocks/mock_spec.rb +26 -82
  98. data/spec/rspec/mocks/multiple_return_value_spec.rb +1 -1
  99. data/spec/rspec/mocks/mutate_const_spec.rb +18 -5
  100. data/spec/rspec/mocks/null_object_mock_spec.rb +6 -4
  101. data/spec/rspec/mocks/options_hash_spec.rb +3 -3
  102. data/spec/rspec/mocks/order_group_spec.rb +27 -0
  103. data/spec/rspec/mocks/partial_mock_spec.rb +101 -1
  104. data/spec/rspec/mocks/passing_argument_matchers_spec.rb +3 -20
  105. data/spec/rspec/mocks/record_messages_spec.rb +4 -4
  106. data/spec/rspec/mocks/serialization_spec.rb +4 -6
  107. data/spec/rspec/mocks/space_spec.rb +3 -3
  108. data/spec/rspec/mocks/stub_chain_spec.rb +0 -12
  109. data/spec/rspec/mocks/stub_spec.rb +23 -44
  110. data/spec/rspec/mocks/test_double_spec.rb +3 -22
  111. data/spec/rspec/mocks/verifying_double_spec.rb +327 -0
  112. data/spec/rspec/mocks/verifying_message_expecation_spec.rb +68 -0
  113. data/spec/rspec/mocks_spec.rb +16 -39
  114. data/spec/spec_helper.rb +29 -18
  115. metadata +131 -86
  116. metadata.gz.sig +1 -0
  117. data/features/message_expectations/expect_any_instance_of.feature +0 -27
  118. data/lib/rspec/mocks/caller_filter.rb +0 -60
  119. data/lib/rspec/mocks/deprecation.rb +0 -26
  120. data/lib/rspec/mocks/extensions/instance_exec.rb +0 -34
  121. data/lib/rspec/mocks/extensions/proc.rb +0 -63
  122. data/lib/spec/mocks.rb +0 -4
  123. data/spec/rspec/mocks/and_return_spec.rb +0 -17
  124. data/spec/rspec/mocks/any_number_of_times_spec.rb +0 -36
  125. data/spec/rspec/mocks/before_all_spec.rb +0 -74
  126. data/spec/rspec/mocks/bug_report_10260_spec.rb +0 -8
  127. data/spec/rspec/mocks/bug_report_10263_spec.rb +0 -27
  128. data/spec/rspec/mocks/bug_report_11545_spec.rb +0 -32
  129. data/spec/rspec/mocks/bug_report_496_spec.rb +0 -17
  130. data/spec/rspec/mocks/bug_report_600_spec.rb +0 -22
  131. data/spec/rspec/mocks/bug_report_7611_spec.rb +0 -16
  132. data/spec/rspec/mocks/bug_report_8165_spec.rb +0 -31
  133. data/spec/rspec/mocks/bug_report_957_spec.rb +0 -22
@@ -21,7 +21,7 @@ Feature: explicit arguments
21
21
 
22
22
  it "works on doubles and expectations" do
23
23
  object = double('foo')
24
- object.should_receive(:bar).with(:foo)
24
+ expect(object).to receive(:bar).with(:foo)
25
25
 
26
26
  object.bar(:foo)
27
27
  end
@@ -43,17 +43,17 @@ Feature: explicit arguments
43
43
  "got this and that"
44
44
  end
45
45
 
46
- object.foo(:this).should eq("got this")
47
- object.foo(:this, :that).should eq("got this and that")
46
+ expect(object.foo(:this)).to eq("got this")
47
+ expect(object.foo(:this, :that)).to eq("got this and that")
48
48
  end
49
49
 
50
50
  it "works on mocks" do
51
51
  object = double('foo')
52
- object.should_receive(:foo).with(:this, :that)
52
+ expect(object).to receive(:foo).with(:this, :that)
53
53
 
54
54
  object.foo(:this, :that)
55
55
  end
56
56
  end
57
57
  """
58
58
  When I run `rspec stub_multiple_explicit_args_spec.rb`
59
- Then the output should contain "2 examples, 0 failures"
59
+ Then the output should contain "2 examples, 0 failures"
@@ -15,8 +15,8 @@ Feature: General matchers
15
15
  "anything"
16
16
  end
17
17
 
18
- object.foo(1).should eq("anything")
19
- object.foo(:that).should eq("anything")
18
+ expect(object.foo(1)).to eq("anything")
19
+ expect(object.foo(:that)).to eq("anything")
20
20
  end
21
21
  end
22
22
  """
@@ -33,9 +33,9 @@ Feature: General matchers
33
33
  "anything"
34
34
  end
35
35
 
36
- object.foo(1).should eq("anything")
37
- object.foo(:that).should eq("anything")
38
- object.foo.should eq("anything")
36
+ expect(object.foo(1)).to eq("anything")
37
+ expect(object.foo(:that)).to eq("anything")
38
+ expect(object.foo).to eq("anything")
39
39
  end
40
40
  end
41
41
  """
@@ -55,8 +55,8 @@ Feature: General matchers
55
55
  "something"
56
56
  end
57
57
 
58
- object.foo(:that).should eq("something")
59
- object.foo.should eq("nothing")
58
+ expect(object.foo(:that)).to eq("something")
59
+ expect(object.foo).to eq("nothing")
60
60
  end
61
61
  end
62
62
  """
@@ -69,17 +69,17 @@ Feature: General matchers
69
69
  describe "stubbed no_args() args spec for expectations" do
70
70
  it "works for no args" do
71
71
  object = Object.new
72
- object.should_receive(:foo).with(no_args)
72
+ expect(object).to receive(:foo).with(no_args)
73
73
 
74
74
  object.foo
75
75
  end
76
76
  it "fails for args" do
77
77
  object = Object.new
78
- object.should_receive(:foo).with(no_args)
78
+ expect(object).to receive(:foo).with(no_args)
79
79
 
80
80
  object.foo(:bar)
81
81
  end
82
82
  end
83
83
  """
84
84
  When I run `rspec stub_no_args_expectations_spec.rb`
85
- Then the output should contain "2 examples, 1 failure"
85
+ Then the output should contain "2 examples, 1 failure"
@@ -17,10 +17,10 @@ Feature: stub with argument constraints
17
17
  "string"
18
18
  end
19
19
 
20
- object.foo("bar").should eq("string")
21
- object.foo(:that).should eq("symbol")
20
+ expect(object.foo("bar")).to eq("string")
21
+ expect(object.foo(:that)).to eq("symbol")
22
22
  end
23
23
  end
24
24
  """
25
25
  When I run `rspec stub_an_instance_of_args_spec.rb`
26
- Then the output should contain "1 example, 0 failures"
26
+ Then the output should contain "1 example, 0 failures"
@@ -7,7 +7,7 @@ Feature: allow a message on any instance of a class
7
7
  Scenario: allowing a message on any instance of a class
8
8
  Given a file named "example_spec.rb" with:
9
9
  """ruby
10
- describe "any_instance.should_receive" do
10
+ describe "any_instance.to receive" do
11
11
  before do
12
12
  allow_any_instance_of(Object).to receive(:foo).and_return(:return_value)
13
13
  end
@@ -1,11 +1,33 @@
1
1
  Feature: expect a message on any instance of a class
2
2
 
3
- Use `any_instance.should_receive` to set an expectation that one (and only
4
- one) instance of a class receives a message before the example is completed.
3
+ Use `expect_any_instance_of(Class).to receive` to set an expectation that one
4
+ (and only one) instance of a class receives a message before the example is
5
+ completed.
5
6
 
6
- The spec will fail if no instance receives a message.
7
+ The example will fail if no instance receives the specified message.
7
8
 
8
9
  Scenario: expect a message on any instance of a class
10
+ Given a file named "example_spec.rb" with:
11
+ """ruby
12
+ describe "expect_any_instance_of" do
13
+ before do
14
+ expect_any_instance_of(Object).to receive(:foo).and_return(:return_value)
15
+ end
16
+
17
+ it "verifies that one instance of the class receives the message" do
18
+ o = Object.new
19
+ expect(o.foo).to eq(:return_value)
20
+ end
21
+
22
+ it "fails unless an instance receives that message" do
23
+ end
24
+ end
25
+ """
26
+ When I run `rspec example_spec.rb`
27
+ Then the output should contain "2 examples, 1 failure"
28
+ And the output should contain "1) expect_any_instance_of fails unless an instance receives that message"
29
+
30
+ Scenario: expect a message on any instance of a class (should syntax)
9
31
  Given a file named "example_spec.rb" with:
10
32
  """ruby
11
33
  describe "any_instance.should_receive" do
@@ -13,9 +35,9 @@ Feature: expect a message on any instance of a class
13
35
  Object.any_instance.should_receive(:foo).and_return(:return_value)
14
36
 
15
37
  o = Object.new
16
- o.foo.should eq(:return_value)
38
+ expect(o.foo).to eq(:return_value)
17
39
  end
18
40
  end
19
41
  """
20
42
  When I run `rspec example_spec.rb`
21
- Then the examples should all pass
43
+ Then the examples should all pass
@@ -14,8 +14,8 @@ Feature: Calling the original method
14
14
 
15
15
  describe "and_call_original" do
16
16
  it "delegates the message to the original implementation" do
17
- Addition.should_receive(:two_plus_two).and_call_original
18
- Addition.two_plus_two.should eq(4)
17
+ expect(Addition).to receive(:two_plus_two).and_call_original
18
+ expect(Addition.two_plus_two).to eq(4)
19
19
  end
20
20
  end
21
21
  """
@@ -75,7 +75,7 @@ Feature: expect message using `expect`
75
75
  it "returns the specified value" do
76
76
  object = double("object")
77
77
  expect(object).to receive(:message) { :return_value }
78
- object.message.should eq(:return_value)
78
+ expect(object.message).to eq(:return_value)
79
79
  end
80
80
  end
81
81
 
@@ -83,7 +83,7 @@ Feature: expect message using `expect`
83
83
  it "returns the specified value" do
84
84
  object = double("object")
85
85
  expect(object).to receive(:message).and_return(:return_value)
86
- object.message.should eq(:return_value)
86
+ expect(object.message).to eq(:return_value)
87
87
  end
88
88
  end
89
89
  end
@@ -84,7 +84,7 @@ Feature: expect message using `should_receive`
84
84
  it "returns the specified value" do
85
85
  object = double("object")
86
86
  object.should_receive(:message) { :return_value }
87
- object.message.should eq(:return_value)
87
+ expect(object.message).to eq(:return_value)
88
88
  end
89
89
  end
90
90
 
@@ -92,7 +92,7 @@ Feature: expect message using `should_receive`
92
92
  it "returns the specified value" do
93
93
  object = double("object")
94
94
  object.should_receive(:message).and_return(:return_value)
95
- object.message.should eq(:return_value)
95
+ expect(object.message).to eq(:return_value)
96
96
  end
97
97
  end
98
98
  end
@@ -18,7 +18,7 @@ Feature: receive counts
18
18
  account = Account.new
19
19
  account.logger = logger
20
20
 
21
- logger.should_receive(:account_opened).once
21
+ expect(logger).to receive(:account_opened).once
22
22
 
23
23
  account.open
24
24
  end
@@ -46,7 +46,7 @@ Feature: receive counts
46
46
  account = Account.new
47
47
  account.logger = logger
48
48
 
49
- logger.should_receive(:account_opened).twice
49
+ expect(logger).to receive(:account_opened).twice
50
50
 
51
51
  account.open
52
52
  account.open
@@ -75,7 +75,7 @@ Feature: receive counts
75
75
  account = Account.new
76
76
  account.logger = logger
77
77
 
78
- logger.should_receive(:account_opened).exactly(3).times
78
+ expect(logger).to receive(:account_opened).exactly(3).times
79
79
 
80
80
  account.open
81
81
  account.open
@@ -105,7 +105,7 @@ Feature: receive counts
105
105
  account = Account.new
106
106
  account.logger = logger
107
107
 
108
- logger.should_receive(:account_opened).at_least(:once)
108
+ expect(logger).to receive(:account_opened).at_least(:once)
109
109
 
110
110
  account.open
111
111
  end
@@ -134,7 +134,7 @@ Feature: receive counts
134
134
  account = Account.new
135
135
  account.logger = logger
136
136
 
137
- logger.should_receive(:account_opened).at_least(3).times
137
+ expect(logger).to receive(:account_opened).at_least(3).times
138
138
 
139
139
  # Note that I am calling method under test 4 times
140
140
  # and I specified it to be called at least 3 times
@@ -167,7 +167,7 @@ Feature: receive counts
167
167
  account = Account.new
168
168
  account.logger = logger
169
169
 
170
- logger.should_receive(:account_opened).at_most(:once)
170
+ expect(logger).to receive(:account_opened).at_most(:once)
171
171
 
172
172
  account.open
173
173
  account.open
@@ -197,7 +197,7 @@ Feature: receive counts
197
197
  account = Account.new
198
198
  account.logger = logger
199
199
 
200
- logger.should_receive(:account_opened).at_most(2).times
200
+ expect(logger).to receive(:account_opened).at_most(2).times
201
201
 
202
202
  account.open
203
203
  account.open
@@ -6,7 +6,7 @@ Feature: warn when expectation is set on nil
6
6
  RSpec.configure {|c| c.mock_with :rspec}
7
7
  describe "something" do
8
8
  it "does something" do
9
- @i_do_not_exist.should_receive(:foo)
9
+ expect(@i_do_not_exist).to receive(:foo)
10
10
  @i_do_not_exist.foo
11
11
  end
12
12
  end
@@ -21,7 +21,7 @@ Feature: warn when expectation is set on nil
21
21
  describe "something" do
22
22
  it "does something" do
23
23
  allow_message_expectations_on_nil
24
- nil.should_receive(:foo)
24
+ expect(nil).to receive(:foo)
25
25
  nil.foo
26
26
  end
27
27
  end
@@ -40,7 +40,7 @@ Feature: warn when expectation is set on nil
40
40
  nil.foo
41
41
  end
42
42
  it "does something (bar)" do
43
- nil.should_receive(:bar)
43
+ expect(nil).to receive(:bar)
44
44
  nil.bar
45
45
  end
46
46
  end
@@ -65,6 +65,9 @@ You can also use the block format:
65
65
  obj.stub(:message).with(anything()) { ... }
66
66
  obj.stub(:message).with(an_instance_of(Money)) { ... }
67
67
  obj.stub(:message).with(hash_including(:a => 'b')) { ... }
68
+ obj.stub(:message).with(array_including(1,2,3)) { ... }
69
+ # or
70
+ obj.stub(:message).with(array_including([1,2,3])) { ... }
68
71
 
69
72
  #### Regular expressions
70
73
 
@@ -18,7 +18,7 @@ Feature: stub on any instance of a class
18
18
  Object.any_instance.stub(:foo).and_return(:return_value)
19
19
 
20
20
  o = Object.new
21
- o.foo.should eq(:return_value)
21
+ expect(o.foo).to eq(:return_value)
22
22
  end
23
23
  end
24
24
  """
@@ -34,8 +34,8 @@ Feature: stub on any instance of a class
34
34
  Object.any_instance.stub(:foo => 'foo', :bar => 'bar')
35
35
 
36
36
  o = Object.new
37
- o.foo.should eq('foo')
38
- o.bar.should eq('bar')
37
+ expect(o.foo).to eq('foo')
38
+ expect(o.bar).to eq('bar')
39
39
  end
40
40
  end
41
41
  end
@@ -53,8 +53,8 @@ Feature: stub on any instance of a class
53
53
  Object.any_instance.stub(:foo).with(:param_three, :param_four).and_return(:result_two)
54
54
 
55
55
  o = Object.new
56
- o.foo(:param_one, :param_two).should eq(:result_one)
57
- o.foo(:param_three, :param_four).should eq(:result_two)
56
+ expect(o.foo(:param_one, :param_two)).to eq(:result_one)
57
+ expect(o.foo(:param_three, :param_four)).to eq(:result_two)
58
58
  end
59
59
  end
60
60
  end
@@ -76,7 +76,7 @@ Feature: stub on any instance of a class
76
76
  Object.any_instance.stub(:foo)
77
77
  Object.any_instance.unstub(:foo)
78
78
 
79
- Object.new.foo.should eq(:foo)
79
+ expect(Object.new.foo).to eq(:foo)
80
80
  end
81
81
  end
82
82
  """
@@ -94,11 +94,11 @@ Feature: stub on any instance of a class
94
94
  :foo
95
95
  end
96
96
  end
97
- Object.any_instance.should_receive(:foo).and_return(:bar)
97
+ expect_any_instance_of(Object).to receive(:foo).and_return(:bar)
98
98
  Object.any_instance.stub(:foo)
99
99
  Object.any_instance.unstub(:foo)
100
100
 
101
- Object.new.foo.should eq(:bar)
101
+ expect(Object.new.foo).to eq(:bar)
102
102
  end
103
103
  end
104
104
  end
@@ -113,21 +113,21 @@ Feature: stub on any instance of a class
113
113
  context "given symbols representing methods" do
114
114
  it "returns the correct value" do
115
115
  Object.any_instance.stub_chain(:one, :two, :three).and_return(:four)
116
- Object.new.one.two.three.should eq(:four)
116
+ expect(Object.new.one.two.three).to eq(:four)
117
117
  end
118
118
  end
119
119
 
120
120
  context "given a hash at the end" do
121
121
  it "returns the correct value" do
122
122
  Object.any_instance.stub_chain(:one, :two, :three => :four)
123
- Object.new.one.two.three.should eq(:four)
123
+ expect(Object.new.one.two.three).to eq(:four)
124
124
  end
125
125
  end
126
126
 
127
127
  context "given a string of methods separated by dots" do
128
128
  it "returns the correct value" do
129
129
  Object.any_instance.stub_chain("one.two.three").and_return(:four)
130
- Object.new.one.two.three.should eq(:four)
130
+ expect(Object.new.one.two.three).to eq(:four)
131
131
  end
132
132
  end
133
133
  end
@@ -13,7 +13,7 @@ Feature: as_null_object
13
13
  let(:null_object) { double('null object').as_null_object }
14
14
 
15
15
  it "responds to any method that is not defined" do
16
- null_object.should respond_to(:an_undefined_method)
16
+ expect(null_object).to respond_to(:an_undefined_method)
17
17
  end
18
18
 
19
19
  it "allows explicit stubs using expect syntax" do
@@ -23,16 +23,16 @@ Feature: as_null_object
23
23
 
24
24
  it "allows explicit stubs using should syntax" do
25
25
  null_object.stub(:foo) { "bar" }
26
- null_object.foo.should eq("bar")
26
+ expect(null_object.foo).to eq("bar")
27
27
  end
28
28
 
29
29
  it "allows explicit expectations" do
30
- null_object.should_receive(:something)
30
+ expect(null_object).to receive(:something)
31
31
  null_object.something
32
32
  end
33
33
 
34
34
  it "supports Array#flatten" do
35
- [null_object].flatten.should eq([null_object])
35
+ expect([null_object].flatten).to eq([null_object])
36
36
  end
37
37
  end
38
38
  """
@@ -12,7 +12,7 @@ Feature: stub with a simple return value
12
12
 
13
13
  it "returns nil" do
14
14
  collaborator.stub(:message)
15
- collaborator.message.should be(nil)
15
+ expect(collaborator.message).to be(nil)
16
16
  end
17
17
  end
18
18
  """
@@ -27,7 +27,7 @@ Feature: stub with a simple return value
27
27
  it "returns the specified value" do
28
28
  collaborator = double("collaborator")
29
29
  collaborator.stub(:message) { :value }
30
- collaborator.message.should eq(:value)
30
+ expect(collaborator.message).to eq(:value)
31
31
  end
32
32
  end
33
33
 
@@ -35,7 +35,7 @@ Feature: stub with a simple return value
35
35
  it "returns the specified value" do
36
36
  collaborator = double("collaborator")
37
37
  collaborator.stub(:message).and_return(:value)
38
- collaborator.message.should eq(:value)
38
+ expect(collaborator.message).to eq(:value)
39
39
  end
40
40
  end
41
41
 
@@ -43,8 +43,8 @@ Feature: stub with a simple return value
43
43
  it "returns the specified value" do
44
44
  collaborator = double("collaborator")
45
45
  collaborator.stub(:message_1 => :value_1, :message_2 => :value_2)
46
- collaborator.message_1.should eq(:value_1)
47
- collaborator.message_2.should eq(:value_2)
46
+ expect(collaborator.message_1).to eq(:value_1)
47
+ expect(collaborator.message_2).to eq(:value_2)
48
48
  end
49
49
  end
50
50
 
@@ -54,8 +54,8 @@ Feature: stub with a simple return value
54
54
  :message_1 => :value_1,
55
55
  :message_2 => :value_2
56
56
  )
57
- collaborator.message_1.should eq(:value_1)
58
- collaborator.message_2.should eq(:value_2)
57
+ expect(collaborator.message_1).to eq(:value_1)
58
+ expect(collaborator.message_2).to eq(:value_2)
59
59
  end
60
60
  end
61
61
  end