Skip to content

Commit

Permalink
fix(verify): exit with status 0 if all pacts are in pending state
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Nov 15, 2019
1 parent 26e2baa commit 2f7110b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/pact/provider/pact_spec_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def run_specs
::RSpec::Core::CommandLine.new(NoConfigurationOptions.new)
.run(::RSpec.configuration.output_stream, ::RSpec.configuration.error_stream)
end
options[:ignore_failures] ? 0 : exit_code
(all_pacts_pending? || options[:ignore_failures]) ? 0 : exit_code
end

def rspec_runner_options
Expand Down Expand Up @@ -159,6 +159,10 @@ def ordered_pact_json(pact_json)
consumer_contract.to_json
end

def all_pacts_pending?
pact_urls.all?{ | pact_url| pact_url.metadata[:pending] }
end

def class_exists? name
Kernel.const_get name
rescue NameError
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 @@ -76,7 +76,7 @@ def describe_interaction interaction, options
pact_interaction: interaction,
pact_interaction_example_description: interaction_description_for_rerun_command(interaction),
pact_uri: options[:pact_uri],
pact_ignore_failures: options[:pact_uri].metadata[:pending]
pact_ignore_failures: options[:pact_uri].metadata[:pending] || options[:ignore_failures]
}

describe description_for(interaction), metadata do
Expand Down

0 comments on commit 2f7110b

Please sign in to comment.