Skip to content

Commit

Permalink
Merge pull request #305 from uk-ar/fix-execution-result-in-rspec3
Browse files Browse the repository at this point in the history
Fix execution_result to fit RSpec3
  • Loading branch information
e2 committed Dec 14, 2014
2 parents 83a4a66 + dd7067f commit 76249c3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/guard/rspec_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ def _write(&block)

def _failed_paths
failed = examples.select do |e|
e.execution_result[:status].to_s == "failed"
if self.class.rspec_3?
e.execution_result.status.to_s == "failed"
else
e.execution_result[:status].to_s == "failed"
end
end

klass = self.class
Expand Down
11 changes: 11 additions & 0 deletions spec/lib/guard/rspec_formatter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
)
end

before do
allow(formatter.class).to receive(:rspec_3?).and_return(false)
end

def expected_output(spec_filename)
/^3 examples, 1 failures in 123\.0 seconds\n#{spec_filename}\n$/
end
Expand Down Expand Up @@ -81,6 +85,13 @@ def expected_output(spec_filename)
allow(formatter.class).to receive(:rspec_3?).and_return(true)
end

let(:failed_example) do
double(
execution_result: double(status: "failed"),
metadata: { location: spec_filename }
)
end

it "writes summary line and failed location" do
allow(formatter).to receive(:examples) { [failed_example] }
formatter.dump_summary(notification)
Expand Down

0 comments on commit 76249c3

Please sign in to comment.