From 536b0ce3f52bd457e55df5fcf5e67ac637198e29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baz=C3=A1n?= Date: Thu, 24 Sep 2015 12:37:39 +0200 Subject: [PATCH] makes commenting commentable independent --- spec/support/common_actions.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/spec/support/common_actions.rb b/spec/support/common_actions.rb index 4e2dcdb18..d1a6bcdf6 100644 --- a/spec/support/common_actions.rb +++ b/spec/support/common_actions.rb @@ -44,13 +44,14 @@ module CommonActions click_button 'Send me reset password' end - def comment_on(debate, user = nil) + def comment_on(commentable, user = nil) user ||= create(:user) login_as(user) - visit debate_path(debate) + commentable_path = commentable.is_a?(Proposal) ? proposal_path(commentable) : debate_path(commentable) + visit commentable_path - fill_in "comment-body-debate_#{debate.id}", with: 'Have you thought about...?' + fill_in "comment-body-#{commentable.class.name.downcase}_#{commentable.id}", with: 'Have you thought about...?' click_button 'Publish comment' expect(page).to have_content 'Have you thought about...?'