spec/macros4cuke/templating/engine_spec.rb in macros4cuke-0.3.42 vs spec/macros4cuke/templating/engine_spec.rb in macros4cuke-0.4.00

- old
+ new

@@ -19,28 +19,29 @@ And I fill in "Username" with "<userid>" And I fill in "Password" with "<password>" And I click "Sign in" SNIPPET - source - end + source + end # Template containing two conditional sections let(:sophisticated_template) do source = <<-SNIPPET When I fill in "firstname" with "<firstname>" And I fill in "lastname" with "<lastname>" + # Next line defines a comment <?address> And I fill in "address" with "<address>"</address> <?birthdate> And I fill in "birthdate" with "<birthdate>" </birthdate> <?dummy></dummy> And I click "Register" SNIPPET source - end + end # Rule for default instantiation subject { Engine.new sample_template } @@ -205,11 +206,12 @@ expect(names).to eq(%w(<?address> <?birthdate> <?dummy>)) end it 'should complain when a placeholder is empty or blank' do text_w_empty_arg = sample_template.sub(/userid/, '') - msg = %q(An empty or blank argument occurred in 'And I fill in "Username" with "<>"'.) + msg = 'An empty or blank argument occurred in ' + + %Q('And I fill in "Username" with "<>"'.) expect { Engine.new text_w_empty_arg }.to raise_error( Macros4Cuke::EmptyArgumentError, msg) end it 'should complain when a placeholder contains an invalid character' do @@ -238,11 +240,12 @@ end it 'should complain when a closing tag is found without opening tag' do # Replacing an end of section tag by another... wrong_end = sophisticated_template.sub(/<\?birthdate>/, '</foobar>') - msg = 'End of section</foobar> found while no corresponding section is open.' + msg = 'End of section</foobar> found' + + ' while no corresponding section is open.' expect { Engine.new wrong_end }.to raise_error(StandardError, msg) end end # context @@ -302,13 +305,14 @@ it 'should render conditional sections' do instance = Engine.new(sophisticated_template) - locals = { 'firstname' => 'Anon', + locals = { + 'firstname' => 'Anon', 'lastname' => 'Eemoos' , 'birthdate' => '1976-04-21' - } + } rendered_text = instance.render(Object.new, locals) expected = <<-SNIPPET When I fill in "firstname" with "Anon" And I fill in "lastname" with "Eemoos" And I fill in "birthdate" with "1976-04-21"