File tree Expand file tree Collapse file tree 7 files changed +32
-18
lines changed Expand file tree Collapse file tree 7 files changed +32
-18
lines changed Original file line number Diff line number Diff line change @@ -42,13 +42,15 @@ def including(*keys)
42
42
self
43
43
end
44
44
45
- def failure_message_for_should
45
+ def failure_message
46
46
message_with_path ( "Expected equivalent JSON" )
47
47
end
48
+ alias :failure_message_for_should :failure_message
48
49
49
- def failure_message_for_should_not
50
+ def failure_message_when_negated
50
51
message_with_path ( "Expected inequivalent JSON" )
51
52
end
53
+ alias :failure_message_for_should_not :failure_message_when_negated
52
54
53
55
def description
54
56
message_with_path ( "equal JSON" )
Original file line number Diff line number Diff line change @@ -14,13 +14,15 @@ def matches?(json)
14
14
false
15
15
end
16
16
17
- def failure_message_for_should
17
+ def failure_message
18
18
%(Expected JSON path "#{ @path } ")
19
19
end
20
+ alias :failure_message_for_should :failure_message
20
21
21
- def failure_message_for_should_not
22
+ def failure_message_when_negated
22
23
%(Expected no JSON path "#{ @path } ")
23
24
end
25
+ alias :failure_message_for_should_not :failure_message_when_negated
24
26
25
27
def description
26
28
%(have JSON path "#{ @path } ")
Original file line number Diff line number Diff line change @@ -19,13 +19,15 @@ def at_path(path)
19
19
self
20
20
end
21
21
22
- def failure_message_for_should
22
+ def failure_message
23
23
message_with_path ( "Expected JSON value size to be #{ @expected } , got #{ @actual } " )
24
24
end
25
+ alias :failure_message_for_should :failure_message
25
26
26
- def failure_message_for_should_not
27
+ def failure_message_when_negated
27
28
message_with_path ( "Expected JSON value size to not be #{ @expected } , got #{ @actual } " )
28
29
end
30
+ alias :failure_message_for_should_not :failure_message_when_negated
29
31
30
32
def description
31
33
message_with_path ( %(have JSON size "#{ @expected } ") )
Original file line number Diff line number Diff line change @@ -18,13 +18,15 @@ def at_path(path)
18
18
self
19
19
end
20
20
21
- def failure_message_for_should
21
+ def failure_message
22
22
message_with_path ( "Expected JSON value type to be #{ @classes . join ( ", " ) } , got #{ @ruby . class } " )
23
23
end
24
+ alias :failure_message_for_should :failure_message
24
25
25
- def failure_message_for_should_not
26
+ def failure_message_when_negated
26
27
message_with_path ( "Expected JSON value type to not be #{ @classes . join ( ", " ) } , got #{ @ruby . class } " )
27
28
end
29
+ alias :failure_message_for_should_not :failure_message_when_negated
28
30
29
31
def description
30
32
message_with_path ( %(have JSON type "#{ @classes . join ( ", " ) } ") )
Original file line number Diff line number Diff line change @@ -42,13 +42,15 @@ def including(*keys)
42
42
self
43
43
end
44
44
45
- def failure_message_for_should
45
+ def failure_message
46
46
message_with_path ( "Expected included JSON" )
47
47
end
48
+ alias :failure_message_for_should :failure_message
48
49
49
- def failure_message_for_should_not
50
+ def failure_message_when_negated
50
51
message_with_path ( "Expected excluded JSON" )
51
52
end
53
+ alias :failure_message_for_should_not :failure_message_when_negated
52
54
53
55
def description
54
56
message_with_path ( "include JSON" )
Original file line number Diff line number Diff line change 21
21
%({"one":[1,2,3]}) . should have_json_size ( 3 ) . at_path ( "one" )
22
22
end
23
23
24
- it "provides a failure message for should " do
24
+ it "provides a failure message" do
25
25
matcher = have_json_size ( 3 )
26
26
matcher . matches? ( %([1,2]) )
27
- matcher . failure_message_for_should . should == "Expected JSON value size to be 3, got 2"
27
+ matcher . failure_message . should == "Expected JSON value size to be 3, got 2"
28
+ matcher . failure_message_for_should . should == "Expected JSON value size to be 3, got 2" # RSpec 2 interface
28
29
end
29
30
30
- it "provides a failure message for should not " do
31
+ it "provides a failure message for negation " do
31
32
matcher = have_json_size ( 3 )
32
33
matcher . matches? ( %([1,2,3]) )
33
- matcher . failure_message_for_should_not . should == "Expected JSON value size to not be 3, got 3"
34
+ matcher . failure_message_when_negated . should == "Expected JSON value size to not be 3, got 3"
35
+ matcher . failure_message_for_should_not . should == "Expected JSON value size to not be 3, got 3" # RSpec 2 interface
34
36
end
35
37
36
38
it "provides a description message" do
Original file line number Diff line number Diff line change 46
46
%(10.0) . should have_json_type ( Numeric )
47
47
end
48
48
49
- it "provides a failure message for should " do
49
+ it "provides a failure message" do
50
50
matcher = have_json_type ( Numeric )
51
51
matcher . matches? ( %("foo") )
52
- matcher . failure_message_for_should . should == "Expected JSON value type to be Numeric, got String"
52
+ matcher . failure_message . should == "Expected JSON value type to be Numeric, got String"
53
+ matcher . failure_message_for_should . should == "Expected JSON value type to be Numeric, got String" # RSpec 2 interface
53
54
end
54
55
55
- it "provides a failure message for should not " do
56
+ it "provides a failure message for negation " do
56
57
matcher = have_json_type ( Numeric )
57
58
matcher . matches? ( %(10) )
58
- matcher . failure_message_for_should_not . should == "Expected JSON value type to not be Numeric, got Fixnum"
59
+ matcher . failure_message_when_negated . should == "Expected JSON value type to not be Numeric, got Fixnum"
60
+ matcher . failure_message_for_should_not . should == "Expected JSON value type to not be Numeric, got Fixnum" # RSpec 2 interface
59
61
end
60
62
61
63
it "provides a description message" do
You can’t perform that action at this time.
0 commit comments