Thank for response.
I getting error in application Git application with the error
Failures:
1) Page pages page creation with invalid information should not create a page
Failure/Error: before(:each) { visit new_admin_page_path }
NoMethodError:
undefined method `visit' for #<Page:0x00000005094bb0>
# ./spec/requests/page_request_spec.rb:13:in `block (3 levels) in <top (required)>'
2) Page pages page creation with invalid information error messages
Failure/Error: before(:each) { visit new_admin_page_path }
NoMethodError:
undefined method `visit' for #<Page:0x000000051671f0>
# ./spec/requests/page_request_spec.rb:13:in `block (3 levels) in <top (required)>'
Finished in 1.21 seconds
14 examples, 2 failures
What I’ve missed ?
I cloned your repository and ran the spec. The problem is that you are using the term
pagefor two different things, the Capybara page (subject { page }) and your model with the namePage(which you also namepage). Those two names conflict, which is why rspec is complaining that there is no methodvisitfor#<Page:0x00000005094bb0>.To solve this just rename the page you create in the initial
let:That will avoid the conflict by naming your page model
mypageinstead ofpage.There are other issues however. Your user factory does not use a sequence for assigning emails, so you get a validation error because it says the email is already taken.
I changed your user factory to this:
That fixes the validation error, but you now get another error. In the line in your first spec, you should be checking that
countdoes not change on the classPage, not the recordpage(ormypage).So change that to:
This will still leave you with errors, because you also do not have any
createaction for yourPagesController. From what you wrote, it seems like the information is invalid so it should not even get to this action. I don’t know exactly what you’re trying to do here so I’ll leave the rest for you to figure out.