Skip to content

Commit 4f793bb

Browse files
committed
Merge pull request #77 from abhirao/rails3
Added edit feature for questions
2 parents daef5b4 + 3934cb0 commit 4f793bb

3 files changed

Lines changed: 18 additions & 6 deletions

File tree

features/questions.feature

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,14 @@ Feature: CRUD actions for question
1919
And I should see "Created by test"
2020

2121
Scenario: Edit an existing question
22-
Given I have created a question
22+
Given I have created a question with title "My Title" and description "My Description"
23+
And I am on the questions index
24+
When I follow "Edit" within "table"
25+
And I fill in the following:
26+
| Title | My Edited Question|
27+
| Description | My Edited Description|
28+
And I press "Ask Everyone"
29+
Then I should see "Question was successfully updated."
30+
And I should see "My Edited Question" within ".title"
31+
And I should see "My Edited Description" within ".description"
32+
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
Given /^I have created a question$/ do
2-
pending
1+
Given /^I have created a question with title "([^"]*)" and description "([^"]*)"$/ do |title, description|
2+
@user.questions.build(:title => "#{title}", :description =>"#{description}").save!
33
end
44

55
Given /^there are existing questions$/ do
66
2.times{Fabricate(:question)}
7-
end
7+
end
8+

features/step_definitions/user_steps.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
end
44

55
Given /^I am a user with username "([^"]*)" and password "([^"]*)"$/ do |username, password|
6-
User.new(:username => username,
6+
@user = User.new(:username => username,
77
:email => "#{username}@example.com",
88
:password => password,
9-
:password_confirmation => password).save!
9+
:password_confirmation => password)
10+
@user.save!
1011
end
1112

1213
Then /^I should be already signed in$/ do

0 commit comments

Comments
 (0)