Skip to content

Commit f3bce7d

Browse files
committed
Consuming sass spec as a gem dependency needs these libs; fixed some errors and oversights.
1 parent 080f244 commit f3bce7d

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

lib/sass_spec/test.rb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,20 @@ def handle_expected_error_message!(test_case, options)
5454
interact(test_case, :fail) do |i|
5555
i.prompt(error_msg.nil? ? "An error message was expected but wasn't produced." :
5656
"Error output doesn't match what was expected.")
57+
58+
i.choice(:show_source, "Show me the input.") do
59+
display_text_block(File.read(test_case.input_path))
60+
i.restart!
61+
end
62+
5763
if error_msg.nil?
5864
i.choice(:show, "Show expected error.") do
5965
display_text_block(expected_error_msg)
6066
i.restart!
6167
end
6268
else
6369
i.choice(:show, "Show diff.") do
70+
require 'diffy'
6471
display_text_block(
6572
Diffy::Diff.new("Expected\n#{expected_error_msg}",
6673
"Actual\n#{error_msg}").to_s(:color))
@@ -110,7 +117,7 @@ def handle_unexpected_error_message!(test_case, options)
110117
i.prompt "Unexpected output to stderr"
111118

112119
i.choice(:show_source, "Show me the input.") do
113-
display_text_block(file.read(test_case.input_path))
120+
display_text_block(File.read(test_case.input_path))
114121
i.restart!
115122
end
116123

@@ -157,7 +164,7 @@ def handle_output_difference!(test_case, options)
157164
i.prompt "output does not match expectation"
158165

159166
i.choice(:show_source, "Show me the input.") do
160-
display_text_block(file.read(test_case.input_path))
167+
display_text_block(File.read(test_case.input_path))
161168
i.restart!
162169
end
163170

sass-spec.gemspec

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@ Gem::Specification.new do |spec|
2424
spec.require_paths = ["lib"]
2525

2626
spec.add_dependency "minitest", "~> 5.8"
27+
spec.add_dependency "command_line_reporter", '~> 3.0'
28+
spec.add_dependency "ruby-terminfo", '~> 0.1.1'
29+
spec.add_dependency "diffy", '~> 3.1'
30+
2731
spec.add_development_dependency "sass", "~> 3.4"
2832
spec.add_development_dependency "bundler", "~> 1.7"
2933
spec.add_development_dependency "rake", "~> 10.0"
30-
spec.add_development_dependency "command_line_reporter", '~> 3.0'
31-
spec.add_development_dependency "ruby-terminfo", '~> 0.1.1'
32-
spec.add_development_dependency "diffy", '~> 3.1'
3334
end

0 commit comments

Comments
 (0)