Sha256: 4f0f6b9a32c631906787dc3de7709003659f21a14ebf141d89748aae64756a11
Contents?: true
Size: 1.21 KB
Versions: 4
Compression:
Stored size: 1.21 KB
Contents
require File.expand_path("../../../spec_helper", __FILE__) describe Lono::Template do let(:template) do block = Proc.new {} template = Lono::Template.new("output_name.yml", block) # override the puts and printf methods within the test def template.messages @messages end def template.puts(msg) @messages ||= [] @messages << msg nil end def template.printf(*args) @messages ||= [] @messages << args end template end context "valid erb template" do it "should be able to lono generate" do template.erb_result("path", "template") end end context "invalid erb template" do it "should print out useful error message about undefined variable" do template.erb_result("path", "variable does not exist\n<% variable %>\nanother line") errors = template.messages.grep(/Error evaluating ERB template on line/) expect(errors).not_to be_empty end it "should print out useful error message about syntax error" do template.erb_result("path", "<%s dsfds ?%>\nanother line") errors = template.messages.grep(/Error evaluating ERB template on line/) expect(errors).not_to be_empty end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
lono-1.1.3 | spec/lib/lono/template_spec.rb |
lono-1.1.2 | spec/lib/lono/template_spec.rb |
lono-1.1.1 | spec/lib/lono/template_spec.rb |
lono-1.1.0 | spec/lib/lono/template_spec.rb |