Jakxna360
Jakxna360

Reputation: 905

Rails tutorial haml

I decided to change the ruby on rails tutorial from erb to haml. I am now experiencing this output:

     FAIL["test_should_get_home", StaticPagesControllerTest, 0.066385842]
     test_should_get_home#StaticPagesControllerTest (0.07s)
    <Home | Ruby on Rails Tutorial Sample App> expected but was
    <Home
    | Ruby on Rails Tutorial Sample App">..
    Expected 0 to be >= 1.
    test/controllers/static_pages_controller_test.rb:11:in `block in  <class:StaticPagesControllerTest>'

FAIL["test_should_get_about", StaticPagesControllerTest, 0.071358831]
test_should_get_about#StaticPagesControllerTest (0.07s)
    <About | Ruby on Rails Tutorial Sample App> expected but was
    <About
    | Ruby on Rails Tutorial Sample App">..
    Expected 0 to be >= 1.
    test/controllers/static_pages_controller_test.rb:23:in `block in <class:StaticPagesControllerTest>'

FAIL["test_should_get_contact", StaticPagesControllerTest, 0.07536422]
test_should_get_contact#StaticPagesControllerTest (0.08s)
    <Contact | Ruby on Rails Tutorial Sample App> expected but was
    <Contact
    | Ruby on Rails Tutorial Sample App">..
    Expected 0 to be >= 1.
    test/controllers/static_pages_controller_test.rb:29:in `block in <class:StaticPagesControllerTest>'

FAIL["test_should_get_help", StaticPagesControllerTest, 0.08334098]
test_should_get_help#StaticPagesControllerTest (0.08s)
    <Help | Ruby on Rails Tutorial Sample App> expected but was
    <Help
    | Ruby on Rails Tutorial Sample App">..
    Expected 0 to be >= 1.
       test/controllers/static_pages_controller_test.rb:17:in `block in    <class:StaticPagesControllerTest>'

Here's the application.rb file:

  %html
   %head
%meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
%title
  = yield(:title)
  | Ruby on Rails Tutorial Sample App
= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true
= javascript_include_tag 'application', 'data-turbolinks-track' => true
= csrf_meta_tags
%body
= yield

So the question is how do I make haml read this as one line during the test?

Thank you for your help in advance.

Upvotes: 2

Views: 395

Answers (1)

Mohammad AbuShady
Mohammad AbuShady

Reputation: 42909

To get the result you want, remove the line break from the HTML:

= "#{yield :title} | Ruby on Rails Tutorial Sample App"

Upvotes: 1

Related Questions