CODE site_layout_test.rb

require 'test_helper'

class SiteLayoutTest < ActionDispatch::IntegrationTest

   test "layout links" do
     get root_path
     assert_template 'static_pages/home'
     assert_select "a[href=?]", root_path, count: 2
     assert_select "a[href=?]", help_path
     assert_select "a[href=?]", about_path
     assert_select "a[href=?]", contact_path
   end
end



ERROR

This is what I see when I try to run the test :



FAIL["test_layout_links", SiteLayoutTest, 2015-05-19 22:21:27 +0530]
  test_layout_links#SiteLayoutTest (1432054287.74s)
         Expected exactly 2 elements matching "a[href="/"]", found 0..
         Expected: 2
           Actual: 0
         test/integration/site_layout_test.rb:8:in `block in
<class:SiteLayoutTest>'

   6/6: [===================================] 100% Time: 00:00:04, Time:
00:00:04

Finished in 4.45208s
6 tests, 11 assertions, 1 failures, 0 errors, 0 skips






What could be be the error ?

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/7f1eeb83a61a2800cad9a1c43932c24a%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Colin Law at May 21, 2015 at 7:09 am

    On 21 May 2015 at 00:56, Binu A. wrote:
    CODE site_layout_test.rb

    require 'test_helper'

    class SiteLayoutTest < ActionDispatch::IntegrationTest

    test "layout links" do
    get root_path
    assert_template 'static_pages/home'
    assert_select "a[href=?]", root_path, count: 2
    assert_select "a[href=?]", help_path
    assert_select "a[href=?]", about_path
    assert_select "a[href=?]", contact_path
    end
    end



    ERROR

    This is what I see when I try to run the test :



    FAIL["test_layout_links", SiteLayoutTest, 2015-05-19 22:21:27 +0530]
    test_layout_links#SiteLayoutTest (1432054287.74s)
    Expected exactly 2 elements matching "a[href="/"]", found 0..
    Expected: 2
    Actual: 0
    test/integration/site_layout_test.rb:8:in `block in
    <class:SiteLayoutTest>'

    6/6: [===================================] 100% Time: 00:00:04, Time:
    00:00:04

    Finished in 4.45208s
    6 tests, 11 assertions, 1 failures, 0 errors, 0 skips
    Do you see the two links to "/" when you go to the page in a browser?

    Colin

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvAf382MWvWn0g%2B-zzbFgVivgdWq7t0fogc3sQMzOsFzw%40mail.gmail.com.
    For more options, visit https://groups.google.com/d/optout.
  • Shijie Xin at Jun 3, 2015 at 2:16 am
    inside app/views/layouts please check these two files

      _header.html.erb
      _footer.html.erb

    add following code to both files

    <li><%= link_to "Home", root_path %></li>

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/7ba12a91ea19cdba86e871c71b9a4e84%40ruby-forum.com.
    For more options, visit https://groups.google.com/d/optout.
  • Binu A. at Jun 3, 2015 at 2:19 am

    Shijie Xin wrote in post #1174447:
    inside app/views/layouts please check these two files

    _header.html.erb
    _footer.html.erb

    add following code to both files

    <li><%= link_to "Home", root_path %></li>


    Thanks its working

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/9df188946c735d08ea118399bd1a2d7d%40ruby-forum.com.
    For more options, visit https://groups.google.com/d/optout.
  • Hernan Baranda at Jun 15, 2016 at 1:51 pm

    Shijie Xin wrote in post #1174447:
    inside app/views/layouts please check these two files

    _header.html.erb
    _footer.html.erb

    add following code to both files

    <li><%= link_to "Home", root_path %></li>
    thanks, it worked for me too

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/98e4ea2e22761e46069282c882753a0b%40ruby-forum.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedMay 20, '15 at 11:57p
activeJun 15, '16 at 1:51p
posts5
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

Hernan Baranda: 4 posts Colin Law: 1 post

People

Translate

site design / logo © 2021 Grokbase