Skip to content

Commit d025342

Browse files
committed
fix: correct generators import and update specs
1 parent 3519472 commit d025342

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

lib/pact/provider/request.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def reified_body
6161
end
6262

6363
def generated_body
64-
result = Pact::Provider::Generators.apply_generators(expected_request, "body", reified_body, @state_params)
64+
result = Pact::Generators.apply_generators(expected_request, "body", reified_body, @state_params)
6565

6666
case result
6767
when Hash

spec/lib/pact/provider/generators_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,6 @@
6363
}
6464
})
6565
request = Pact::Provider::Request::Replayable.new(expected_request)
66-
expect(request.body['result'][0].length).to eq(8)
66+
expect(JSON.parse(request.body)['result'][0].length).to eq(8)
6767
end
6868
end

spec/lib/pact/provider/request_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,10 @@
7575
context "and it uses generators" do
7676
let(:body) { { a: 'body', b: '2025-04-08' } }
7777
let(:generators) { {"body"=>{"b"=>{"type"=>"Date"}}} }
78+
let(:expected_body) { { a: 'body', b: Date.today.to_s } }
7879

7980
it "returns the object as a json string" do
80-
expect(subject.body).to eq body.to_json
81+
expect(subject.body).to eq expected_body.to_json
8182
end
8283
end
8384
end

0 commit comments

Comments
 (0)