I am learning cucumber.
I have integrated the Devise with my rails 3 application.
My problem is I have to write a test which will create a project.
For that I have to make sure that user should be logged in. So I have
written the user login feature first which is working fine. After that I
have written the creation of project scenario. Whenever I am running
that scenario we are getting an error that user is not logged in and it
gets redirected to the login page.
My code is like this:-
"Feature: Manage List Of Projects
In order to keep track of Projects
User should be able to
Create a new project
Scenario: User logged in or not
Given user on login page
When user login with valid credentials
Then user should be on project list page
Scenario: Create New Project
When user create a project with name “Test”
Then user should see “Test” on project list page"
My Steps are as follows:-
Given /^user on (.+)$/ do |page_name|
When /^user login with valid credentials$/ do
fill_in(‘Email’, :with=>“[email protected]”)
Then /^user should be on project (.+)$/ do |page_name|
current_path = URI.parse(current_url).path
if current_path.respond_to? :should
current_path.should == path_to(page_name)
assert_equal path_to(page_name), current_path
When /^user create a project with name “([^”]*)"$/ do |project_name|
I know that I am missing something but as I am learner I am not able to
Can anyone tell me How can I solve this?
Please it is very urgent.