Skip to content

Commit

Permalink
test: update foo bar failed example
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Jul 25, 2018
1 parent 1134dcf commit c1bb89a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions spec/features/foo_bar_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@
will_respond_with({
status: 200,
headers: { 'Content-Type' => 'application/json' },
body: Pact.each_like({status: Pact.term(/\d+/, "4")})
body: {
name: "Thing 1"
}
})

bar_response = Net::HTTP.get_response(URI('http://localhost:4638/thing'))

expect(bar_response.code).to eql '200'
expect(JSON.parse(bar_response.body)).to eq [{"status" => "4"}]
expect(JSON.parse(bar_response.body)).to eq "name" => "Thing 1"

puts bar_service.write_pact
end
Expand Down
2 changes: 1 addition & 1 deletion spec/support/bar_fail_pact_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Pact
module Test
class BarApp
def call env
[200, {'Content-Type' => 'application/json'}, [{}].to_json]
[200, {'Content-Type' => 'application/hal+json'}, [{name: "Thing 2"}.to_json]]
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/support/bar_pact_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Pact
module Test
class BarApp
def call env
[200, {'Content-Type' => 'application/json'}, [{"status" => "5"},{"status" => "6"}].to_json]
[200, {'Content-Type' => 'application/json'}, [{name: "Thing 1"}.to_json]]
end
end

Expand Down

0 comments on commit c1bb89a

Please sign in to comment.