|
1 |
| -require 'rspec/core/formatters/snippet_extractor' |
| 1 | +require 'rspec/core/formatters/html_snippet_extractor' |
2 | 2 |
|
3 | 3 | module RSpec
|
4 | 4 | module Core
|
5 | 5 | module Formatters
|
6 |
| - RSpec.describe SnippetExtractor do |
| 6 | + RSpec.describe HtmlSnippetExtractor do |
7 | 7 | it "falls back on a default message when it doesn't understand a line" do
|
8 |
| - expect(RSpec::Core::Formatters::SnippetExtractor.new.snippet_for("blech")).to eq(["# Couldn't get snippet for blech", 1]) |
| 8 | + expect(RSpec::Core::Formatters::HtmlSnippetExtractor.new.snippet_for("blech")).to eq(["# Couldn't get snippet for blech", 1]) |
9 | 9 | end
|
10 | 10 |
|
11 | 11 | it "falls back on a default message when it doesn't find the file" do
|
12 |
| - expect(RSpec::Core::Formatters::SnippetExtractor.new.lines_around("blech", 8)).to eq("# Couldn't get snippet for blech") |
| 12 | + expect(RSpec::Core::Formatters::HtmlSnippetExtractor.new.lines_around("blech", 8)).to eq("# Couldn't get snippet for blech") |
13 | 13 | end
|
14 | 14 |
|
15 | 15 | it "falls back on a default message when it gets a security error" do
|
16 | 16 | message = nil
|
17 | 17 | with_safe_set_to_level_that_triggers_security_errors do
|
18 |
| - message = RSpec::Core::Formatters::SnippetExtractor.new.lines_around("blech", 8) |
| 18 | + message = RSpec::Core::Formatters::HtmlSnippetExtractor.new.lines_around("blech", 8) |
19 | 19 | end
|
20 | 20 | expect(message).to eq("# Couldn't get snippet for blech")
|
21 | 21 | end
|
22 | 22 |
|
23 | 23 | describe "snippet extraction" do
|
24 | 24 | let(:snippet) do
|
25 |
| - SnippetExtractor.new.snippet(["#{__FILE__}:#{__LINE__}"]) |
| 25 | + HtmlSnippetExtractor.new.snippet(["#{__FILE__}:#{__LINE__}"]) |
26 | 26 | end
|
27 | 27 |
|
28 | 28 | before do
|
29 | 29 | # `send` is required for 1.8.7...
|
30 |
| - @orig_converter = SnippetExtractor.send(:class_variable_get, :@@converter) |
| 30 | + @orig_converter = HtmlSnippetExtractor.send(:class_variable_get, :@@converter) |
31 | 31 | end
|
32 | 32 |
|
33 | 33 | after do
|
34 |
| - SnippetExtractor.send(:class_variable_set, :@@converter, @orig_converter) |
| 34 | + HtmlSnippetExtractor.send(:class_variable_set, :@@converter, @orig_converter) |
35 | 35 | end
|
36 | 36 |
|
37 | 37 | it 'suggests you install coderay when it cannot be loaded' do
|
38 |
| - SnippetExtractor.send(:class_variable_set, :@@converter, SnippetExtractor::NullConverter) |
| 38 | + HtmlSnippetExtractor.send(:class_variable_set, :@@converter, HtmlSnippetExtractor::NullConverter) |
39 | 39 |
|
40 | 40 | expect(snippet).to include("Install the coderay gem")
|
41 | 41 | end
|
|
0 commit comments