diff --git a/app/views/moderations/index.html.erb b/app/views/moderations/index.html.erb index f81291c4a..1846fc23f 100644 --- a/app/views/moderations/index.html.erb +++ b/app/views/moderations/index.html.erb @@ -31,12 +31,13 @@ <% else %>
-

<%= community_name %> Mods

+

<%= community_name %> Mods

We periodically award some <%= community_name %> members with heightened privileges to help moderate the community.

-

Email <%= email_link %> if you'd like to be considered right away.

+

Check out our <%= link_to "Code of Conduct", code_of_conduct_path %> and read through our <%= link_to "Trusted User Guide", community_moderation_path %> and <%= link_to "Tag Moderation Guide", tag_moderation_path %>.

+

If you'd like to assist us as a trusted user or tag mod, please email us at <%= mail_to email_link, email_link %> and let us know which role you're interested in and why. If it's tag moderation, please tell us what tags you'd like to moderate for.

<% unless user_signed_in? %> -

P.S. You are not currently signed in.

+

P.S. You are not currently signed in.

<% end %>
diff --git a/spec/requests/moderations_spec.rb b/spec/requests/moderations_spec.rb index 9425721f1..b6d5cf0e1 100644 --- a/spec/requests/moderations_spec.rb +++ b/spec/requests/moderations_spec.rb @@ -84,26 +84,26 @@ RSpec.describe "Moderations", type: :request do describe "actions_panel" do context "when the user is a tag moderator" do + let(:tag_mod) { create(:user, :tag_moderator) } + let(:tag) { tag_mod.roles.find_by(name: "tag_moderator").resource } + let(:article1) { create(:article, tags: tag) } + let(:article2) { create(:article, tags: "javascript, cool, beans") } + it "shows the option to remove the tag when the article has the tag" do - tag_mod = create(:user, :tag_moderator) tag_mod.add_role :trusted - tag = tag_mod.roles.find_by(name: "tag_moderator").resource - article = create(:article, tags: tag) sign_in tag_mod - get "#{article.path}/actions_panel" + get "#{article1.path}/actions_panel" expect(response.body).to include "circle centered-icon adjustment-icon subtract" end - end - it "shows the option to add the tag when the article has the tag" do - tag_mod = create(:user, :tag_moderator) - tag_mod.add_role :trusted - article = create(:article, tags: "javascript, cool, beans") - sign_in tag_mod + it "shows the option to add the tag when the article has the tag" do + tag_mod.add_role :trusted + sign_in tag_mod - get "#{article.path}/actions_panel" - expect(response.body).to include "circle centered-icon adjustment-icon plus" + get "#{article2.path}/actions_panel" + expect(response.body).to include "circle centered-icon adjustment-icon plus" + end end end @@ -123,10 +123,11 @@ RSpec.describe "Moderations", type: :request do end context "when the user is an admin" do + let(:admin) { create(:user, :admin) } + let(:article) { create(:article, tags: "javascript, cool, beans") } + before do - admin = create(:user, :admin) sign_in admin - article = create(:article, tags: "javascript, cool, beans") get "#{article.path}/actions_panel" end @@ -135,4 +136,40 @@ RSpec.describe "Moderations", type: :request do expect(response.body).to include "circle centered-icon adjustment-icon subtract" end end + + describe "/mod" do + let(:dev_name_copy) { "We periodically award some DEV members with heightened privileges" } + # rubocop:disable Layout/LineLength + let(:coc_guides_copy) do + 'Check out our Code of Conduct and read through our Trusted User Guide and Tag Moderation Guide.' + end + # rubocop:enable Layout/LineLength + let(:become_mod_copy) { "If you'd like to assist us as a trusted user or tag mod" } + let(:logged_out_copy) { "P.S. You are not currently signed in." } + let(:user) { create(:user) } + + before do + allow(SiteConfig).to receive(:community_name).and_return("DEV") + end + + context "when user logged in" do + it "indicates community name, codes of conduct/guides, and describes how to become a mod" do + sign_in user + get "/mod" + + expect(response.body).to include dev_name_copy + expect(response.body).to include coc_guides_copy + expect(response.body).to include become_mod_copy + expect(response.body).not_to include logged_out_copy + end + end + + context "when user logged out" do + it "warns that user is not signed in" do + get "/mod" + + expect(response.body).to include logged_out_copy + end + end + end end