From 17142d83ebb11677dfce9fc2e5e98b13fa999a97 Mon Sep 17 00:00:00 2001 From: Abhijeet Rao Date: Fri, 2 Sep 2011 00:39:38 -0500 Subject: [PATCH 1/3] index wasn't calling super --- app/controllers/questions_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/questions_controller.rb b/app/controllers/questions_controller.rb index a45f4d1d..dfbdc94b 100644 --- a/app/controllers/questions_controller.rb +++ b/app/controllers/questions_controller.rb @@ -2,6 +2,7 @@ class QuestionsController < InheritedController def index @question = Question.new + index! end def create From ebe7c3fbd04cd2c6b53b2fac7a136c53691b2735 Mon Sep 17 00:00:00 2001 From: Abhijeet Rao Date: Sun, 4 Sep 2011 20:28:10 -0500 Subject: [PATCH 2/3] Adding Question edit feature --- features/questions.feature | 13 ++++++++++++- features/step_definitions/question_steps.rb | 7 ++++--- features/step_definitions/user_steps.rb | 5 +++-- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/features/questions.feature b/features/questions.feature index 83247a3d..45e376d1 100644 --- a/features/questions.feature +++ b/features/questions.feature @@ -19,4 +19,15 @@ 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" + And I should be on question + 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 From 3934cb040fd9ca0ac83a517689d4f616175a26f2 Mon Sep 17 00:00:00 2001 From: Abhijeet Rao Date: Mon, 5 Sep 2011 19:32:13 -0500 Subject: [PATCH 3/3] No longer expecting edit to take you back to index --- features/questions.feature | 1 - 1 file changed, 1 deletion(-) diff --git a/features/questions.feature b/features/questions.feature index 45e376d1..876b8cab 100644 --- a/features/questions.feature +++ b/features/questions.feature @@ -29,5 +29,4 @@ Feature: CRUD actions for question 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" - And I should be on question