From a025dd33b500c334f1bd346c42ab920c5db84d2a Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Sat, 14 Jul 2018 19:44:46 +1000 Subject: [PATCH] feat: reify StringWithMatchingRules to a String --- lib/pact/reification.rb | 3 +++ spec/lib/pact/reification_spec.rb | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/lib/pact/reification.rb b/lib/pact/reification.rb index dcbe4e2..bbfbc2c 100644 --- a/lib/pact/reification.rb +++ b/lib/pact/reification.rb @@ -5,6 +5,7 @@ require 'pact/shared/request' require 'pact/consumer_contract/query_hash' require 'pact/consumer_contract/query_string' +require 'pact/consumer_contract/string_with_matching_rules' module Pact module Reification @@ -35,6 +36,8 @@ def self.from_term(term) "#{k}=#{escape(v)}" end }.join('&') + when Pact::StringWithMatchingRules + String.new(term) else term end diff --git a/spec/lib/pact/reification_spec.rb b/spec/lib/pact/reification_spec.rb index 4a83d22..94d9f84 100644 --- a/spec/lib/pact/reification_spec.rb +++ b/spec/lib/pact/reification_spec.rb @@ -160,5 +160,13 @@ module Pact expect(subject).to eq("param=1¶m=1") end end + + context "with a StringWithMatchingRules" do + subject { Reification.from_term(StringWithMatchingRules.new("foo", Pact::SpecificationVersion.new("3"), {}))} + + it "returns a String" do + expect(subject.class).to be String + end + end end end