You probably want to use:
1. In the user_steps.rb file located in step_definitions:
Given /^a valid user$/ do @user = User.create!({ :email => " minikermit@hotmail.com ", :password => "12345678", :password_confirmation => "12345678" }) end Given /^a logged in user$/ do Given "a valid user" visit signin_url fill_in "Email", :with => " minikermit@hotmail.com " fill_in "Password", :with => "12345678" click_button "Sign in" end
In your authentication function:
Scenario: Login Given a valid user When I go to the login page And I fill in the following: |Email| minikermit@hotmail.com | |Password|12345678| And I press "Sign in" Then I should see "Signed in successfully."
Remember to change the path to your login page at support / paths.rb
when /the login page/ user_session_path
Here my path uses the default setting. You can use rake routes to find out your login.
You may need to change the text in βSign In,β βSigned Successfully,β to fit your page. My assumptions here are that you are using the default configuration for cucumber + capybara + devise.
source share