Failing Rspec tests in RT ch 9 for unknown reason
-
20-12-2019 - |
Question
I am currently stuck between 9.13 and 9.2. I copied the spec and controller files exactly from that section but am still having trouble passing the Rspec tests. Getting this error--is it common? I haven't found it posted on here.
Failures:
1) User_pages edit with valid information Failure/Error: it { should have_title(new_name) } expected #has_title?("New Name") to return true, got false # ./spec/requests/user_pages_spec.rb:47:in `block (4 levels) in '
2) User_pages edit with valid information Failure/Error: it { should have_selector('div.alert.alert-success') } expected #has_selector?("div.alert.alert-success") to return true, got false # ./spec/requests/user_pages_spec.rb:48:in `block (4 levels) in '
3) User_pages edit with valid information Failure/Error: specify { expect(user.reload.name).to eq new_name }
expected: "New Name"
got: "John Smith"
(compared using ==)
# ./spec/requests/user_pages_spec.rb:50:in `block (4 levels) in <top (required)>'
4) User_pages edit with valid information Failure/Error: specify { expect(user.reload.email).to eq new_email }
expected: "new@example.com"
got: "champion@aol.com"
(compared using ==)
# ./spec/requests/user_pages_spec.rb:51:in `block (4 levels) in <top (required)>'
Finished in 4.41 seconds 64 examples, 4 failures
Failed examples:
rspec ./spec/requests/user_pages_spec.rb:47 # User_pages edit with valid information rspec ./spec/requests/user_pages_spec.rb:48 # User_pages edit with valid information rspec ./spec/requests/user_pages_spec.rb:50 # User_pages edit with valid information rspec ./spec/requests/user_pages_spec.rb:51 # User_pages edit with valid information
I have posted some of my code here: https://gist.github.com/ephunit/8293106
Let me know if you would like to see another file perhaps?
PS all my spec tests were Green before 9.13. Any help is much appreciated.
Edit: Interesting...when I do a runthrough on the webpage, click Settings in the Webapp to Update the Profile, and try to save a new password, I get the following error: The form contains 1 error. * Password confirmation can't be blank
Even though I tried to put in a new password. Same error if I simply put in the original password. This could be why I am failing.
Solution
Spec_error
1) User_pages edit with valid information Failure/Error: it { should have_title(new_name) } expected #has_title?("New Name") to return true, got false # ./spec/requests/user_pages_spec.rb:47:in `block (4 levels) in '
this problem generally occurs when you do not put the {title: sign-up} like code at the top of your view/static-pages (for ex: title: about for about page). I don't know the exact piece of code but I was having the same problem and resolved with this solution.