rspec-expectations 2.12.1 → 2.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. data/Changelog.md +31 -0
  2. data/README.md +1 -1
  3. data/features/built_in_matchers/be.feature +6 -4
  4. data/features/built_in_matchers/be_within.feature +3 -1
  5. data/features/built_in_matchers/cover.feature +2 -0
  6. data/features/built_in_matchers/end_with.feature +2 -0
  7. data/features/built_in_matchers/equality.feature +9 -15
  8. data/features/built_in_matchers/exist.feature +2 -0
  9. data/features/built_in_matchers/expect_error.feature +14 -8
  10. data/features/built_in_matchers/have.feature +11 -5
  11. data/features/built_in_matchers/include.feature +53 -0
  12. data/features/built_in_matchers/match.feature +2 -0
  13. data/features/built_in_matchers/operators.feature +17 -11
  14. data/features/built_in_matchers/predicates.feature +21 -13
  15. data/features/built_in_matchers/respond_to.feature +7 -1
  16. data/features/built_in_matchers/satisfy.feature +2 -0
  17. data/features/built_in_matchers/start_with.feature +2 -0
  18. data/features/built_in_matchers/throw_symbol.feature +6 -0
  19. data/features/built_in_matchers/types.feature +8 -6
  20. data/lib/rspec/expectations/deprecation.rb +1 -1
  21. data/lib/rspec/expectations/differ.rb +8 -8
  22. data/lib/rspec/expectations/fail_with.rb +17 -3
  23. data/lib/rspec/expectations/syntax.rb +46 -0
  24. data/lib/rspec/expectations/version.rb +1 -1
  25. data/lib/rspec/matchers/built_in/be.rb +7 -3
  26. data/lib/rspec/matchers/built_in/be_within.rb +13 -4
  27. data/lib/rspec/matchers/built_in/change.rb +2 -2
  28. data/lib/rspec/matchers/built_in/equal.rb +5 -1
  29. data/lib/rspec/matchers/built_in/exist.rb +1 -1
  30. data/lib/rspec/matchers/built_in/have.rb +8 -8
  31. data/lib/rspec/matchers/built_in/include.rb +19 -3
  32. data/lib/rspec/matchers/built_in/respond_to.rb +1 -1
  33. data/lib/rspec/matchers/extensions/instance_eval_with_args.rb +1 -1
  34. data/lib/rspec/matchers/matcher.rb +4 -3
  35. data/lib/rspec/matchers/operator_matcher.rb +1 -1
  36. data/lib/rspec/matchers/pretty.rb +5 -1
  37. data/spec/rspec/expectations/differ_spec.rb +8 -15
  38. data/spec/rspec/expectations/expectation_target_spec.rb +18 -8
  39. data/spec/rspec/expectations/extensions/kernel_spec.rb +15 -15
  40. data/spec/rspec/expectations/fail_with_spec.rb +41 -16
  41. data/spec/rspec/expectations/handler_spec.rb +13 -13
  42. data/spec/rspec/expectations/syntax_spec.rb +70 -8
  43. data/spec/rspec/matchers/base_matcher_spec.rb +14 -12
  44. data/spec/rspec/matchers/be_close_spec.rb +1 -1
  45. data/spec/rspec/matchers/be_instance_of_spec.rb +14 -8
  46. data/spec/rspec/matchers/be_kind_of_spec.rb +12 -8
  47. data/spec/rspec/matchers/be_spec.rb +212 -148
  48. data/spec/rspec/matchers/be_within_spec.rb +91 -42
  49. data/spec/rspec/matchers/change_spec.rb +52 -38
  50. data/spec/rspec/matchers/configuration_spec.rb +19 -15
  51. data/spec/rspec/matchers/cover_spec.rb +19 -19
  52. data/spec/rspec/matchers/description_generation_spec.rb +86 -86
  53. data/spec/rspec/matchers/dsl_spec.rb +7 -7
  54. data/spec/rspec/matchers/eq_spec.rb +17 -11
  55. data/spec/rspec/matchers/eql_spec.rb +10 -10
  56. data/spec/rspec/matchers/equal_spec.rb +27 -9
  57. data/spec/rspec/matchers/exist_spec.rb +35 -21
  58. data/spec/rspec/matchers/has_spec.rb +33 -29
  59. data/spec/rspec/matchers/have_spec.rb +165 -151
  60. data/spec/rspec/matchers/include_matcher_integration_spec.rb +30 -0
  61. data/spec/rspec/matchers/include_spec.rb +282 -124
  62. data/spec/rspec/matchers/match_array_spec.rb +90 -49
  63. data/spec/rspec/matchers/match_spec.rb +21 -21
  64. data/spec/rspec/matchers/matcher_spec.rb +85 -48
  65. data/spec/rspec/matchers/matchers_spec.rb +12 -6
  66. data/spec/rspec/matchers/method_missing_spec.rb +5 -1
  67. data/spec/rspec/matchers/operator_matcher_spec.rb +216 -237
  68. data/spec/rspec/matchers/raise_error_spec.rb +132 -132
  69. data/spec/rspec/matchers/respond_to_spec.rb +109 -112
  70. data/spec/rspec/matchers/satisfy_spec.rb +16 -16
  71. data/spec/rspec/matchers/start_with_end_with_spec.rb +36 -32
  72. data/spec/rspec/matchers/throw_symbol_spec.rb +24 -24
  73. data/spec/rspec/matchers/yield_spec.rb +7 -7
  74. data/spec/spec_helper.rb +46 -19
  75. data/spec/support/in_sub_process.rb +27 -20
  76. metadata +81 -83
@@ -2,78 +2,127 @@ require 'spec_helper'
2
2
 
3
3
  module RSpec
4
4
  module Matchers
5
- describe "[actual.should] be_within(delta).of(expected)" do
5
+ describe "expect(actual).to be_within(delta).of(expected)" do
6
6
  it_behaves_like "an RSpec matcher", :valid_value => 5, :invalid_value => -5 do
7
7
  let(:matcher) { be_within(2).of(4.0) }
8
8
  end
9
9
 
10
- it "matches when actual == expected" do
11
- be_within(0.5).of(5.0).matches?(5.0).should be_true
10
+ it "passes when actual == expected" do
11
+ expect(5.0).to be_within(0.5).of(5.0)
12
12
  end
13
13
 
14
- it "matches when actual < (expected + delta)" do
15
- be_within(0.5).of(5.0).matches?(5.49).should be_true
14
+ it "passes when actual < (expected + delta)" do
15
+ expect(5.49).to be_within(0.5).of(5.0)
16
16
  end
17
17
 
18
- it "matches when actual > (expected - delta)" do
19
- be_within(0.5).of(5.0).matches?(4.51).should be_true
18
+ it "passes when actual > (expected - delta)" do
19
+ expect(4.51).to be_within(0.5).of(5.0)
20
20
  end
21
21
 
22
- it "matches when actual == (expected - delta)" do
23
- be_within(0.5).of(5.0).matches?(4.5).should be_true
22
+ it "passes when actual == (expected - delta)" do
23
+ expect(4.5).to be_within(0.5).of(5.0)
24
24
  end
25
25
 
26
- it "does not match when actual < (expected - delta)" do
27
- be_within(0.5).of(5.0).matches?(4.49).should be_false
26
+ it "passes when actual == (expected + delta)" do
27
+ expect(5.5).to be_within(0.5).of(5.0)
28
28
  end
29
29
 
30
- it "matches when actual == (expected + delta)" do
31
- be_within(0.5).of(5.0).matches?(5.5).should be_true
30
+ it "fails when actual < (expected - delta)" do
31
+ expect {
32
+ expect(4.49).to be_within(0.5).of(5.0)
33
+ }.to fail_with("expected 4.49 to be within 0.5 of 5.0")
32
34
  end
33
35
 
34
- it "does not match when actual > (expected + delta)" do
35
- be_within(0.5).of(5.0).matches?(5.51).should be_false
36
- end
37
-
38
- it "provides a failure message for should" do
39
- #given
40
- matcher = be_within(0.5).of(5.0)
41
- #when
42
- matcher.matches?(5.51)
43
- #then
44
- matcher.failure_message_for_should.should == "expected 5.51 to be within 0.5 of 5.0"
45
- end
46
-
47
- it "provides a failure message for should not" do
48
- #given
49
- matcher = be_within(0.5).of(5.0)
50
- #when
51
- matcher.matches?(5.49)
52
- #then
53
- matcher.failure_message_for_should_not.should == "expected 5.49 not to be within 0.5 of 5.0"
36
+ it "fails when actual > (expected + delta)" do
37
+ expect {
38
+ expect(5.51).to be_within(0.5).of(5.0)
39
+ }.to fail_with("expected 5.51 to be within 0.5 of 5.0")
54
40
  end
55
41
 
56
42
  it "works with Time" do
57
- Time.now.should be_within(0.1).of(Time.now)
43
+ expect(Time.now).to be_within(0.1).of(Time.now)
58
44
  end
59
45
 
60
46
  it "provides a description" do
61
47
  matcher = be_within(0.5).of(5.0)
62
48
  matcher.matches?(5.1)
63
- matcher.description.should == "be within 0.5 of 5.0"
49
+ expect(matcher.description).to eq "be within 0.5 of 5.0"
64
50
  end
65
51
 
66
52
  it "raises an error if no expected value is given" do
67
- matcher = be_within(0.5)
68
- expect { matcher.matches?(5.1) }.to raise_error(
69
- ArgumentError, /must set an expected value using #of/
70
- )
53
+ expect {
54
+ expect(5.1).to be_within(0.5)
55
+ }.to raise_error(ArgumentError, /must set an expected value using #of/)
71
56
  end
72
57
 
73
58
  it "raises an error if the actual does not respond to :-" do
74
- expect { be_within(0.1).of(0).matches?(nil) }.to raise_error(
75
- ArgumentError, /The actual value \(nil\) must respond to `-`/
76
- )
59
+ expect {
60
+ expect(nil).to be_within(0.1).of(0)
61
+ }.to raise_error(ArgumentError, /The actual value \(nil\) must respond to `-`/)
62
+ end
63
+ end
64
+
65
+ describe "expect(actual).to be_within(delta).percent_of(expected)" do
66
+ it "passes when actual is within the given percent variance" do
67
+ expect(9.0).to be_within(10).percent_of(10.0)
68
+ expect(10.0).to be_within(10).percent_of(10.0)
69
+ expect(11.0).to be_within(10).percent_of(10.0)
70
+ end
71
+
72
+ it "fails when actual is outside the given percent variance" do
73
+ expect {
74
+ expect(8.9).to be_within(10).percent_of(10.0)
75
+ }.to fail_with("expected 8.9 to be within 10% of 10.0")
76
+
77
+ expect {
78
+ expect(11.1).to be_within(10).percent_of(10.0)
79
+ }.to fail_with("expected 11.1 to be within 10% of 10.0")
80
+ end
81
+
82
+ it "provides a description" do
83
+ matcher = be_within(0.5).percent_of(5.0)
84
+ matcher.matches?(5.1)
85
+ expect(matcher.description).to eq "be within 0.5% of 5.0"
86
+ end
87
+ end
88
+
89
+ describe "expect(actual).not_to be_within(delta).of(expected)" do
90
+ it "passes when actual < (expected - delta)" do
91
+ expect(4.49).not_to be_within(0.5).of(5.0)
92
+ end
93
+
94
+ it "passes when actual > (expected + delta)" do
95
+ expect(5.51).not_to be_within(0.5).of(5.0)
96
+ end
97
+
98
+ it "fails when actual == expected" do
99
+ expect {
100
+ expect(5.0).not_to be_within(0.5).of(5.0)
101
+ }.to fail_with("expected 5.0 not to be within 0.5 of 5.0")
102
+ end
103
+
104
+ it "fails when actual < (expected + delta)" do
105
+ expect {
106
+ expect(5.49).not_to be_within(0.5).of(5.0)
107
+ }.to fail_with("expected 5.49 not to be within 0.5 of 5.0")
108
+ end
109
+
110
+ it "fails when actual > (expected - delta)" do
111
+ expect {
112
+ expect(4.51).not_to be_within(0.5).of(5.0)
113
+ }.to fail_with("expected 4.51 not to be within 0.5 of 5.0")
114
+ end
115
+
116
+ it "fails when actual == (expected - delta)" do
117
+ expect {
118
+ expect(4.5).not_to be_within(0.5).of(5.0)
119
+ }.to fail_with("expected 4.5 not to be within 0.5 of 5.0")
120
+ end
121
+
122
+ it "fails when actual == (expected + delta)" do
123
+ expect {
124
+ expect(5.5).not_to be_within(0.5).of(5.0)
125
+ }.to fail_with("expected 5.5 not to be within 0.5 of 5.0")
77
126
  end
78
127
  end
79
128
  end
@@ -6,7 +6,7 @@ class SomethingExpected
6
6
  attr_accessor :some_value
7
7
  end
8
8
 
9
- describe "should change(actual, message)" do
9
+ describe "expect { ... }.to change(actual, message)" do
10
10
  context "with a numeric value" do
11
11
  before(:each) do
12
12
  @instance = SomethingExpected.new
@@ -22,9 +22,9 @@ describe "should change(actual, message)" do
22
22
  expect {}.to change(@instance, :some_value)
23
23
  end.to fail_with("some_value should have changed, but is still 5")
24
24
  end
25
-
25
+
26
26
  it "provides a #description" do
27
- change(@instance, :some_value).description.should == "change #some_value"
27
+ expect(change(@instance, :some_value).description).to eq "change #some_value"
28
28
  end
29
29
  end
30
30
 
@@ -96,6 +96,20 @@ describe "should change(actual, message)" do
96
96
  end
97
97
  end
98
98
 
99
+ context "with a string" do
100
+ it "passes when actual is modified by the block" do
101
+ string = "ab"
102
+ expect { string << "c" }.to change { string }
103
+ end
104
+
105
+ it 'fails when actual is not modified by the block' do
106
+ string = "ab"
107
+ expect {
108
+ expect { }.to change { string }
109
+ }.to fail_with(/should have changed/)
110
+ end
111
+ end
112
+
99
113
  context "with an arbitrary enumerable" do
100
114
  before(:each) do
101
115
  @instance = SomethingExpected.new
@@ -135,7 +149,7 @@ describe "should change(actual, message)" do
135
149
  end
136
150
  end
137
151
 
138
- describe "should_not change(actual, message)" do
152
+ describe "expect { ... }.not_to change(actual, message)" do
139
153
  before(:each) do
140
154
  @instance = SomethingExpected.new
141
155
  @instance.some_value = 5
@@ -152,7 +166,7 @@ describe "should_not change(actual, message)" do
152
166
  end
153
167
  end
154
168
 
155
- describe "should change { block }" do
169
+ describe "expect { ... }.to change { block }" do
156
170
  o = SomethingExpected.new
157
171
  it_behaves_like "an RSpec matcher", :valid_value => lambda { o.some_value = 5 },
158
172
  :invalid_value => lambda { } do
@@ -173,19 +187,19 @@ describe "should change { block }" do
173
187
  expect {}.to change{ @instance.some_value }
174
188
  end.to fail_with("result should have changed, but is still 5")
175
189
  end
176
-
190
+
177
191
  it "warns if passed a block using do/end instead of {}" do
178
192
  expect do
179
193
  expect {}.to change do; end
180
194
  end.to raise_error(SyntaxError, /block passed to should or should_not/)
181
195
  end
182
-
196
+
183
197
  it "provides a #description" do
184
- change { @instance.some_value }.description.should == "change #result"
198
+ expect(change { @instance.some_value }.description).to eq "change #result"
185
199
  end
186
200
  end
187
201
 
188
- describe "should_not change { block }" do
202
+ describe "expect { ... }.not_to change { block }" do
189
203
  before(:each) do
190
204
  @instance = SomethingExpected.new
191
205
  @instance.some_value = 5
@@ -200,7 +214,7 @@ describe "should_not change { block }" do
200
214
  expect {@instance.some_value = 6}.to_not change { @instance.some_value }
201
215
  end.to fail_with("result should not have changed, but did change from 5 to 6")
202
216
  end
203
-
217
+
204
218
  it "warns if passed a block using do/end instead of {}" do
205
219
  expect do
206
220
  expect {}.to_not change do; end
@@ -208,7 +222,7 @@ describe "should_not change { block }" do
208
222
  end
209
223
  end
210
224
 
211
- describe "should change(actual, message).by(expected)" do
225
+ describe "expect { ... }.to change(actual, message).by(expected)" do
212
226
  before(:each) do
213
227
  @instance = SomethingExpected.new
214
228
  @instance.some_value = 5
@@ -235,7 +249,7 @@ describe "should change(actual, message).by(expected)" do
235
249
  end
236
250
  end
237
251
 
238
- describe "should change{ block }.by(expected)" do
252
+ describe "expect { ... }.to change { block }.by(expected)" do
239
253
  before(:each) do
240
254
  @instance = SomethingExpected.new
241
255
  @instance.some_value = 5
@@ -258,7 +272,7 @@ describe "should change{ block }.by(expected)" do
258
272
  end
259
273
  end
260
274
 
261
- describe "should change(actual, message).by_at_least(expected)" do
275
+ describe "expect { ... }.to change(actual, message).by_at_least(expected)" do
262
276
  before(:each) do
263
277
  @instance = SomethingExpected.new
264
278
  @instance.some_value = 5
@@ -267,10 +281,10 @@ describe "should change(actual, message).by_at_least(expected)" do
267
281
  it "passes when attribute is changed by greater than the expected amount" do
268
282
  expect { @instance.some_value += 2 }.to change(@instance, :some_value).by_at_least(1)
269
283
  end
270
-
284
+
271
285
  it "passes when attribute is changed by the expected amount" do
272
286
  expect { @instance.some_value += 2 }.to change(@instance, :some_value).by_at_least(2)
273
- end
287
+ end
274
288
 
275
289
  it "fails when the attribute is changed by less than the expected amount" do
276
290
  expect do
@@ -280,7 +294,7 @@ describe "should change(actual, message).by_at_least(expected)" do
280
294
 
281
295
  end
282
296
 
283
- describe "should change{ block }.by_at_least(expected)" do
297
+ describe "expect { ... }.to change { block }.by_at_least(expected)" do
284
298
  before(:each) do
285
299
  @instance = SomethingExpected.new
286
300
  @instance.some_value = 5
@@ -289,10 +303,10 @@ describe "should change{ block }.by_at_least(expected)" do
289
303
  it "passes when attribute is changed by greater than expected amount" do
290
304
  expect { @instance.some_value += 2 }.to change{@instance.some_value}.by_at_least(1)
291
305
  end
292
-
306
+
293
307
  it "passes when attribute is changed by the expected amount" do
294
308
  expect { @instance.some_value += 2 }.to change{@instance.some_value}.by_at_least(2)
295
- end
309
+ end
296
310
 
297
311
  it "fails when the attribute is changed by less than the unexpected amount" do
298
312
  expect do
@@ -302,7 +316,7 @@ describe "should change{ block }.by_at_least(expected)" do
302
316
  end
303
317
 
304
318
 
305
- describe "should change(actual, message).by_at_most(expected)" do
319
+ describe "expect { ... }.to change(actual, message).by_at_most(expected)" do
306
320
  before(:each) do
307
321
  @instance = SomethingExpected.new
308
322
  @instance.some_value = 5
@@ -311,10 +325,10 @@ describe "should change(actual, message).by_at_most(expected)" do
311
325
  it "passes when attribute is changed by less than the expected amount" do
312
326
  expect { @instance.some_value += 2 }.to change(@instance, :some_value).by_at_most(3)
313
327
  end
314
-
328
+
315
329
  it "passes when attribute is changed by the expected amount" do
316
330
  expect { @instance.some_value += 2 }.to change(@instance, :some_value).by_at_most(2)
317
- end
331
+ end
318
332
 
319
333
  it "fails when the attribute is changed by greater than the expected amount" do
320
334
  expect do
@@ -324,7 +338,7 @@ describe "should change(actual, message).by_at_most(expected)" do
324
338
 
325
339
  end
326
340
 
327
- describe "should change{ block }.by_at_most(expected)" do
341
+ describe "expect { ... }.to change { block }.by_at_most(expected)" do
328
342
  before(:each) do
329
343
  @instance = SomethingExpected.new
330
344
  @instance.some_value = 5
@@ -333,10 +347,10 @@ describe "should change{ block }.by_at_most(expected)" do
333
347
  it "passes when attribute is changed by less than expected amount" do
334
348
  expect { @instance.some_value += 2 }.to change{@instance.some_value}.by_at_most(3)
335
349
  end
336
-
350
+
337
351
  it "passes when attribute is changed by the expected amount" do
338
352
  expect { @instance.some_value += 2 }.to change{@instance.some_value}.by_at_most(2)
339
- end
353
+ end
340
354
 
341
355
  it "fails when the attribute is changed by greater than the unexpected amount" do
342
356
  expect do
@@ -345,7 +359,7 @@ describe "should change{ block }.by_at_most(expected)" do
345
359
  end
346
360
  end
347
361
 
348
- describe "should change(actual, message).from(old)" do
362
+ describe "expect { ... }.to change(actual, message).from(old)" do
349
363
  context "with boolean values" do
350
364
  before(:each) do
351
365
  @instance = SomethingExpected.new
@@ -386,7 +400,7 @@ describe "should change(actual, message).from(old)" do
386
400
  end
387
401
  end
388
402
 
389
- describe "should change{ block }.from(old)" do
403
+ describe "expect { ... }.to change { block }.from(old)" do
390
404
  before(:each) do
391
405
  @instance = SomethingExpected.new
392
406
  @instance.some_value = 'string'
@@ -409,13 +423,13 @@ describe "should change{ block }.from(old)" do
409
423
  end
410
424
  end
411
425
 
412
- describe "should change(actual, message).to(new)" do
426
+ describe "expect { ... }.to change(actual, message).to(new)" do
413
427
  context "with boolean values" do
414
428
  before(:each) do
415
429
  @instance = SomethingExpected.new
416
430
  @instance.some_value = true
417
431
  end
418
-
432
+
419
433
  it "passes when attribute is == to expected value after executing block" do
420
434
  expect { @instance.some_value = false }.to change(@instance, :some_value).to(false)
421
435
  end
@@ -431,7 +445,7 @@ describe "should change(actual, message).to(new)" do
431
445
  @instance = SomethingExpected.new
432
446
  @instance.some_value = 'string'
433
447
  end
434
-
448
+
435
449
  it "passes when attribute is === to expected value after executing block" do
436
450
  expect { @instance.some_value = "cat" }.to change(@instance, :some_value).to("cat")
437
451
  end
@@ -450,12 +464,12 @@ describe "should change(actual, message).to(new)" do
450
464
  end
451
465
  end
452
466
 
453
- describe "should change{ block }.to(new)" do
467
+ describe "expect { ... }.to change { block }.to(new)" do
454
468
  before(:each) do
455
469
  @instance = SomethingExpected.new
456
470
  @instance.some_value = 'string'
457
471
  end
458
-
472
+
459
473
  it "passes when attribute is === to expected value after executing block" do
460
474
  expect { @instance.some_value = "cat" }.to change{@instance.some_value}.to("cat")
461
475
  end
@@ -473,12 +487,12 @@ describe "should change{ block }.to(new)" do
473
487
  end
474
488
  end
475
489
 
476
- describe "should change(actual, message).from(old).to(new)" do
490
+ describe "expect { ... }.to change(actual, message).from(old).to(new)" do
477
491
  before(:each) do
478
492
  @instance = SomethingExpected.new
479
493
  @instance.some_value = 'string'
480
494
  end
481
-
495
+
482
496
  it "passes when #to comes before #from" do
483
497
  expect { @instance.some_value = "cat" }.to change(@instance, :some_value).to("cat").from("string")
484
498
  end
@@ -486,13 +500,13 @@ describe "should change(actual, message).from(old).to(new)" do
486
500
  it "passes when #from comes before #to" do
487
501
  expect { @instance.some_value = "cat" }.to change(@instance, :some_value).from("string").to("cat")
488
502
  end
489
-
503
+
490
504
  it "shows the correct messaging when #after and #to are different" do
491
505
  expect do
492
506
  expect { @instance.some_value = "cat" }.to change(@instance, :some_value).from("string").to("dog")
493
507
  end.to fail_with("some_value should have been changed to \"dog\", but is now \"cat\"")
494
508
  end
495
-
509
+
496
510
  it "shows the correct messaging when #before and #from are different" do
497
511
  expect do
498
512
  expect { @instance.some_value = "cat" }.to change(@instance, :some_value).from("not_string").to("cat")
@@ -500,12 +514,12 @@ describe "should change(actual, message).from(old).to(new)" do
500
514
  end
501
515
  end
502
516
 
503
- describe "should change{ block }.from(old).to(new)" do
517
+ describe "expect { ... }.to change { block }.from(old).to(new)" do
504
518
  before(:each) do
505
519
  @instance = SomethingExpected.new
506
520
  @instance.some_value = 'string'
507
521
  end
508
-
522
+
509
523
  it "passes when #to comes before #from" do
510
524
  expect { @instance.some_value = "cat" }.to change{@instance.some_value}.to("cat").from("string")
511
525
  end
@@ -520,7 +534,7 @@ describe RSpec::Matchers::BuiltIn::Change do
520
534
  @instance = SomethingExpected.new
521
535
  @instance.some_value = "string"
522
536
  def @instance.send(*args); raise "DOH! Library developers shouldn't use #send!" end
523
-
537
+
524
538
  expect {
525
539
  expect { @instance.some_value = "cat" }.to change(@instance, :some_value)
526
540
  }.to_not raise_error