Skip to content

Commit

Permalink
feat: reify StringWithMatchingRules to a String
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Jul 14, 2018
1 parent 2b152ec commit a025dd3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/pact/reification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -35,6 +36,8 @@ def self.from_term(term)
"#{k}=#{escape(v)}"
end
}.join('&')
when Pact::StringWithMatchingRules
String.new(term)
else
term
end
Expand Down
8 changes: 8 additions & 0 deletions spec/lib/pact/reification_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,5 +160,13 @@ module Pact
expect(subject).to eq("param=1&param=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

0 comments on commit a025dd3

Please sign in to comment.