Skip to content

Commit 88817f0

Browse files
alexchdshafik
authored andcommitted
clean up syntax error messages
1 parent 37078a8 commit 88817f0

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ end
99
RSpec::Core::RakeTask.new(:spec) do |t|
1010
t.pattern = "spec/**/*_spec.rb"
1111
t.rspec_opts =
12-
"--format d --backtrace"
12+
"--format d"
1313
t.rspec_opts += " --color" if !windows?
1414
# t.ruby_opts="-w"
1515
end

spec/site_syntax_spec.rb

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,26 @@ def app
1212
@app ||= InstallFest.new
1313
end
1414

15-
def get! *args
16-
get *args
17-
assert { last_response.status == 200 }
18-
end
19-
2015
['en', 'es'].each do |locale|
2116
describe "in locale '#{locale}'" do
2217
Site.all(locale).each do |site|
2318
describe "#{site.name} pages..." do
2419
site.docs.each do |doc|
2520
it "renders #{doc.filename}" do
26-
get! "/#{site.name}/#{doc.name}", locale: locale
27-
assert { last_response.ok? }
21+
path = "/#{site.name}/#{doc.name}"
22+
get path, locale: locale
23+
if (last_response.status != 200)
24+
errors = last_response.errors
25+
meaningful_errors = errors.each_line.select do |l|
26+
l.include? path or l !~ %r{^\t}
27+
end.join
28+
puts "#{path}: #{meaningful_errors}"
29+
fail("Syntax errors in #{path} -- see above")
30+
end
31+
32+
last_response_status = last_response.status
33+
assert { last_response_status == 200 }
34+
2835
if doc.filename.end_with?('.step')
2936
assert { last_response.body !~ /FUZZY/ }
3037
end

0 commit comments

Comments
 (0)