Sha256: d13dc63645bd88d0bc4538f3b818f7c3bb07680b6452460a15d13f892c68f56a
Contents?: true
Size: 1.97 KB
Versions: 3
Compression:
Stored size: 1.97 KB
Contents
require 'spec_helper' require 'pact/shared/request' module Pact module Request describe Base do class TestRequest < Base def self.key_not_found nil end end subject { TestRequest.new("get", "/", {some: "things"}, {some: "things"} , "some=things") } describe "#to_json" do it "renders the keys in a sensible order" do expect(subject.to_json).to match(/method.*path.*query.*headers.*body/) end end describe "#full_path" do subject { TestRequest.new("get", "/something", {}, {some: "things"} , query).full_path } context "with a query that is a Pact::Term" do let(:query) { Pact::Term.new(generate: "some=things", matcher: /some/) } it "reifies and appends the query" do expect(subject).to eq("/something?some=things") end end context "with a query that is a string" do let(:query) { "some=things" } it "appends the query" do expect(subject).to eq("/something?some=things") end end context "with an empty query" do let(:query) { "" } it "does include a query" do expect(subject).to eq("/something") end end context "with a nil query" do let(:query) { nil } it "does not include a query" do expect(subject).to eq("/something") end end end describe "#method_and_path" do context "with an empty path" do subject { TestRequest.new("get", "", {}, {} , "").method_and_path } it "includes a slash" do expect(subject).to eq("GET /") end end context "with a path" do subject { TestRequest.new("get", "/something", {}, {} , "").method_and_path } it "includes the path" do expect(subject).to eq("GET /something") end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pact-1.1.0 | spec/lib/pact/shared/request_spec.rb |
pact-1.1.0.rc5 | spec/lib/pact/shared/request_spec.rb |
pact-1.1.0.rc4 | spec/lib/pact/shared/request_spec.rb |