I am trying to write RSpec in front of a filter for user login. I have a product controller. To view products, the user must be logged in. I added a login method to spec / support / utilities, for example:
def login(user)
post login_path, email: user.email, password: "password"
end
Then I called the method in the front filter in the spec / controller / products test:
before :each do
user = FactoryGirl.create(:user)
login(user)
end
When I run the test, I get the following error:
The action '/login' could not be found for ProductsController
I have a route for /login, and my user authentication is simple - just like Railscasts # 250 Authentication from Scratch . What am I missing?
Scott source
share