Skip to content

Commit 518d5c7

Browse files
committed
Add test for ERB template stacktraces
1 parent 8a13b6a commit 518d5c7

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

spec/actions/file_manipulation_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,18 @@ def file
211211
file = File.join(destination_root, "doc/config.yaml")
212212
expect(File.exist?(file)).to be true
213213
end
214+
215+
it "has proper ERB stacktraces" do
216+
error = nil
217+
begin
218+
action :template, "template/bad_config.yaml.tt"
219+
rescue => e
220+
error = e
221+
end
222+
223+
expect(error).to be_a NameError
224+
expect(error.backtrace.to_s).to include('bad_config.yaml.tt:2')
225+
end
214226
end
215227

216228
describe "when changing existent files" do
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--- Hi from yaml
2+
<%= unresolved_variable %>

0 commit comments

Comments
 (0)