Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion features/questions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
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"

7 changes: 4 additions & 3 deletions features/step_definitions/question_steps.rb
Original file line number Diff line number Diff line change
@@ -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
end

5 changes: 3 additions & 2 deletions features/step_definitions/user_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down