Skip to content

Make SuperDiff respect extra_failure_lines metadata of RSpec #195

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

Closed
wants to merge 1 commit into from
Closed
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
5 changes: 4 additions & 1 deletion lib/super_diff/rspec/monkey_patches.rb
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,10 @@ def failure_line_groups
}
end
end

@failure_line_groups << {
lines: extra_failure_lines,
already_colorized: true
}
@failure_line_groups
end
end
Expand Down
21 changes: 21 additions & 0 deletions spec/integration/rspec/metadata_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
require "spec_helper"

RSpec.describe "Integration with RSpec metadata for extra failure lines",
type: :integration do
it "displays extra_failure_lines of metadata" do
as_both_colored_and_uncolored do |color_enabled|
program =
make_plain_test_program(<<~TEST, color_enabled: color_enabled, preserve_as_whole_file: true)
RSpec.describe "test" do
it { expect(true).to be(false) }

after do
RSpec.current_example.metadata[:extra_failure_lines] = "foo\nbar"
end
end
TEST

expect(program).to produce_output_when_run("foo\nbar").in_color(color_enabled)
end
end
end