diff --git a/features/questions.feature b/features/questions.feature index 83247a3d..876b8cab 100644 --- a/features/questions.feature +++ b/features/questions.feature @@ -19,4 +19,14 @@ Feature: CRUD actions for question And I should see "Created by test" Scenario: Edit an existing question - Given I have created a question \ No newline at end of file + Given I have created a question with title "My Title" and description "My Description" + And I am on the questions index + When I follow "Edit" within "table" + And I fill in the following: + | Title | My Edited Question| + | Description | My Edited Description| + And I press "Ask Everyone" + Then I should see "Question was successfully updated." + And I should see "My Edited Question" within ".title" + And I should see "My Edited Description" within ".description" + diff --git a/features/step_definitions/question_steps.rb b/features/step_definitions/question_steps.rb index d0461bdd..00d91e04 100644 --- a/features/step_definitions/question_steps.rb +++ b/features/step_definitions/question_steps.rb @@ -1,7 +1,8 @@ -Given /^I have created a question$/ do - pending +Given /^I have created a question with title "([^"]*)" and description "([^"]*)"$/ do |title, description| + @user.questions.build(:title => "#{title}", :description =>"#{description}").save! end Given /^there are existing questions$/ do 2.times{Fabricate(:question)} -end \ No newline at end of file +end + diff --git a/features/step_definitions/user_steps.rb b/features/step_definitions/user_steps.rb index 86682c34..791220ca 100644 --- a/features/step_definitions/user_steps.rb +++ b/features/step_definitions/user_steps.rb @@ -3,10 +3,11 @@ end Given /^I am a user with username "([^"]*)" and password "([^"]*)"$/ do |username, password| - User.new(:username => username, + @user = User.new(:username => username, :email => "#{username}@example.com", :password => password, - :password_confirmation => password).save! + :password_confirmation => password) + @user.save! end Then /^I should be already signed in$/ do