How to check html tag with Rspec

Posted by Tetsu on Stack Overflow See other posts from Stack Overflow or by Tetsu
Published on 2013-11-10T15:27:30Z Indexed on 2013/11/10 15:54 UTC
Read the original article Hit count: 261

Filed under:
|
|

I'm learning from this site. I tested the following with rspec, and it passed.

  describe "About page" do
    it "should have the content 'About Us'" do
      visit '/static_pages/about'
      expect(page).to have_content('About Us')
    end
  end

I changed About Us to <h1>About Us</h1> to check whether it works as I expected, but the test fails even when about.html.erb has the string <h1>About Us</h1>. Could you show me how I can use html tag expression in rspec file?

© Stack Overflow or respective owner

Related posts about html

Related posts about ruby