diff --git a/fixtures/rspec/no_method_error_spec.rb b/fixtures/rspec/no_method_error_spec.rb new file mode 100644 index 0000000..c8c9689 --- /dev/null +++ b/fixtures/rspec/no_method_error_spec.rb @@ -0,0 +1,3 @@ +RSpec.describe "NoMethodError spec" do + it("fails") { expect(nil[:key]).to eql("value") } +end \ No newline at end of file diff --git a/spec/cli_spec.rb b/spec/cli_spec.rb index 443c6bf..6aae9b7 100644 --- a/spec/cli_spec.rb +++ b/spec/cli_spec.rb @@ -128,4 +128,21 @@ expect(output).to include("Test info in extra_failure_lines") end end + + describe "full error failure message and line" do + let(:fixture) { "./fixtures/rspec/no_method_error_spec.rb" } + + it "outputs file name and line number" do + expect($?.exitstatus).to eql(1) + + [ + "undefined method `[]' for nil:NilClass", + 'it("fails") { expect(nil[:key]).to eql("value") }', + "# #{fixture}:2:in `block (2 levels) in '", + "1 example, 1 failure", + ].each do |part| + expect(output).to include(part) + end + end + end end