Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix execution_result to fit RSpec3 #305

Merged
merged 1 commit into from
Dec 14, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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