Showing posts with label Test Driven Development (TDD). Show all posts
Showing posts with label Test Driven Development (TDD). Show all posts
Tuesday, 25 June 2013
Michael Hartl tutorial Chapter 7. Error: " expected css "title" with text "Michael Hartl" to return something"
While passing the test for the show method of user, the test fail due to the following error.
Replace
Failures:This is because of the helper tag in "
1) User pages profile page
Failure/Error: it { should have_selector('title', text: user.name) }
expected css "title" with text "Michael Hartl" to return something
# ./spec/requests/user_pages_spec.rb:18:in `block (3 levels) in <top (required)>'
Finished in 2.22 seconds
33 examples, 1 failure
Failed examples:
rspec ./spec/requests/user_pages_spec.rb:18 # User pages profile page
app/views/users/show.html.erb
" Replace
<% provide(:title, @user.name) %>
with
<title><%= @user.name%></title>
Monday, 24 June 2013
Static pages should have the right links on the layout
While practising Michael Hartl's Rails tutorial, when I want to test the links. One test is failing with the following error message.
___________________
Useful Links :
Error: "Static pages should have the right links on the layout"
This can be fixed by putting "visit root_path" before click_link "Sign up now!"screen shot of the code is given below.
___________________
it "should have the right links on the layout" do____________________
visit root_path
click_link "About"
page.should have_selector 'title', text: full_title('About Us')
click_link "Help"
page.should # fill in
click_link "Contact"
page.should # fill in
click_link "Home"
visit root_path
click_link "Sign up now!"
page.should # fill in
click_link "sample app"
page.should # fill in
end
Useful Links :
- http://stackoverflow.com/questions/5361916/my-rspec-test-wont-pass-michael-hartls-rails-tutorial
- http://stackoverflow.com/questions/11732971/rails-link-to-not-found-by-capybara
- http://stackoverflow.com/questions/6701223/rail3-tutorial-testingchapter-5-click-link-error
- http://stackoverflow.com/questions/12242045/expected-css-title-hartls-tutorial-chapter-5-exercises
Subscribe to:
Posts (Atom)