refactored show-page comment cuke to be like normal comment cuke

This commit is contained in:
Florian Staudacher 2012-04-04 15:23:39 +02:00
parent f86aab3fe2
commit 118ae2d657
2 changed files with 14 additions and 8 deletions

View file

@ -15,7 +15,5 @@ When /^I comment "([^"]*)" on "([^"]*)"$/ do |comment_text, post_text|
end
When /^I make a show page comment "([^"]*)"$/ do |comment_text|
find(".label.comment").click
fill_in "new-comment-text", :with => comment_text
click_button :submit
end
comment_on_show_page(comment_text)
end

View file

@ -70,13 +70,21 @@ module PublishingCukeHelpers
wait_for_ajax_to_finish
end
def make_comment(text)
fill_in "text", :with => text
def comment_on_show_page(comment_text)
within("#post-interactions") do
focus_comment_box(".label.comment")
make_comment(comment_text, "new-comment-text")
end
wait_for_ajax_to_finish
end
def make_comment(text, elem="text")
fill_in elem, :with => text
click_button :submit
end
def focus_comment_box
find("a.focus_comment_textarea").click
def focus_comment_box(elem="a.focus_comment_textarea")
find(elem).click
end
def wait_for_ajax_to_finish(wait_time=15)