Skip to content

Commit

Permalink
feat: expose full notice object in JSON output
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Jan 22, 2020
1 parent 498518c commit bdc2711
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion lib/pact/pact_broker/fetch_pact_uris_for_verification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ def query
end

def extract_notices(pact)
(pact["verificationProperties"]["notices"] || []).collect{ |notice| notice["text"] }.compact
(pact["verificationProperties"]["notices"] || []).collect{ |notice| symbolize_keys(notice) }.compact
end

def symbolize_keys(hash)
hash.each_with_object({}){ |(k,v), h| h[k.to_sym] = v }
end

def log_message
Expand Down
2 changes: 1 addition & 1 deletion lib/pact/provider/rspec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module ClassMethods
def honour_pactfile pact_uri, pact_json, options
Pact.configuration.output_stream.puts "INFO: Reading pact at #{pact_uri}"
(pact_uri.metadata[:notices] || EMPTY_ARRAY).each do | notice |
Pact.configuration.output_stream.puts("DEBUG: #{notice}")
Pact.configuration.output_stream.puts("DEBUG: #{notice[:text]}")
end
Pact.configuration.output_stream.puts "DEBUG: Filtering interactions by: #{options[:criteria]}" if options[:criteria] && options[:criteria].any?
consumer_contract = Pact::ConsumerContract.from_json(pact_json)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@
let(:expected_metadata) do
{
pending: true,
notices: ["some text"]
notices: [
text: "some text"
]
}
end

Expand Down

0 comments on commit bdc2711

Please sign in to comment.