Sha256: 16d971f1132ef5b534edb6fd34f7d1bcdb68cae289ffc38b403ee3d759092aae
Contents?: true
Size: 877 Bytes
Versions: 1
Compression:
Stored size: 877 Bytes
Contents
require 'spec_helper' class LineVerifier < StandardError def initialize super("raised at #{caller_locations(1, 1)[0].lineno}") end end module LineVerifierHelper extend RSpec::Matchers::DSL matcher :raised_at do |expected| match do |actual| actual == "raised at #{expected}" end end end RSpec.describe 'FastHaml::Compiler newline generation', type: :render do include LineVerifierHelper it do expect { render_string(<<HAML) }.to raise_error(LineVerifier, raised_at(3)) %div %span= 1 %span>= raise LineVerifier HAML end it do expect { render_string(<<HAML) }.to raise_error(LineVerifier, raised_at(2)) %img %img{href: raise(LineVerifier)}> %img HAML end it do expect { render_string(<<'HAML') }.to raise_error(LineVerifier, raised_at(3)) %div %span hello %span #{raise LineVerifier} %span world HAML end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fast_haml-0.1.3 | spec/compiler_newline_spec.rb |