Skip to content

Commit

Permalink
Add Test coverage for Hash arguments
Browse files Browse the repository at this point in the history
Closes [#58].

The `match_response_schema` can be chained off `expect({ ... })` calls,
so add test coverage to ensure that.

[#58]: #58
  • Loading branch information
seanpdoyle committed Sep 29, 2017
1 parent bd53566 commit 3047721
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions spec/json_matchers/match_response_schema_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,25 @@
expect(response_for({})).not_to match_response_schema("foo_schema")
end

context "when passed a Hash" do
before(:each) do
create_schema("foo_schema", {
"type" => "object",
"required" => [
"id",
],
"properties" => {
"id" => { "type" => "number" },
},
"additionalProperties" => false,
})
end

it "validates when the schema matches" do
expect({ "id" => 1 }).to match_response_schema("foo_schema")
end
end

context "when JSON is a string" do
before(:each) do
create_schema("foo_schema", {
Expand Down

0 comments on commit 3047721

Please sign in to comment.