Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/pact/provider/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def reified_body
end

def generated_body
result = Pact::Provider::Generators.apply_generators(expected_request, "body", reified_body, @state_params)
result = Pact::Generators.apply_generators(expected_request, "body", reified_body, @state_params)

case result
when Hash
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/pact/provider/generators_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@
}
})
request = Pact::Provider::Request::Replayable.new(expected_request)
expect(request.body['result'][0].length).to eq(8)
expect(JSON.parse(request.body)['result'][0].length).to eq(8)
end
end
3 changes: 2 additions & 1 deletion spec/lib/pact/provider/request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@
context "and it uses generators" do
let(:body) { { a: 'body', b: '2025-04-08' } }
let(:generators) { {"body"=>{"b"=>{"type"=>"Date"}}} }
let(:expected_body) { { a: 'body', b: Date.today.to_s } }

it "returns the object as a json string" do
expect(subject.body).to eq body.to_json
expect(subject.body).to eq expected_body.to_json
end
end
end
Expand Down