diff --git a/lib/quiet_quality/executors/pipeline.rb b/lib/quiet_quality/executors/pipeline.rb index c165f59..9afa221 100644 --- a/lib/quiet_quality/executors/pipeline.rb +++ b/lib/quiet_quality/executors/pipeline.rb @@ -15,7 +15,7 @@ def outcome end def failure? - outcome.failure? + messages.any? end def messages diff --git a/lib/quiet_quality/version.rb b/lib/quiet_quality/version.rb index 53b43ab..9ff6d1e 100644 --- a/lib/quiet_quality/version.rb +++ b/lib/quiet_quality/version.rb @@ -1,3 +1,3 @@ module QuietQuality - VERSION = "1.0.1" + VERSION = "1.0.2" end diff --git a/spec/quiet_quality/executors/pipeline_spec.rb b/spec/quiet_quality/executors/pipeline_spec.rb index 2f60858..b3d969c 100644 --- a/spec/quiet_quality/executors/pipeline_spec.rb +++ b/spec/quiet_quality/executors/pipeline_spec.rb @@ -13,9 +13,10 @@ let(:runner) { instance_double(QuietQuality::Tools::Rspec::Runner, invoke!: runner_outcome) } before { allow(QuietQuality::Tools::Rspec::Runner).to receive(:new).and_return(runner) } + let(:other_messages) { generate_messages(4, path: "path/other.rb") } let(:foo_message) { generate_message(path: "path/foo.rb", start_line: 3, stop_line: 7, body: "foo text") } let(:bar_message) { generate_message(path: "path/bar.rb", start_line: 8, stop_line: 12, body: "bar text") } - let(:parsed_messages) { QuietQuality::Messages.new(generate_messages(4) + [foo_message, bar_message]) } + let(:parsed_messages) { QuietQuality::Messages.new(other_messages + [foo_message, bar_message]) } let(:parser) { instance_double(QuietQuality::Tools::Rspec::Parser, messages: parsed_messages) } before { allow(QuietQuality::Tools::Rspec::Parser).to receive(:new).and_return(parser) } @@ -33,10 +34,19 @@ describe "#failure?" do subject(:failure?) { pipeline.failure? } - it { is_expected.to be_truthy } - context "when the runner succeeds" do - let(:runner_outcome) { build_success(tool_name, "fake output", "fake logging") } + context "when there are messages from the tool" do + let(:parsed_messages) { QuietQuality::Messages.new(other_messages + [foo_message, bar_message]) } + it { is_expected.to be_truthy } + + context "but they are all filtered" do + let(:parsed_messages) { QuietQuality::Messages.new(other_messages) } + it { is_expected.to be_falsey } + end + end + + context "when there are no messages from the tool" do + let(:parsed_messages) { empty_messages } it { is_expected.to be_falsey } end end