Skip to content

Commit

Permalink
Merge pull request #67 from nevinera/do-not-fail-if-all-messages-are-…
Browse files Browse the repository at this point in the history
…filtered

Do not fail if all messages are filtered
  • Loading branch information
nevinera authored May 24, 2023
2 parents bb4038d + 2685137 commit f018fd7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/quiet_quality/executors/pipeline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def outcome
end

def failure?
outcome.failure?
messages.any?
end

def messages
Expand Down
2 changes: 1 addition & 1 deletion lib/quiet_quality/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module QuietQuality
VERSION = "1.0.1"
VERSION = "1.0.2"
end
18 changes: 14 additions & 4 deletions spec/quiet_quality/executors/pipeline_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) }

Expand All @@ -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
Expand Down

0 comments on commit f018fd7

Please sign in to comment.