diff --git a/spec/shared/system/notifiable_in_app.rb b/spec/shared/system/notifiable_in_app.rb index 4cbfdb394..afddae9d3 100644 --- a/spec/shared/system/notifiable_in_app.rb +++ b/spec/shared/system/notifiable_in_app.rb @@ -53,7 +53,7 @@ shared_examples "notifiable in-app" do |factory_name| click_link "Reply" within "#js-comment-form-comment_#{comment.id}" do - fill_in "comment-body-comment_#{comment.id}", with: "I replied to your comment" + fill_in comment_body(notifiable), with: "I replied to your comment" click_button "Publish reply" end @@ -79,7 +79,7 @@ shared_examples "notifiable in-app" do |factory_name| within("#comment_#{comment.id}_reply") { click_link "Reply" } within "#js-comment-form-comment_#{comment.id}" do - fill_in "comment-body-comment_#{comment.id}", with: "Reply number #{n}" + fill_in comment_body(notifiable), with: "Reply number #{n}" click_button "Publish reply" end @@ -121,7 +121,7 @@ shared_examples "notifiable in-app" do |factory_name| click_link "Reply" within "#js-comment-form-comment_#{comment.id}" do - fill_in "comment-body-comment_#{comment.id}", with: "I replied to my own comment" + fill_in comment_body(notifiable), with: "I replied to my own comment" click_button "Publish reply" end diff --git a/spec/support/common_actions/comments.rb b/spec/support/common_actions/comments.rb index 1c8a60b7c..a53c17cd9 100644 --- a/spec/support/common_actions/comments.rb +++ b/spec/support/common_actions/comments.rb @@ -17,7 +17,7 @@ module Comments click_link "Reply" within "#js-comment-form-comment_#{comment.id}" do - fill_in "comment-body-comment_#{comment.id}", with: "It will be done next week." + fill_in "Leave your comment", with: "It will be done next week." click_button "Publish reply" end expect(page).to have_content "It will be done next week." diff --git a/spec/support/common_actions/notifications.rb b/spec/support/common_actions/notifications.rb index 60f1673aa..569010555 100644 --- a/spec/support/common_actions/notifications.rb +++ b/spec/support/common_actions/notifications.rb @@ -10,7 +10,11 @@ module Notifications end def comment_body(resource) - "comment-body-#{resource.class.name.parameterize(separator: "_").to_sym}_#{resource.id}" + if resource.class.name == "Legislation::Question" + "Leave your answer" + else + "Leave your comment" + end end def submit_comment_text(resource) diff --git a/spec/system/comments/budget_investments_spec.rb b/spec/system/comments/budget_investments_spec.rb index 3c922aee7..7364c4698 100644 --- a/spec/system/comments/budget_investments_spec.rb +++ b/spec/system/comments/budget_investments_spec.rb @@ -199,7 +199,7 @@ describe "Commenting Budget::Investments" do login_as(user) visit budget_investment_path(investment.budget, investment) - fill_in "comment-body-budget_investment_#{investment.id}", with: "Have you thought about...?" + fill_in "Leave your comment", with: "Have you thought about...?" click_button "Publish comment" within "#tab-comments-label" do @@ -231,7 +231,7 @@ describe "Commenting Budget::Investments" do click_link "Reply" within "#js-comment-form-comment_#{comment.id}" do - fill_in "comment-body-comment_#{comment.id}", with: "It will be done next week." + fill_in "Leave your comment", with: "It will be done next week." click_button "Publish reply" end @@ -334,7 +334,7 @@ describe "Commenting Budget::Investments" do login_as(moderator.user) visit budget_investment_path(investment.budget, investment) - fill_in "comment-body-budget_investment_#{investment.id}", with: "I am moderating!" + fill_in "Leave your comment", with: "I am moderating!" check "comment-as-moderator-budget_investment_#{investment.id}" click_button "Publish comment" @@ -358,7 +358,7 @@ describe "Commenting Budget::Investments" do click_link "Reply" within "#js-comment-form-comment_#{comment.id}" do - fill_in "comment-body-comment_#{comment.id}", with: "I am moderating!" + fill_in "Leave your comment", with: "I am moderating!" check "comment-as-moderator-comment_#{comment.id}" click_button "Publish reply" end @@ -391,7 +391,7 @@ describe "Commenting Budget::Investments" do login_as(admin.user) visit budget_investment_path(investment.budget, investment) - fill_in "comment-body-budget_investment_#{investment.id}", with: "I am your Admin!" + fill_in "Leave your comment", with: "I am your Admin!" check "comment-as-administrator-budget_investment_#{investment.id}" click_button "Publish comment" @@ -410,7 +410,7 @@ describe "Commenting Budget::Investments" do visit admin_budget_budget_investment_path(investment.budget, investment) - fill_in "comment-body-budget_investment_#{investment.id}", with: "I am your Admin!" + fill_in "Leave your comment", with: "I am your Admin!" check "comment-as-administrator-budget_investment_#{investment.id}" click_button "Publish comment" @@ -434,7 +434,7 @@ describe "Commenting Budget::Investments" do login_as(admin.user) visit admin_budget_budget_investment_path(investment.budget, investment) - fill_in "comment-body-budget_investment_#{investment.id}", with: "I am your Admin!" + fill_in "Leave your comment", with: "I am your Admin!" check "comment-as-administrator-budget_investment_#{investment.id}" click_button "Publish comment" @@ -458,7 +458,7 @@ describe "Commenting Budget::Investments" do click_link "Reply" within "#js-comment-form-comment_#{comment.id}" do - fill_in "comment-body-comment_#{comment.id}", with: "Top of the world!" + fill_in "Leave your comment", with: "Top of the world!" check "comment-as-administrator-comment_#{comment.id}" click_button "Publish reply" end diff --git a/spec/system/comments/debates_spec.rb b/spec/system/comments/debates_spec.rb index b9943c10c..2b8bbc3e8 100644 --- a/spec/system/comments/debates_spec.rb +++ b/spec/system/comments/debates_spec.rb @@ -216,7 +216,7 @@ describe "Commenting debates" do login_as(user) visit debate_path(debate) - fill_in "comment-body-debate_#{debate.id}", with: "Have you thought about...?" + fill_in "Leave your comment", with: "Have you thought about...?" click_button "Publish comment" within "#comments" do @@ -245,7 +245,7 @@ describe "Commenting debates" do click_link "Reply" within "#js-comment-form-comment_#{comment.id}" do - fill_in "comment-body-comment_#{comment.id}", with: "It will be done next week." + fill_in "Leave your comment", with: "It will be done next week." click_button "Publish reply" end @@ -371,7 +371,7 @@ describe "Commenting debates" do login_as(user) visit debate_path(debate) - fill_in "comment-body-debate_#{debate.id}", with: "Testing submit button!" + fill_in "Leave your comment", with: "Testing submit button!" click_button "Publish comment" # The button"s text should now be "..." @@ -388,7 +388,7 @@ describe "Commenting debates" do login_as(moderator.user) visit debate_path(debate) - fill_in "comment-body-debate_#{debate.id}", with: "I am moderating!" + fill_in "Leave your comment", with: "I am moderating!" check "comment-as-moderator-debate_#{debate.id}" click_button "Publish comment" @@ -412,7 +412,7 @@ describe "Commenting debates" do click_link "Reply" within "#js-comment-form-comment_#{comment.id}" do - fill_in "comment-body-comment_#{comment.id}", with: "I am moderating!" + fill_in "Leave your comment", with: "I am moderating!" check "comment-as-moderator-comment_#{comment.id}" click_button "Publish reply" end @@ -444,7 +444,7 @@ describe "Commenting debates" do login_as(admin.user) visit debate_path(debate) - fill_in "comment-body-debate_#{debate.id}", with: "I am your Admin!" + fill_in "Leave your comment", with: "I am your Admin!" check "comment-as-administrator-debate_#{debate.id}" click_button "Publish comment" @@ -468,7 +468,7 @@ describe "Commenting debates" do click_link "Reply" within "#js-comment-form-comment_#{comment.id}" do - fill_in "comment-body-comment_#{comment.id}", with: "Top of the world!" + fill_in "Leave your comment", with: "Top of the world!" check "comment-as-administrator-comment_#{comment.id}" click_button "Publish reply" end diff --git a/spec/system/comments/legislation_annotations_spec.rb b/spec/system/comments/legislation_annotations_spec.rb index 0ed8ef015..bb1788660 100644 --- a/spec/system/comments/legislation_annotations_spec.rb +++ b/spec/system/comments/legislation_annotations_spec.rb @@ -233,7 +233,7 @@ describe "Commenting legislation questions" do legislation_annotation.draft_version, legislation_annotation) - fill_in "comment-body-legislation_annotation_#{legislation_annotation.id}", with: "Have you thought about...?" + fill_in "Leave your comment", with: "Have you thought about...?" click_button "Publish comment" within "#comments" do @@ -267,7 +267,7 @@ describe "Commenting legislation questions" do click_link "Reply" within "#js-comment-form-comment_#{comment.id}" do - fill_in "comment-body-comment_#{comment.id}", with: "It will be done next week." + fill_in "Leave your comment", with: "It will be done next week." click_button "Publish reply" end @@ -384,7 +384,7 @@ describe "Commenting legislation questions" do legislation_annotation.draft_version, legislation_annotation) - fill_in "comment-body-legislation_annotation_#{legislation_annotation.id}", with: "Testing submit button!" + fill_in "Leave your comment", with: "Testing submit button!" click_button "Publish comment" # The button's text should now be "..." @@ -403,7 +403,7 @@ describe "Commenting legislation questions" do legislation_annotation.draft_version, legislation_annotation) - fill_in "comment-body-legislation_annotation_#{legislation_annotation.id}", with: "I am moderating!" + fill_in "Leave your comment", with: "I am moderating!" check "comment-as-moderator-legislation_annotation_#{legislation_annotation.id}" click_button "Publish comment" @@ -430,7 +430,7 @@ describe "Commenting legislation questions" do click_link "Reply" within "#js-comment-form-comment_#{comment.id}" do - fill_in "comment-body-comment_#{comment.id}", with: "I am moderating!" + fill_in "Leave your comment", with: "I am moderating!" check "comment-as-moderator-comment_#{comment.id}" click_button "Publish reply" end @@ -466,7 +466,7 @@ describe "Commenting legislation questions" do legislation_annotation.draft_version, legislation_annotation) - fill_in "comment-body-legislation_annotation_#{legislation_annotation.id}", with: "I am your Admin!" + fill_in "Leave your comment", with: "I am your Admin!" check "comment-as-administrator-legislation_annotation_#{legislation_annotation.id}" click_button "Publish comment" @@ -493,7 +493,7 @@ describe "Commenting legislation questions" do click_link "Reply" within "#js-comment-form-comment_#{comment.id}" do - fill_in "comment-body-comment_#{comment.id}", with: "Top of the world!" + fill_in "Leave your comment", with: "Top of the world!" check "comment-as-administrator-comment_#{comment.id}" click_button "Publish reply" end @@ -667,7 +667,7 @@ describe "Commenting legislation questions" do click_link "Reply" within "#js-comment-form-comment_#{comment.id}" do - fill_in "comment-body-comment_#{comment.id}", with: "replying in single annotation thread" + fill_in "Leave your comment", with: "replying in single annotation thread" click_button "Publish reply" end @@ -706,7 +706,7 @@ describe "Commenting legislation questions" do end within "#js-comment-form-comment_#{comment.id}" do - fill_in "comment-body-comment_#{comment.id}", with: "replying in multiple annotation thread" + fill_in "Leave your comment", with: "replying in multiple annotation thread" click_button "Publish reply" end diff --git a/spec/system/comments/legislation_questions_spec.rb b/spec/system/comments/legislation_questions_spec.rb index 368c56190..87167555f 100644 --- a/spec/system/comments/legislation_questions_spec.rb +++ b/spec/system/comments/legislation_questions_spec.rb @@ -202,7 +202,7 @@ describe "Commenting legislation questions" do login_as(user) visit legislation_process_question_path(legislation_question.process, legislation_question) - fill_in "comment-body-legislation_question_#{legislation_question.id}", with: "Have you thought about...?" + fill_in "Leave your answer", with: "Have you thought about...?" click_button "Publish answer" within "#comments" do @@ -249,7 +249,7 @@ describe "Commenting legislation questions" do click_link "Reply" within "#js-comment-form-comment_#{comment.id}" do - fill_in "comment-body-comment_#{comment.id}", with: "It will be done next week." + fill_in "Leave your answer", with: "It will be done next week." click_button "Publish reply" end @@ -348,7 +348,7 @@ describe "Commenting legislation questions" do login_as(user) visit legislation_process_question_path(legislation_question.process, legislation_question) - fill_in "comment-body-legislation_question_#{legislation_question.id}", with: "Testing submit button!" + fill_in "Leave your answer", with: "Testing submit button!" click_button "Publish answer" # The button's text should now be "..." @@ -365,7 +365,7 @@ describe "Commenting legislation questions" do login_as(moderator.user) visit legislation_process_question_path(legislation_question.process, legislation_question) - fill_in "comment-body-legislation_question_#{legislation_question.id}", with: "I am moderating!" + fill_in "Leave your answer", with: "I am moderating!" check "comment-as-moderator-legislation_question_#{legislation_question.id}" click_button "Publish answer" @@ -389,7 +389,7 @@ describe "Commenting legislation questions" do click_link "Reply" within "#js-comment-form-comment_#{comment.id}" do - fill_in "comment-body-comment_#{comment.id}", with: "I am moderating!" + fill_in "Leave your answer", with: "I am moderating!" check "comment-as-moderator-comment_#{comment.id}" click_button "Publish reply" end @@ -421,7 +421,7 @@ describe "Commenting legislation questions" do login_as(admin.user) visit legislation_process_question_path(legislation_question.process, legislation_question) - fill_in "comment-body-legislation_question_#{legislation_question.id}", with: "I am your Admin!" + fill_in "Leave your answer", with: "I am your Admin!" check "comment-as-administrator-legislation_question_#{legislation_question.id}" click_button "Publish answer" @@ -445,7 +445,7 @@ describe "Commenting legislation questions" do click_link "Reply" within "#js-comment-form-comment_#{comment.id}" do - fill_in "comment-body-comment_#{comment.id}", with: "Top of the world!" + fill_in "Leave your answer", with: "Top of the world!" check "comment-as-administrator-comment_#{comment.id}" click_button "Publish reply" end diff --git a/spec/system/comments/polls_spec.rb b/spec/system/comments/polls_spec.rb index 65fd9af57..298e8cb1f 100644 --- a/spec/system/comments/polls_spec.rb +++ b/spec/system/comments/polls_spec.rb @@ -197,7 +197,7 @@ describe "Commenting polls" do login_as(user) visit poll_path(poll) - fill_in "comment-body-poll_#{poll.id}", with: "Have you thought about...?" + fill_in "Leave your comment", with: "Have you thought about...?" click_button "Publish comment" within "#comments" do @@ -229,7 +229,7 @@ describe "Commenting polls" do click_link "Reply" within "#js-comment-form-comment_#{comment.id}" do - fill_in "comment-body-comment_#{comment.id}", with: "It will be done next week." + fill_in "Leave your comment", with: "It will be done next week." click_button "Publish reply" end @@ -340,7 +340,7 @@ describe "Commenting polls" do login_as(moderator.user) visit poll_path(poll) - fill_in "comment-body-poll_#{poll.id}", with: "I am moderating!" + fill_in "Leave your comment", with: "I am moderating!" check "comment-as-moderator-poll_#{poll.id}" click_button "Publish comment" @@ -366,7 +366,7 @@ describe "Commenting polls" do click_link "Reply" within "#js-comment-form-comment_#{comment.id}" do - fill_in "comment-body-comment_#{comment.id}", with: "I am moderating!" + fill_in "Leave your comment", with: "I am moderating!" check "comment-as-moderator-comment_#{comment.id}" click_button "Publish reply" end @@ -402,7 +402,7 @@ describe "Commenting polls" do login_as(admin.user) visit poll_path(poll) - fill_in "comment-body-poll_#{poll.id}", with: "I am your Admin!" + fill_in "Leave your comment", with: "I am your Admin!" check "comment-as-administrator-poll_#{poll.id}" click_button "Publish comment" @@ -428,7 +428,7 @@ describe "Commenting polls" do click_link "Reply" within "#js-comment-form-comment_#{comment.id}" do - fill_in "comment-body-comment_#{comment.id}", with: "Top of the world!" + fill_in "Leave your comment", with: "Top of the world!" check "comment-as-administrator-comment_#{comment.id}" click_button "Publish reply" end diff --git a/spec/system/comments/proposals_spec.rb b/spec/system/comments/proposals_spec.rb index 919e59a06..d23aad2b4 100644 --- a/spec/system/comments/proposals_spec.rb +++ b/spec/system/comments/proposals_spec.rb @@ -195,7 +195,7 @@ describe "Commenting proposals" do login_as(user) visit proposal_path(proposal) - fill_in "comment-body-proposal_#{proposal.id}", with: "Have you thought about...?" + fill_in "Leave your comment", with: "Have you thought about...?" click_button "Publish comment" within "#comments" do @@ -227,7 +227,7 @@ describe "Commenting proposals" do click_link "Reply" within "#js-comment-form-comment_#{comment.id}" do - fill_in "comment-body-comment_#{comment.id}", with: "It will be done next week." + fill_in "Leave your comment", with: "It will be done next week." click_button "Publish reply" end @@ -330,7 +330,7 @@ describe "Commenting proposals" do login_as(moderator.user) visit proposal_path(proposal) - fill_in "comment-body-proposal_#{proposal.id}", with: "I am moderating!" + fill_in "Leave your comment", with: "I am moderating!" check "comment-as-moderator-proposal_#{proposal.id}" click_button "Publish comment" @@ -354,7 +354,7 @@ describe "Commenting proposals" do click_link "Reply" within "#js-comment-form-comment_#{comment.id}" do - fill_in "comment-body-comment_#{comment.id}", with: "I am moderating!" + fill_in "Leave your comment", with: "I am moderating!" check "comment-as-moderator-comment_#{comment.id}" click_button "Publish reply" end @@ -386,7 +386,7 @@ describe "Commenting proposals" do login_as(admin.user) visit proposal_path(proposal) - fill_in "comment-body-proposal_#{proposal.id}", with: "I am your Admin!" + fill_in "Leave your comment", with: "I am your Admin!" check "comment-as-administrator-proposal_#{proposal.id}" click_button "Publish comment" @@ -410,7 +410,7 @@ describe "Commenting proposals" do click_link "Reply" within "#js-comment-form-comment_#{comment.id}" do - fill_in "comment-body-comment_#{comment.id}", with: "Top of the world!" + fill_in "Leave your comment", with: "Top of the world!" check "comment-as-administrator-comment_#{comment.id}" click_button "Publish reply" end diff --git a/spec/system/comments/topics_spec.rb b/spec/system/comments/topics_spec.rb index 4d5d48d46..a00698047 100644 --- a/spec/system/comments/topics_spec.rb +++ b/spec/system/comments/topics_spec.rb @@ -216,7 +216,7 @@ describe "Commenting topics from proposals" do login_as(user) visit community_topic_path(community, topic) - fill_in "comment-body-topic_#{topic.id}", with: "Have you thought about...?" + fill_in "Leave your comment", with: "Have you thought about...?" click_button "Publish comment" within "#comments" do @@ -253,7 +253,7 @@ describe "Commenting topics from proposals" do click_link "Reply" within "#js-comment-form-comment_#{comment.id}" do - fill_in "comment-body-comment_#{comment.id}", with: "It will be done next week." + fill_in "Leave your comment", with: "It will be done next week." click_button "Publish reply" end @@ -369,7 +369,7 @@ describe "Commenting topics from proposals" do login_as(moderator.user) visit community_topic_path(community, topic) - fill_in "comment-body-topic_#{topic.id}", with: "I am moderating!" + fill_in "Leave your comment", with: "I am moderating!" check "comment-as-moderator-topic_#{topic.id}" click_button "Publish comment" @@ -395,7 +395,7 @@ describe "Commenting topics from proposals" do click_link "Reply" within "#js-comment-form-comment_#{comment.id}" do - fill_in "comment-body-comment_#{comment.id}", with: "I am moderating!" + fill_in "Leave your comment", with: "I am moderating!" check "comment-as-moderator-comment_#{comment.id}" click_button "Publish reply" end @@ -431,7 +431,7 @@ describe "Commenting topics from proposals" do login_as(admin.user) visit community_topic_path(community, topic) - fill_in "comment-body-topic_#{topic.id}", with: "I am your Admin!" + fill_in "Leave your comment", with: "I am your Admin!" check "comment-as-administrator-topic_#{topic.id}" click_button "Publish comment" @@ -457,7 +457,7 @@ describe "Commenting topics from proposals" do click_link "Reply" within "#js-comment-form-comment_#{comment.id}" do - fill_in "comment-body-comment_#{comment.id}", with: "Top of the world!" + fill_in "Leave your comment", with: "Top of the world!" check "comment-as-administrator-comment_#{comment.id}" click_button "Publish reply" end @@ -776,7 +776,7 @@ describe "Commenting topics from budget investments" do login_as(user) visit community_topic_path(community, topic) - fill_in "comment-body-topic_#{topic.id}", with: "Have you thought about...?" + fill_in "Leave your comment", with: "Have you thought about...?" click_button "Publish comment" within "#comments" do @@ -813,7 +813,7 @@ describe "Commenting topics from budget investments" do click_link "Reply" within "#js-comment-form-comment_#{comment.id}" do - fill_in "comment-body-comment_#{comment.id}", with: "It will be done next week." + fill_in "Leave your comment", with: "It will be done next week." click_button "Publish reply" end @@ -929,7 +929,7 @@ describe "Commenting topics from budget investments" do login_as(moderator.user) visit community_topic_path(community, topic) - fill_in "comment-body-topic_#{topic.id}", with: "I am moderating!" + fill_in "Leave your comment", with: "I am moderating!" check "comment-as-moderator-topic_#{topic.id}" click_button "Publish comment" @@ -955,7 +955,7 @@ describe "Commenting topics from budget investments" do click_link "Reply" within "#js-comment-form-comment_#{comment.id}" do - fill_in "comment-body-comment_#{comment.id}", with: "I am moderating!" + fill_in "Leave your comment", with: "I am moderating!" check "comment-as-moderator-comment_#{comment.id}" click_button "Publish reply" end @@ -991,7 +991,7 @@ describe "Commenting topics from budget investments" do login_as(admin.user) visit community_topic_path(community, topic) - fill_in "comment-body-topic_#{topic.id}", with: "I am your Admin!" + fill_in "Leave your comment", with: "I am your Admin!" check "comment-as-administrator-topic_#{topic.id}" click_button "Publish comment" @@ -1017,7 +1017,7 @@ describe "Commenting topics from budget investments" do click_link "Reply" within "#js-comment-form-comment_#{comment.id}" do - fill_in "comment-body-comment_#{comment.id}", with: "Top of the world!" + fill_in "Leave your comment", with: "Top of the world!" check "comment-as-administrator-comment_#{comment.id}" click_button "Publish reply" end diff --git a/spec/system/emails_spec.rb b/spec/system/emails_spec.rb index 7b23eea21..345cc33cc 100644 --- a/spec/system/emails_spec.rb +++ b/spec/system/emails_spec.rb @@ -443,7 +443,7 @@ describe "Emails" do click_link "Reply" within "#js-comment-form-comment_#{comment.id}" do - fill_in "comment-body-comment_#{comment.id}", with: "It will be done next week." + fill_in "Leave your comment", with: "It will be done next week." click_button "Publish reply" end