-
Notifications
You must be signed in to change notification settings - Fork 98
Expand file tree
/
Copy pathanswer_steps.rb
More file actions
47 lines (39 loc) · 1.36 KB
/
answer_steps.rb
File metadata and controls
47 lines (39 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Given /^a question exists$/ do
login_user
create_question_for(@user)
end
Given /^I answer that question$/ do
visit new_question_answer_path(@question)
fill_in "Answer", with: "Have you tried turning it off and on again?"
click_button "Post Answer"
end
Then /^I should be notified that my answer was submitted$/ do
page.should have_content("Answer Posted")
end
Then /^I should be able to see my answer$/ do
page.should have_content("#{@user.username} says")
page.should have_content("Have you tried turning it off and on again?")
end
Then /^my answer should show on my profile page$/ do
visit user_path(@user)
page.should have_content(@question.title)
page.should have_content("Have you tried turning it off and on again?")
end
Then /^an email should be sent to the author$/ do
ActionMailer::Base.deliveries.should_not be_empty
end
When /^I edit that answer$/ do
visit question_path(@question)
page.find('.answer > .links').click_link('Edit')
fill_in 'Answer', with: 'Edit: Did you try magic?'
click_button 'Post Answer'
end
Then /^I should see the updated answer$/ do
page.should have_content("#{@user.username} says")
page.should have_content('Edit: Did you try magic?')
end
Then(/^I should see captcha$/) do
page.should have_css('.simple_captcha')
page.should have_css('.simple_captcha_image')
page.should have_css('.simple_captcha_field')
end