spec/array_spec.rb in strong_json-0.1.2 vs spec/array_spec.rb in strong_json-0.2.0

- old
+ new

@@ -33,6 +33,18 @@ it "rejects nil" do type = StrongJSON::Type::Array.new(StrongJSON::Type::Base.new(:number)) expect { type.coerce(nil) }.to raise_error(StrongJSON::Type::Error) end + + describe "=~" do + it "returns true for array" do + type = StrongJSON::Type::Array.new(StrongJSON::Type::Base.new(:number)) + expect(type =~ []).to be_truthy + end + + it "returns false for number" do + type = StrongJSON::Type::Array.new(StrongJSON::Type::Base.new(:number)) + expect(type =~ 3.0).to be_falsey + end + end end