Skip to content

Commit 44ea0c3

Browse files
committed
feat(skip writing to pact): Use writable_interactions when writing to pact file
1 parent e53f1df commit 44ea0c3

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ log
2929
reports
3030
Gemfile.lock
3131
build
32+
.byebug_history
3233

3334
vendor/bundle/
3435
spec/examples.txt

lib/pact/consumer_contract/consumer_contract_decorator.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ def to_json(options = {})
3232

3333
def sorted_interactions
3434
# Default order: chronological
35-
return consumer_contract.interactions if Pact.configuration.pactfile_write_order == :chronological
35+
return consumer_contract.writable_interactions if Pact.configuration.pactfile_write_order == :chronological
3636
# We are supporting only chronological or alphabetical order
3737
raise NotImplementedError if Pact.configuration.pactfile_write_order != :alphabetical
3838

39-
consumer_contract.interactions.sort{|a, b| sortable_id(a) <=> sortable_id(b)}
39+
consumer_contract.writable_interactions.sort{|a, b| sortable_id(a) <=> sortable_id(b)}
4040
end
4141

4242
def sortable_id interaction

lib/pact/consumer_contract/interaction_decorator.rb

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ def as_json options = {}
1717
hash[:providerState] = interaction.provider_state if interaction.provider_state
1818
hash[:request] = decorate_request.as_json(options)
1919
hash[:response] = decorate_response.as_json(options)
20+
hash[:metadata] = interaction.metadata
2021
fix_all_the_things hash
2122
end
2223

0 commit comments

Comments
 (0)