Skip to content

Commit ec0b929

Browse files
committed
Add tests for the JSON type matcher convenience types
1 parent a1dc71a commit ec0b929

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

spec/json_spec/matchers/have_json_type_spec.rb

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
describe JsonSpec::Matchers::HaveJsonType do
44
it "matches hashes" do
5-
%({}).should have_json_type(Hash)
5+
hash = %({})
6+
hash.should have_json_type(Hash)
7+
hash.should have_json_type(:object)
68
end
79

810
it "matches arrays" do
@@ -34,6 +36,11 @@
3436
%(1e+1).should have_json_type(Float)
3537
end
3638

39+
it "matches booleans" do
40+
%(true).should have_json_type(:boolean)
41+
%(false).should have_json_type(:boolean)
42+
end
43+
3744
it "matches ancestor classes" do
3845
%(10).should have_json_type(Numeric)
3946
%(10.0).should have_json_type(Numeric)
@@ -73,7 +80,10 @@
7380
end
7481

7582
it "matches null" do
76-
%(null).should have_json_type(NilClass)
83+
null = %(null)
84+
null.should have_json_type(NilClass)
85+
null.should have_json_type(:nil)
86+
null.should have_json_type(:null)
7787
end
7888
end
7989
end

0 commit comments

Comments
 (0)