rspec-expectations 2.12.1 → 2.13.0
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 +31 -0
- data/README.md +1 -1
- data/features/built_in_matchers/be.feature +6 -4
- data/features/built_in_matchers/be_within.feature +3 -1
- data/features/built_in_matchers/cover.feature +2 -0
- data/features/built_in_matchers/end_with.feature +2 -0
- data/features/built_in_matchers/equality.feature +9 -15
- data/features/built_in_matchers/exist.feature +2 -0
- data/features/built_in_matchers/expect_error.feature +14 -8
- data/features/built_in_matchers/have.feature +11 -5
- data/features/built_in_matchers/include.feature +53 -0
- data/features/built_in_matchers/match.feature +2 -0
- data/features/built_in_matchers/operators.feature +17 -11
- data/features/built_in_matchers/predicates.feature +21 -13
- data/features/built_in_matchers/respond_to.feature +7 -1
- data/features/built_in_matchers/satisfy.feature +2 -0
- data/features/built_in_matchers/start_with.feature +2 -0
- data/features/built_in_matchers/throw_symbol.feature +6 -0
- data/features/built_in_matchers/types.feature +8 -6
- data/lib/rspec/expectations/deprecation.rb +1 -1
- data/lib/rspec/expectations/differ.rb +8 -8
- data/lib/rspec/expectations/fail_with.rb +17 -3
- data/lib/rspec/expectations/syntax.rb +46 -0
- data/lib/rspec/expectations/version.rb +1 -1
- data/lib/rspec/matchers/built_in/be.rb +7 -3
- data/lib/rspec/matchers/built_in/be_within.rb +13 -4
- data/lib/rspec/matchers/built_in/change.rb +2 -2
- data/lib/rspec/matchers/built_in/equal.rb +5 -1
- data/lib/rspec/matchers/built_in/exist.rb +1 -1
- data/lib/rspec/matchers/built_in/have.rb +8 -8
- data/lib/rspec/matchers/built_in/include.rb +19 -3
- data/lib/rspec/matchers/built_in/respond_to.rb +1 -1
- data/lib/rspec/matchers/extensions/instance_eval_with_args.rb +1 -1
- data/lib/rspec/matchers/matcher.rb +4 -3
- data/lib/rspec/matchers/operator_matcher.rb +1 -1
- data/lib/rspec/matchers/pretty.rb +5 -1
- data/spec/rspec/expectations/differ_spec.rb +8 -15
- data/spec/rspec/expectations/expectation_target_spec.rb +18 -8
- data/spec/rspec/expectations/extensions/kernel_spec.rb +15 -15
- data/spec/rspec/expectations/fail_with_spec.rb +41 -16
- data/spec/rspec/expectations/handler_spec.rb +13 -13
- data/spec/rspec/expectations/syntax_spec.rb +70 -8
- data/spec/rspec/matchers/base_matcher_spec.rb +14 -12
- data/spec/rspec/matchers/be_close_spec.rb +1 -1
- data/spec/rspec/matchers/be_instance_of_spec.rb +14 -8
- data/spec/rspec/matchers/be_kind_of_spec.rb +12 -8
- data/spec/rspec/matchers/be_spec.rb +212 -148
- data/spec/rspec/matchers/be_within_spec.rb +91 -42
- data/spec/rspec/matchers/change_spec.rb +52 -38
- data/spec/rspec/matchers/configuration_spec.rb +19 -15
- data/spec/rspec/matchers/cover_spec.rb +19 -19
- data/spec/rspec/matchers/description_generation_spec.rb +86 -86
- data/spec/rspec/matchers/dsl_spec.rb +7 -7
- data/spec/rspec/matchers/eq_spec.rb +17 -11
- data/spec/rspec/matchers/eql_spec.rb +10 -10
- data/spec/rspec/matchers/equal_spec.rb +27 -9
- data/spec/rspec/matchers/exist_spec.rb +35 -21
- data/spec/rspec/matchers/has_spec.rb +33 -29
- data/spec/rspec/matchers/have_spec.rb +165 -151
- data/spec/rspec/matchers/include_matcher_integration_spec.rb +30 -0
- data/spec/rspec/matchers/include_spec.rb +282 -124
- data/spec/rspec/matchers/match_array_spec.rb +90 -49
- data/spec/rspec/matchers/match_spec.rb +21 -21
- data/spec/rspec/matchers/matcher_spec.rb +85 -48
- data/spec/rspec/matchers/matchers_spec.rb +12 -6
- data/spec/rspec/matchers/method_missing_spec.rb +5 -1
- data/spec/rspec/matchers/operator_matcher_spec.rb +216 -237
- data/spec/rspec/matchers/raise_error_spec.rb +132 -132
- data/spec/rspec/matchers/respond_to_spec.rb +109 -112
- data/spec/rspec/matchers/satisfy_spec.rb +16 -16
- data/spec/rspec/matchers/start_with_end_with_spec.rb +36 -32
- data/spec/rspec/matchers/throw_symbol_spec.rb +24 -24
- data/spec/rspec/matchers/yield_spec.rb +7 -7
- data/spec/spec_helper.rb +46 -19
- data/spec/support/in_sub_process.rb +27 -20
- metadata +81 -83
@@ -8,15 +8,15 @@ module RSpec
|
|
8
8
|
end
|
9
9
|
|
10
10
|
it "is diffable" do
|
11
|
-
eq(1).
|
11
|
+
expect(eq(1)).to be_diffable
|
12
12
|
end
|
13
13
|
|
14
14
|
it "matches when actual == expected" do
|
15
|
-
1.
|
15
|
+
expect(1).to eq(1)
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
it "does not match when actual != expected" do
|
19
|
-
1.
|
19
|
+
expect(1).not_to eq(2)
|
20
20
|
end
|
21
21
|
|
22
22
|
it "compares by sending == to actual (not expected)" do
|
@@ -27,26 +27,32 @@ module RSpec
|
|
27
27
|
end
|
28
28
|
end.new
|
29
29
|
|
30
|
-
actual.
|
31
|
-
called.
|
30
|
+
expect(actual).to eq :anything # to trigger the matches? method
|
31
|
+
expect(called).to be_true
|
32
32
|
end
|
33
33
|
|
34
34
|
it "describes itself" do
|
35
35
|
matcher = eq(1)
|
36
36
|
matcher.matches?(1)
|
37
|
-
matcher.description.
|
37
|
+
expect(matcher.description).to eq "eq 1"
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
it "provides message, expected and actual on #failure_message" do
|
41
41
|
matcher = eq("1")
|
42
42
|
matcher.matches?(1)
|
43
|
-
matcher.failure_message_for_should.
|
43
|
+
expect(matcher.failure_message_for_should).to eq "\nexpected: \"1\"\n got: 1\n\n(compared using ==)\n"
|
44
44
|
end
|
45
|
-
|
45
|
+
|
46
46
|
it "provides message, expected and actual on #negative_failure_message" do
|
47
47
|
matcher = eq(1)
|
48
48
|
matcher.matches?(1)
|
49
|
-
matcher.failure_message_for_should_not.
|
49
|
+
expect(matcher.failure_message_for_should_not).to eq "\nexpected: value != 1\n got: 1\n\n(compared using ==)\n"
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'fails properly when the actual is an array of multiline strings' do
|
53
|
+
expect {
|
54
|
+
expect(["a\nb", "c\nd"]).to eq([])
|
55
|
+
}.to fail_matching("expected: []")
|
50
56
|
end
|
51
57
|
end
|
52
58
|
end
|
@@ -8,33 +8,33 @@ module RSpec
|
|
8
8
|
end
|
9
9
|
|
10
10
|
it "is diffable" do
|
11
|
-
eql(1).
|
11
|
+
expect(eql(1)).to be_diffable
|
12
12
|
end
|
13
13
|
|
14
14
|
it "matches when actual.eql?(expected)" do
|
15
|
-
1.
|
15
|
+
expect(1).to eql(1)
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
it "does not match when !actual.eql?(expected)" do
|
19
|
-
1.
|
19
|
+
expect(1).not_to eql(2)
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
it "describes itself" do
|
23
23
|
matcher = eql(1)
|
24
24
|
matcher.matches?(1)
|
25
|
-
matcher.description.
|
25
|
+
expect(matcher.description).to eq "eql 1"
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
it "provides message, expected and actual on #failure_message" do
|
29
29
|
matcher = eql("1")
|
30
30
|
matcher.matches?(1)
|
31
|
-
matcher.failure_message_for_should.
|
31
|
+
expect(matcher.failure_message_for_should).to eq "\nexpected: \"1\"\n got: 1\n\n(compared using eql?)\n"
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
it "provides message, expected and actual on #negative_failure_message" do
|
35
35
|
matcher = eql(1)
|
36
36
|
matcher.matches?(1)
|
37
|
-
matcher.failure_message_for_should_not.
|
37
|
+
expect(matcher.failure_message_for_should_not).to eq "\nexpected: value != 1\n got: 1\n\n(compared using eql?)\n"
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
@@ -11,42 +11,60 @@ module RSpec
|
|
11
11
|
end
|
12
12
|
|
13
13
|
it "matches when actual.equal?(expected)" do
|
14
|
-
1.
|
14
|
+
expect(1).to equal(1)
|
15
15
|
end
|
16
16
|
|
17
17
|
it "does not match when !actual.equal?(expected)" do
|
18
|
-
"1".
|
18
|
+
expect("1").not_to equal("1")
|
19
19
|
end
|
20
20
|
|
21
21
|
it "describes itself" do
|
22
22
|
matcher = equal(1)
|
23
23
|
matcher.matches?(1)
|
24
|
-
matcher.description.
|
24
|
+
expect(matcher.description).to eq "equal 1"
|
25
25
|
end
|
26
26
|
|
27
|
-
it "
|
27
|
+
it "suggests the `eq` matcher on failure" do
|
28
28
|
expected, actual = "1", "1"
|
29
|
-
|
30
|
-
|
29
|
+
expect {
|
30
|
+
expect(actual).to equal(expected)
|
31
|
+
}.to fail_with <<-MESSAGE
|
32
|
+
|
33
|
+
expected #{inspect_object(expected)}
|
34
|
+
got #{inspect_object(actual)}
|
35
|
+
|
36
|
+
Compared using equal?, which compares object identity,
|
37
|
+
but expected and actual are not the same object. Use
|
38
|
+
`expect(actual).to eq(expected)` if you don't care about
|
39
|
+
object identity in this example.
|
40
|
+
|
41
|
+
MESSAGE
|
42
|
+
end
|
31
43
|
|
32
|
-
|
44
|
+
context "when using only `should`", :uses_only_should do
|
45
|
+
it "suggests the `eq` matcher on failure" do
|
46
|
+
expected, actual = "1", "1"
|
47
|
+
lambda {
|
48
|
+
actual.should equal(expected)
|
49
|
+
}.should fail_with <<-MESSAGE
|
33
50
|
|
34
51
|
expected #{inspect_object(expected)}
|
35
52
|
got #{inspect_object(actual)}
|
36
53
|
|
37
54
|
Compared using equal?, which compares object identity,
|
38
55
|
but expected and actual are not the same object. Use
|
39
|
-
|
56
|
+
`actual.should eq(expected)` if you don't care about
|
40
57
|
object identity in this example.
|
41
58
|
|
42
59
|
MESSAGE
|
60
|
+
end
|
43
61
|
end
|
44
62
|
|
45
63
|
it "provides message on #negative_failure_message" do
|
46
64
|
expected = actual = "1"
|
47
65
|
matcher = equal(expected)
|
48
66
|
matcher.matches?(actual)
|
49
|
-
matcher.failure_message_for_should_not.
|
67
|
+
expect(matcher.failure_message_for_should_not).to eq <<-MESSAGE
|
50
68
|
|
51
69
|
expected not #{inspect_object(expected)}
|
52
70
|
got #{inspect_object(actual)}
|
@@ -10,11 +10,11 @@ describe "exist matcher" do
|
|
10
10
|
context "when the object does not respond to #exist? or #exists?" do
|
11
11
|
subject { mock }
|
12
12
|
|
13
|
-
[:
|
14
|
-
describe "
|
13
|
+
[:to, :not_to].each do |expect_method|
|
14
|
+
describe "expect(...).#{expect_method} exist" do
|
15
15
|
it "raises an error" do
|
16
16
|
expect {
|
17
|
-
subject.send(
|
17
|
+
expect(subject).send(expect_method, exist)
|
18
18
|
}.to raise_error(NoMethodError)
|
19
19
|
end
|
20
20
|
end
|
@@ -23,26 +23,40 @@ describe "exist matcher" do
|
|
23
23
|
|
24
24
|
[:exist?, :exists?].each do |predicate|
|
25
25
|
context "when the object responds to ##{predicate}" do
|
26
|
-
describe "
|
26
|
+
describe "expect(...).to exist" do
|
27
27
|
it "passes if #{predicate}" do
|
28
|
-
mock(predicate => true).
|
28
|
+
expect(mock(predicate => true)).to exist
|
29
29
|
end
|
30
30
|
|
31
31
|
it "fails if not #{predicate}" do
|
32
32
|
expect {
|
33
|
-
mock(predicate => false).
|
33
|
+
expect(mock(predicate => false)).to exist
|
34
34
|
}.to fail_with(/expected .* to exist/)
|
35
35
|
end
|
36
|
+
|
37
|
+
it 'works when the object overrides `send`' do
|
38
|
+
klass = Struct.new(:message) do
|
39
|
+
def send
|
40
|
+
:message_sent
|
41
|
+
end
|
42
|
+
|
43
|
+
define_method predicate do
|
44
|
+
true
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
expect(klass.new("msg")).to exist
|
49
|
+
end
|
36
50
|
end
|
37
51
|
|
38
|
-
describe "
|
52
|
+
describe "expect(...).not_to exist" do
|
39
53
|
it "passes if not #{predicate}" do
|
40
|
-
mock(predicate => false).
|
54
|
+
expect(mock(predicate => false)).not_to exist
|
41
55
|
end
|
42
56
|
|
43
57
|
it "fails if #{predicate}" do
|
44
58
|
expect {
|
45
|
-
mock(predicate => true).
|
59
|
+
expect(mock(predicate => true)).not_to exist
|
46
60
|
}.to fail_with(/expected .* not to exist/)
|
47
61
|
end
|
48
62
|
end
|
@@ -53,16 +67,16 @@ describe "exist matcher" do
|
|
53
67
|
context "when they both return falsey values" do
|
54
68
|
subject { mock(:exist? => false, :exists? => nil) }
|
55
69
|
|
56
|
-
describe "
|
70
|
+
describe "expect(...).not_to exist" do
|
57
71
|
it "passes" do
|
58
|
-
subject.
|
72
|
+
expect(subject).not_to exist
|
59
73
|
end
|
60
74
|
end
|
61
75
|
|
62
|
-
describe "
|
76
|
+
describe "expect(...).to exist" do
|
63
77
|
it "fails" do
|
64
78
|
expect {
|
65
|
-
subject.
|
79
|
+
expect(subject).to exist
|
66
80
|
}.to fail_with(/expected .* to exist/)
|
67
81
|
end
|
68
82
|
end
|
@@ -71,17 +85,17 @@ describe "exist matcher" do
|
|
71
85
|
context "when they both return truthy values" do
|
72
86
|
subject { mock(:exist? => true, :exists? => "something true") }
|
73
87
|
|
74
|
-
describe "
|
88
|
+
describe "expect(...).not_to exist" do
|
75
89
|
it "fails" do
|
76
90
|
expect {
|
77
|
-
subject.
|
91
|
+
expect(subject).not_to exist
|
78
92
|
}.to fail_with(/expected .* not to exist/)
|
79
93
|
end
|
80
94
|
end
|
81
95
|
|
82
|
-
describe "
|
96
|
+
describe "expect(...).to exist" do
|
83
97
|
it "passes" do
|
84
|
-
subject.
|
98
|
+
expect(subject).to exist
|
85
99
|
end
|
86
100
|
end
|
87
101
|
end
|
@@ -89,11 +103,11 @@ describe "exist matcher" do
|
|
89
103
|
context "when they return values with different truthiness" do
|
90
104
|
subject { mock(:exist? => true, :exists? => false) }
|
91
105
|
|
92
|
-
[:
|
93
|
-
describe "
|
106
|
+
[:to, :not_to].each do |expect_method|
|
107
|
+
describe "expect(...).#{expect_method} exist" do
|
94
108
|
it "raises an error" do
|
95
109
|
expect {
|
96
|
-
subject.send(
|
110
|
+
expect(subject).send(expect_method, exist)
|
97
111
|
}.to raise_error(/#exist\? and #exists\? returned different values/)
|
98
112
|
end
|
99
113
|
end
|
@@ -105,6 +119,6 @@ describe "exist matcher" do
|
|
105
119
|
object = mock
|
106
120
|
object.should_receive(:exist?).with(:foo, :bar) { true }
|
107
121
|
|
108
|
-
object.
|
122
|
+
expect(object).to exist(:foo, :bar)
|
109
123
|
end
|
110
124
|
end
|
@@ -1,26 +1,26 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe "
|
3
|
+
describe "expect(...).to have_sym(*args)" do
|
4
4
|
it_behaves_like "an RSpec matcher", :valid_value => { :a => 1 },
|
5
5
|
:invalid_value => {} do
|
6
6
|
let(:matcher) { have_key(:a) }
|
7
7
|
end
|
8
8
|
|
9
9
|
it "passes if #has_sym?(*args) returns true" do
|
10
|
-
{:a => "A"}.
|
10
|
+
expect({:a => "A"}).to have_key(:a)
|
11
11
|
end
|
12
12
|
|
13
13
|
it "fails if #has_sym?(*args) returns false" do
|
14
|
-
|
15
|
-
{:b => "B"}.
|
16
|
-
}.
|
14
|
+
expect {
|
15
|
+
expect({:b => "B"}).to have_key(:a)
|
16
|
+
}.to fail_with("expected #has_key?(:a) to return true, got false")
|
17
17
|
end
|
18
18
|
|
19
19
|
it 'does not include any args in the failure message if no args were given to the matcher' do
|
20
20
|
o = Object.new
|
21
21
|
def o.has_some_stuff?; false; end
|
22
22
|
expect {
|
23
|
-
o.
|
23
|
+
expect(o).to have_some_stuff
|
24
24
|
}.to fail_with("expected #has_some_stuff? to return true, got false")
|
25
25
|
end
|
26
26
|
|
@@ -28,7 +28,7 @@ describe "should have_sym(*args)" do
|
|
28
28
|
o = Object.new
|
29
29
|
def o.has_some_stuff?(*_); false; end
|
30
30
|
expect {
|
31
|
-
o.
|
31
|
+
expect(o).to have_some_stuff(:a, 7, "foo")
|
32
32
|
}.to fail_with('expected #has_some_stuff?(:a, 7, "foo") to return true, got false')
|
33
33
|
end
|
34
34
|
|
@@ -37,15 +37,15 @@ describe "should have_sym(*args)" do
|
|
37
37
|
def has_foo?
|
38
38
|
end
|
39
39
|
end
|
40
|
-
|
41
|
-
klass.new.
|
42
|
-
}.
|
40
|
+
expect {
|
41
|
+
expect(klass.new).to have_foo
|
42
|
+
}.to fail_with(/expected #has_foo.* to return true, got false/)
|
43
43
|
end
|
44
44
|
|
45
45
|
it "fails if target does not respond to #has_sym?" do
|
46
|
-
|
47
|
-
Object.new.
|
48
|
-
}.
|
46
|
+
expect {
|
47
|
+
expect(Object.new).to have_key(:a)
|
48
|
+
}.to raise_error(NoMethodError)
|
49
49
|
end
|
50
50
|
|
51
51
|
it "reraises an exception thrown in #has_sym?(*args)" do
|
@@ -53,13 +53,15 @@ describe "should have_sym(*args)" do
|
|
53
53
|
def o.has_sym?(*args)
|
54
54
|
raise "Funky exception"
|
55
55
|
end
|
56
|
-
|
56
|
+
expect {
|
57
|
+
expect(o).to have_sym(:foo)
|
58
|
+
}.to raise_error("Funky exception")
|
57
59
|
end
|
58
60
|
end
|
59
61
|
|
60
|
-
describe "
|
62
|
+
describe "expect(...).not_to have_sym(*args)" do
|
61
63
|
it "passes if #has_sym?(*args) returns false" do
|
62
|
-
{:a => "A"}.
|
64
|
+
expect({:a => "A"}).not_to have_key(:b)
|
63
65
|
end
|
64
66
|
|
65
67
|
it "passes if #has_sym?(*args) returns nil" do
|
@@ -67,19 +69,19 @@ describe "should_not have_sym(*args)" do
|
|
67
69
|
def has_foo?
|
68
70
|
end
|
69
71
|
end
|
70
|
-
klass.new.
|
72
|
+
expect(klass.new).not_to have_foo
|
71
73
|
end
|
72
74
|
|
73
75
|
it "fails if #has_sym?(*args) returns true" do
|
74
|
-
|
75
|
-
{:a => "A"}.
|
76
|
-
}.
|
76
|
+
expect {
|
77
|
+
expect({:a => "A"}).not_to have_key(:a)
|
78
|
+
}.to fail_with("expected #has_key?(:a) to return false, got true")
|
77
79
|
end
|
78
80
|
|
79
81
|
it "fails if target does not respond to #has_sym?" do
|
80
|
-
|
81
|
-
Object.new.
|
82
|
-
}.
|
82
|
+
expect {
|
83
|
+
expect(Object.new).to have_key(:a)
|
84
|
+
}.to raise_error(NoMethodError)
|
83
85
|
end
|
84
86
|
|
85
87
|
it "reraises an exception thrown in #has_sym?(*args)" do
|
@@ -87,14 +89,16 @@ describe "should_not have_sym(*args)" do
|
|
87
89
|
def o.has_sym?(*args)
|
88
90
|
raise "Funky exception"
|
89
91
|
end
|
90
|
-
|
92
|
+
expect {
|
93
|
+
expect(o).not_to have_sym(:foo)
|
94
|
+
}.to raise_error("Funky exception")
|
91
95
|
end
|
92
96
|
|
93
97
|
it 'does not include any args in the failure message if no args were given to the matcher' do
|
94
98
|
o = Object.new
|
95
99
|
def o.has_some_stuff?; true; end
|
96
100
|
expect {
|
97
|
-
o.
|
101
|
+
expect(o).not_to have_some_stuff
|
98
102
|
}.to fail_with("expected #has_some_stuff? to return false, got true")
|
99
103
|
end
|
100
104
|
|
@@ -102,7 +106,7 @@ describe "should_not have_sym(*args)" do
|
|
102
106
|
o = Object.new
|
103
107
|
def o.has_some_stuff?(*_); true; end
|
104
108
|
expect {
|
105
|
-
o.
|
109
|
+
expect(o).not_to have_some_stuff(:a, 7, "foo")
|
106
110
|
}.to fail_with('expected #has_some_stuff?(:a, 7, "foo") to return false, got true')
|
107
111
|
end
|
108
112
|
end
|
@@ -111,8 +115,8 @@ describe "has" do
|
|
111
115
|
it "works when the target implements #send" do
|
112
116
|
o = {:a => "A"}
|
113
117
|
def o.send(*args); raise "DOH! Library developers shouldn't use #send!" end
|
114
|
-
|
115
|
-
o.
|
116
|
-
}.
|
118
|
+
expect {
|
119
|
+
expect(o).to have_key(:a)
|
120
|
+
}.to_not raise_error
|
117
121
|
end
|
118
122
|
end
|
@@ -22,64 +22,64 @@ describe "have matcher" do
|
|
22
22
|
owner
|
23
23
|
end
|
24
24
|
|
25
|
-
describe "
|
25
|
+
describe "expect(...).to have(n).items" do
|
26
26
|
it_behaves_like "an RSpec matcher", :valid_value => [1, 2], :invalid_value => [1] do
|
27
27
|
let(:matcher) { have(2).items }
|
28
28
|
end
|
29
29
|
|
30
30
|
it "passes if target has a collection of items with n members" do
|
31
31
|
owner = create_collection_owner_with(3)
|
32
|
-
owner.
|
33
|
-
owner.
|
34
|
-
owner.
|
32
|
+
expect(owner).to have(3).items_in_collection_with_length_method
|
33
|
+
expect(owner).to have(3).items_in_collection_with_size_method
|
34
|
+
expect(owner).to have(3).items_in_collection_with_count_method
|
35
35
|
end
|
36
36
|
|
37
37
|
it "converts :no to 0" do
|
38
38
|
owner = create_collection_owner_with(0)
|
39
|
-
owner.
|
40
|
-
owner.
|
41
|
-
owner.
|
39
|
+
expect(owner).to have(:no).items_in_collection_with_length_method
|
40
|
+
expect(owner).to have(:no).items_in_collection_with_size_method
|
41
|
+
expect(owner).to have(:no).items_in_collection_with_count_method
|
42
42
|
end
|
43
43
|
|
44
44
|
it "converts a String argument to Integer" do
|
45
45
|
owner = create_collection_owner_with(3)
|
46
|
-
owner.
|
47
|
-
owner.
|
48
|
-
owner.
|
46
|
+
expect(owner).to have('3').items_in_collection_with_length_method
|
47
|
+
expect(owner).to have('3').items_in_collection_with_size_method
|
48
|
+
expect(owner).to have('3').items_in_collection_with_count_method
|
49
49
|
end
|
50
50
|
|
51
51
|
it "fails if target has a collection of items with < n members" do
|
52
52
|
owner = create_collection_owner_with(3)
|
53
|
-
|
54
|
-
owner.
|
55
|
-
}.
|
56
|
-
|
57
|
-
owner.
|
58
|
-
}.
|
59
|
-
|
60
|
-
owner.
|
61
|
-
}.
|
53
|
+
expect {
|
54
|
+
expect(owner).to have(4).items_in_collection_with_length_method
|
55
|
+
}.to fail_with("expected 4 items_in_collection_with_length_method, got 3")
|
56
|
+
expect {
|
57
|
+
expect(owner).to have(4).items_in_collection_with_size_method
|
58
|
+
}.to fail_with("expected 4 items_in_collection_with_size_method, got 3")
|
59
|
+
expect {
|
60
|
+
expect(owner).to have(4).items_in_collection_with_count_method
|
61
|
+
}.to fail_with("expected 4 items_in_collection_with_count_method, got 3")
|
62
62
|
end
|
63
63
|
|
64
64
|
it "fails if target has a collection of items with > n members" do
|
65
65
|
owner = create_collection_owner_with(3)
|
66
|
-
|
67
|
-
owner.
|
68
|
-
}.
|
69
|
-
|
70
|
-
owner.
|
71
|
-
}.
|
72
|
-
|
73
|
-
owner.
|
74
|
-
}.
|
66
|
+
expect {
|
67
|
+
expect(owner).to have(2).items_in_collection_with_length_method
|
68
|
+
}.to fail_with("expected 2 items_in_collection_with_length_method, got 3")
|
69
|
+
expect {
|
70
|
+
expect(owner).to have(2).items_in_collection_with_size_method
|
71
|
+
}.to fail_with("expected 2 items_in_collection_with_size_method, got 3")
|
72
|
+
expect {
|
73
|
+
expect(owner).to have(2).items_in_collection_with_count_method
|
74
|
+
}.to fail_with("expected 2 items_in_collection_with_count_method, got 3")
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
|
-
describe '
|
78
|
+
describe 'expect(...).to have(1).item when ActiveSupport::Inflector is defined' do
|
79
79
|
|
80
80
|
it 'pluralizes the collection name' do
|
81
81
|
owner = create_collection_owner_with(1)
|
82
|
-
owner.
|
82
|
+
expect(owner).to have(1).item
|
83
83
|
end
|
84
84
|
|
85
85
|
context "when ActiveSupport::Inflector is partially loaded without its inflectors" do
|
@@ -87,134 +87,136 @@ describe "have matcher" do
|
|
87
87
|
it "does not pluralize the collection name" do
|
88
88
|
stub_const("ActiveSupport::Inflector", Module.new)
|
89
89
|
owner = create_collection_owner_with(1)
|
90
|
-
expect {
|
90
|
+
expect {
|
91
|
+
expect(owner).to have(1).item
|
92
|
+
}.to raise_error(NoMethodError)
|
91
93
|
end
|
92
94
|
|
93
95
|
end
|
94
96
|
end
|
95
97
|
|
96
|
-
describe '
|
98
|
+
describe 'expect(...).to have(1).item when Inflector is defined' do
|
97
99
|
before { stub_const("Inflector", inflector) }
|
98
100
|
|
99
101
|
it 'pluralizes the collection name' do
|
100
102
|
owner = create_collection_owner_with(1)
|
101
|
-
owner.
|
103
|
+
expect(owner).to have(1).item
|
102
104
|
end
|
103
105
|
end
|
104
106
|
|
105
|
-
describe "
|
107
|
+
describe "expect(...).to have(n).items where result responds to items but returns something other than a collection" do
|
106
108
|
it "provides a meaningful error" do
|
107
109
|
owner = Class.new do
|
108
110
|
def items
|
109
111
|
Object.new
|
110
112
|
end
|
111
113
|
end.new
|
112
|
-
|
113
|
-
owner.
|
114
|
-
end.
|
114
|
+
expect do
|
115
|
+
expect(owner).to have(3).items
|
116
|
+
end.to raise_error("expected items to be a collection but it does not respond to #length, #size or #count")
|
115
117
|
end
|
116
118
|
end
|
117
119
|
|
118
|
-
describe "
|
120
|
+
describe "expect(...).not_to have(n).items" do
|
119
121
|
|
120
122
|
it "passes if target has a collection of items with < n members" do
|
121
123
|
owner = create_collection_owner_with(3)
|
122
|
-
owner.
|
123
|
-
owner.
|
124
|
-
owner.
|
124
|
+
expect(owner).not_to have(4).items_in_collection_with_length_method
|
125
|
+
expect(owner).not_to have(4).items_in_collection_with_size_method
|
126
|
+
expect(owner).not_to have(4).items_in_collection_with_count_method
|
125
127
|
end
|
126
128
|
|
127
129
|
it "passes if target has a collection of items with > n members" do
|
128
130
|
owner = create_collection_owner_with(3)
|
129
|
-
owner.
|
130
|
-
owner.
|
131
|
-
owner.
|
131
|
+
expect(owner).not_to have(2).items_in_collection_with_length_method
|
132
|
+
expect(owner).not_to have(2).items_in_collection_with_size_method
|
133
|
+
expect(owner).not_to have(2).items_in_collection_with_count_method
|
132
134
|
end
|
133
135
|
|
134
136
|
it "fails if target has a collection of items with n members" do
|
135
137
|
owner = create_collection_owner_with(3)
|
136
|
-
|
137
|
-
owner.
|
138
|
-
}.
|
139
|
-
|
140
|
-
owner.
|
141
|
-
|
142
|
-
|
143
|
-
owner.
|
144
|
-
|
138
|
+
expect {
|
139
|
+
expect(owner).not_to have(3).items_in_collection_with_length_method
|
140
|
+
}.to fail_with("expected target not to have 3 items_in_collection_with_length_method, got 3")
|
141
|
+
expect {
|
142
|
+
expect(owner).not_to have(3).items_in_collection_with_size_method
|
143
|
+
}.to fail_with("expected target not to have 3 items_in_collection_with_size_method, got 3")
|
144
|
+
expect {
|
145
|
+
expect(owner).not_to have(3).items_in_collection_with_count_method
|
146
|
+
}.to fail_with("expected target not to have 3 items_in_collection_with_count_method, got 3")
|
145
147
|
end
|
146
148
|
end
|
147
149
|
|
148
|
-
describe "
|
150
|
+
describe "expect(...).to have_exactly(n).items" do
|
149
151
|
|
150
152
|
it "passes if target has a collection of items with n members" do
|
151
153
|
owner = create_collection_owner_with(3)
|
152
|
-
owner.
|
153
|
-
owner.
|
154
|
-
owner.
|
154
|
+
expect(owner).to have_exactly(3).items_in_collection_with_length_method
|
155
|
+
expect(owner).to have_exactly(3).items_in_collection_with_size_method
|
156
|
+
expect(owner).to have_exactly(3).items_in_collection_with_count_method
|
155
157
|
end
|
156
158
|
|
157
159
|
it "converts :no to 0" do
|
158
160
|
owner = create_collection_owner_with(0)
|
159
|
-
owner.
|
160
|
-
owner.
|
161
|
-
owner.
|
161
|
+
expect(owner).to have_exactly(:no).items_in_collection_with_length_method
|
162
|
+
expect(owner).to have_exactly(:no).items_in_collection_with_size_method
|
163
|
+
expect(owner).to have_exactly(:no).items_in_collection_with_count_method
|
162
164
|
end
|
163
165
|
|
164
166
|
it "fails if target has a collection of items with < n members" do
|
165
167
|
owner = create_collection_owner_with(3)
|
166
|
-
|
167
|
-
owner.
|
168
|
-
}.
|
169
|
-
|
170
|
-
owner.
|
171
|
-
}.
|
172
|
-
|
173
|
-
owner.
|
174
|
-
}.
|
168
|
+
expect {
|
169
|
+
expect(owner).to have_exactly(4).items_in_collection_with_length_method
|
170
|
+
}.to fail_with("expected 4 items_in_collection_with_length_method, got 3")
|
171
|
+
expect {
|
172
|
+
expect(owner).to have_exactly(4).items_in_collection_with_size_method
|
173
|
+
}.to fail_with("expected 4 items_in_collection_with_size_method, got 3")
|
174
|
+
expect {
|
175
|
+
expect(owner).to have_exactly(4).items_in_collection_with_count_method
|
176
|
+
}.to fail_with("expected 4 items_in_collection_with_count_method, got 3")
|
175
177
|
end
|
176
178
|
|
177
179
|
it "fails if target has a collection of items with > n members" do
|
178
180
|
owner = create_collection_owner_with(3)
|
179
|
-
|
180
|
-
owner.
|
181
|
-
}.
|
182
|
-
|
183
|
-
owner.
|
184
|
-
}.
|
185
|
-
|
186
|
-
owner.
|
187
|
-
}.
|
181
|
+
expect {
|
182
|
+
expect(owner).to have_exactly(2).items_in_collection_with_length_method
|
183
|
+
}.to fail_with("expected 2 items_in_collection_with_length_method, got 3")
|
184
|
+
expect {
|
185
|
+
expect(owner).to have_exactly(2).items_in_collection_with_size_method
|
186
|
+
}.to fail_with("expected 2 items_in_collection_with_size_method, got 3")
|
187
|
+
expect {
|
188
|
+
expect(owner).to have_exactly(2).items_in_collection_with_count_method
|
189
|
+
}.to fail_with("expected 2 items_in_collection_with_count_method, got 3")
|
188
190
|
end
|
189
191
|
end
|
190
192
|
|
191
|
-
describe "
|
193
|
+
describe "expect(...).to have_at_least(n).items" do
|
192
194
|
|
193
195
|
it "passes if target has a collection of items with n members" do
|
194
196
|
owner = create_collection_owner_with(3)
|
195
|
-
owner.
|
196
|
-
owner.
|
197
|
-
owner.
|
197
|
+
expect(owner).to have_at_least(3).items_in_collection_with_length_method
|
198
|
+
expect(owner).to have_at_least(3).items_in_collection_with_size_method
|
199
|
+
expect(owner).to have_at_least(3).items_in_collection_with_count_method
|
198
200
|
end
|
199
201
|
|
200
202
|
it "passes if target has a collection of items with > n members" do
|
201
203
|
owner = create_collection_owner_with(3)
|
202
|
-
owner.
|
203
|
-
owner.
|
204
|
-
owner.
|
204
|
+
expect(owner).to have_at_least(2).items_in_collection_with_length_method
|
205
|
+
expect(owner).to have_at_least(2).items_in_collection_with_size_method
|
206
|
+
expect(owner).to have_at_least(2).items_in_collection_with_count_method
|
205
207
|
end
|
206
208
|
|
207
209
|
it "fails if target has a collection of items with < n members" do
|
208
210
|
owner = create_collection_owner_with(3)
|
209
|
-
|
210
|
-
owner.
|
211
|
-
}.
|
212
|
-
|
213
|
-
owner.
|
214
|
-
}.
|
215
|
-
|
216
|
-
owner.
|
217
|
-
}.
|
211
|
+
expect {
|
212
|
+
expect(owner).to have_at_least(4).items_in_collection_with_length_method
|
213
|
+
}.to fail_with("expected at least 4 items_in_collection_with_length_method, got 3")
|
214
|
+
expect {
|
215
|
+
expect(owner).to have_at_least(4).items_in_collection_with_size_method
|
216
|
+
}.to fail_with("expected at least 4 items_in_collection_with_size_method, got 3")
|
217
|
+
expect {
|
218
|
+
expect(owner).to have_at_least(4).items_in_collection_with_count_method
|
219
|
+
}.to fail_with("expected at least 4 items_in_collection_with_count_method, got 3")
|
218
220
|
end
|
219
221
|
|
220
222
|
it "provides educational negative failure messages" do
|
@@ -230,57 +232,57 @@ describe "have matcher" do
|
|
230
232
|
count_matcher.matches?(owner)
|
231
233
|
|
232
234
|
#then
|
233
|
-
length_matcher.failure_message_for_should_not.
|
235
|
+
expect(length_matcher.failure_message_for_should_not).to eq <<-EOF
|
234
236
|
Isn't life confusing enough?
|
235
237
|
Instead of having to figure out the meaning of this:
|
236
|
-
|
238
|
+
expect(actual).not_to have_at_least(3).items_in_collection_with_length_method
|
237
239
|
We recommend that you use this instead:
|
238
|
-
|
240
|
+
expect(actual).to have_at_most(2).items_in_collection_with_length_method
|
239
241
|
EOF
|
240
242
|
|
241
|
-
size_matcher.failure_message_for_should_not.
|
243
|
+
expect(size_matcher.failure_message_for_should_not).to eq <<-EOF
|
242
244
|
Isn't life confusing enough?
|
243
245
|
Instead of having to figure out the meaning of this:
|
244
|
-
|
246
|
+
expect(actual).not_to have_at_least(3).items_in_collection_with_size_method
|
245
247
|
We recommend that you use this instead:
|
246
|
-
|
248
|
+
expect(actual).to have_at_most(2).items_in_collection_with_size_method
|
247
249
|
EOF
|
248
|
-
count_matcher.failure_message_for_should_not.
|
250
|
+
expect(count_matcher.failure_message_for_should_not).to eq <<-EOF
|
249
251
|
Isn't life confusing enough?
|
250
252
|
Instead of having to figure out the meaning of this:
|
251
|
-
|
253
|
+
expect(actual).not_to have_at_least(3).items_in_collection_with_count_method
|
252
254
|
We recommend that you use this instead:
|
253
|
-
|
255
|
+
expect(actual).to have_at_most(2).items_in_collection_with_count_method
|
254
256
|
EOF
|
255
257
|
end
|
256
258
|
end
|
257
259
|
|
258
|
-
describe "
|
260
|
+
describe "expect(...).to have_at_most(n).items" do
|
259
261
|
it "passes if target has a collection of items with n members" do
|
260
262
|
owner = create_collection_owner_with(3)
|
261
|
-
owner.
|
262
|
-
owner.
|
263
|
-
owner.
|
263
|
+
expect(owner).to have_at_most(3).items_in_collection_with_length_method
|
264
|
+
expect(owner).to have_at_most(3).items_in_collection_with_size_method
|
265
|
+
expect(owner).to have_at_most(3).items_in_collection_with_count_method
|
264
266
|
end
|
265
267
|
|
266
268
|
it "fails if target has a collection of items with > n members" do
|
267
269
|
owner = create_collection_owner_with(3)
|
268
|
-
|
269
|
-
owner.
|
270
|
-
}.
|
271
|
-
|
272
|
-
owner.
|
273
|
-
}.
|
274
|
-
|
275
|
-
owner.
|
276
|
-
}.
|
270
|
+
expect {
|
271
|
+
expect(owner).to have_at_most(2).items_in_collection_with_length_method
|
272
|
+
}.to fail_with("expected at most 2 items_in_collection_with_length_method, got 3")
|
273
|
+
expect {
|
274
|
+
expect(owner).to have_at_most(2).items_in_collection_with_size_method
|
275
|
+
}.to fail_with("expected at most 2 items_in_collection_with_size_method, got 3")
|
276
|
+
expect {
|
277
|
+
expect(owner).to have_at_most(2).items_in_collection_with_count_method
|
278
|
+
}.to fail_with("expected at most 2 items_in_collection_with_count_method, got 3")
|
277
279
|
end
|
278
280
|
|
279
281
|
it "passes if target has a collection of items with < n members" do
|
280
282
|
owner = create_collection_owner_with(3)
|
281
|
-
owner.
|
282
|
-
owner.
|
283
|
-
owner.
|
283
|
+
expect(owner).to have_at_most(4).items_in_collection_with_length_method
|
284
|
+
expect(owner).to have_at_most(4).items_in_collection_with_size_method
|
285
|
+
expect(owner).to have_at_most(4).items_in_collection_with_count_method
|
284
286
|
end
|
285
287
|
|
286
288
|
it "provides educational negative failure messages" do
|
@@ -296,28 +298,28 @@ EOF
|
|
296
298
|
count_matcher.matches?(owner)
|
297
299
|
|
298
300
|
#then
|
299
|
-
length_matcher.failure_message_for_should_not.
|
301
|
+
expect(length_matcher.failure_message_for_should_not).to eq <<-EOF
|
300
302
|
Isn't life confusing enough?
|
301
303
|
Instead of having to figure out the meaning of this:
|
302
|
-
|
304
|
+
expect(actual).not_to have_at_most(3).items_in_collection_with_length_method
|
303
305
|
We recommend that you use this instead:
|
304
|
-
|
306
|
+
expect(actual).to have_at_least(4).items_in_collection_with_length_method
|
305
307
|
EOF
|
306
308
|
|
307
|
-
size_matcher.failure_message_for_should_not.
|
309
|
+
expect(size_matcher.failure_message_for_should_not).to eq <<-EOF
|
308
310
|
Isn't life confusing enough?
|
309
311
|
Instead of having to figure out the meaning of this:
|
310
|
-
|
312
|
+
expect(actual).not_to have_at_most(3).items_in_collection_with_size_method
|
311
313
|
We recommend that you use this instead:
|
312
|
-
|
314
|
+
expect(actual).to have_at_least(4).items_in_collection_with_size_method
|
313
315
|
EOF
|
314
316
|
|
315
|
-
count_matcher.failure_message_for_should_not.
|
317
|
+
expect(count_matcher.failure_message_for_should_not).to eq <<-EOF
|
316
318
|
Isn't life confusing enough?
|
317
319
|
Instead of having to figure out the meaning of this:
|
318
|
-
|
320
|
+
expect(actual).not_to have_at_most(3).items_in_collection_with_count_method
|
319
321
|
We recommend that you use this instead:
|
320
|
-
|
322
|
+
expect(actual).to have_at_least(4).items_in_collection_with_count_method
|
321
323
|
EOF
|
322
324
|
end
|
323
325
|
end
|
@@ -326,40 +328,48 @@ EOF
|
|
326
328
|
it "passes args to target" do
|
327
329
|
target = mock("target")
|
328
330
|
target.should_receive(:items).with("arg1","arg2").and_return([1,2,3])
|
329
|
-
target.
|
331
|
+
expect(target).to have(3).items("arg1","arg2")
|
330
332
|
end
|
331
333
|
|
332
334
|
it "passes block to target" do
|
333
335
|
target = mock("target")
|
334
336
|
block = lambda { 5 }
|
335
337
|
target.should_receive(:items).with("arg1","arg2", block).and_return([1,2,3])
|
336
|
-
target.
|
338
|
+
expect(target).to have(3).items("arg1","arg2", block)
|
337
339
|
end
|
338
340
|
end
|
339
341
|
|
340
342
|
describe "have(n).items where target IS a collection" do
|
341
343
|
it "references the number of items IN the collection" do
|
342
|
-
[1,2,3].
|
344
|
+
expect([1,2,3]).to have(3).items
|
343
345
|
end
|
344
346
|
|
345
347
|
it "fails when the number of items IN the collection is not as expected" do
|
346
|
-
|
348
|
+
expect {
|
349
|
+
expect([1,2,3]).to have(7).items
|
350
|
+
}.to fail_with("expected 7 items, got 3")
|
347
351
|
end
|
348
352
|
end
|
349
353
|
|
350
354
|
describe "have(n).characters where target IS a String" do
|
351
355
|
it "passes if the length is correct" do
|
352
|
-
"this string".
|
356
|
+
expect("this string").to have(11).characters
|
353
357
|
end
|
354
358
|
|
355
359
|
it "fails if the length is incorrect" do
|
356
|
-
|
360
|
+
expect {
|
361
|
+
expect("this string").to have(12).characters
|
362
|
+
}.to fail_with("expected 12 characters, got 11")
|
357
363
|
end
|
358
364
|
end
|
359
365
|
|
360
366
|
describe "have(n).things on an object which is not a collection nor contains one" do
|
361
367
|
it "fails" do
|
362
|
-
|
368
|
+
expect {
|
369
|
+
expect(Object.new).to have(2).things
|
370
|
+
}.to raise_error(NoMethodError) { |e|
|
371
|
+
expect(e.name).to eq :things
|
372
|
+
}
|
363
373
|
end
|
364
374
|
end
|
365
375
|
|
@@ -367,35 +377,39 @@ EOF
|
|
367
377
|
before(:each) do
|
368
378
|
@collection = Object.new
|
369
379
|
def @collection.floozles; [1,2] end
|
380
|
+
def @collection.send; :sent; end
|
370
381
|
end
|
371
382
|
|
372
383
|
it "works in the straightforward case" do
|
373
|
-
|
374
|
-
@collection.should have(2).floozles
|
375
|
-
}.should_not raise_error
|
384
|
+
expect(@collection).to have(2).floozles
|
376
385
|
end
|
377
386
|
|
378
387
|
it "works when doing automatic pluralization" do
|
379
|
-
|
380
|
-
@collection.should have_at_least(1).floozle
|
381
|
-
}.should_not raise_error
|
388
|
+
expect(@collection).to have_at_least(1).floozle
|
382
389
|
end
|
383
390
|
|
384
391
|
it "blows up when the owner doesn't respond to that method" do
|
385
|
-
|
386
|
-
@collection.
|
387
|
-
}.
|
392
|
+
expect {
|
393
|
+
expect(@collection).to have(99).problems
|
394
|
+
}.to raise_error(NoMethodError, /problems/)
|
395
|
+
end
|
396
|
+
|
397
|
+
it 'works when #send is defined directly on an array' do
|
398
|
+
array = [1, 2]
|
399
|
+
def array.send; :sent; end
|
400
|
+
|
401
|
+
expect(array).to have(2).items
|
388
402
|
end
|
389
403
|
end
|
390
404
|
|
391
405
|
describe RSpec::Matchers::BuiltIn::Have do
|
392
406
|
it "has method_missing as private" do
|
393
|
-
described_class.private_instance_methods.
|
407
|
+
expect(described_class.private_instance_methods).to include_method(:method_missing)
|
394
408
|
end
|
395
409
|
|
396
410
|
it "does not respond_to? method_missing (because it's private)" do
|
397
411
|
formatter = described_class.new(0, StringIO.new)
|
398
|
-
formatter.
|
412
|
+
expect(formatter).not_to respond_to(:method_missing)
|
399
413
|
end
|
400
414
|
|
401
415
|
describe "respond_to?" do
|
@@ -406,25 +420,25 @@ EOF
|
|
406
420
|
end
|
407
421
|
|
408
422
|
it "is true for a method which Have defines" do
|
409
|
-
@have.
|
423
|
+
expect(@have).to respond_to(@a_method_which_have_defines)
|
410
424
|
end
|
411
425
|
|
412
426
|
it "is true for a method that it's superclass (Object) defines" do
|
413
|
-
@have.
|
427
|
+
expect(@have).to respond_to(@a_method_which_object_defines)
|
414
428
|
end
|
415
429
|
|
416
430
|
it "is false for a method which neither Object nor nor Have defines" do
|
417
|
-
@have.
|
431
|
+
expect(@have).not_to respond_to(:foo_bar_baz)
|
418
432
|
end
|
419
433
|
|
420
434
|
it "is false if the owner doesn't respond to the method" do
|
421
435
|
have = described_class.new(99)
|
422
|
-
have.
|
436
|
+
expect(have).not_to respond_to(:problems)
|
423
437
|
end
|
424
438
|
|
425
439
|
it "is true if the owner responds to the method" do
|
426
440
|
have = described_class.new(:a_symbol)
|
427
|
-
have.
|
441
|
+
expect(have).to respond_to(:to_sym)
|
428
442
|
end
|
429
443
|
end
|
430
444
|
end
|