From 118ae2d657c5861b66f3fa4cfb0b55b7a8342863 Mon Sep 17 00:00:00 2001 From: Florian Staudacher Date: Wed, 4 Apr 2012 15:23:39 +0200 Subject: [PATCH] refactored show-page comment cuke to be like normal comment cuke --- features/step_definitions/comment_steps.rb | 6 ++---- features/support/publishing_cuke_helpers.rb | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/features/step_definitions/comment_steps.rb b/features/step_definitions/comment_steps.rb index b2a207fc6..880f50b37 100644 --- a/features/step_definitions/comment_steps.rb +++ b/features/step_definitions/comment_steps.rb @@ -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 \ No newline at end of file + comment_on_show_page(comment_text) +end diff --git a/features/support/publishing_cuke_helpers.rb b/features/support/publishing_cuke_helpers.rb index 11043b1c0..d51b1159d 100644 --- a/features/support/publishing_cuke_helpers.rb +++ b/features/support/publishing_cuke_helpers.rb @@ -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)