Changes some test for moderation

This commit is contained in:
Alberto Garcia Cabeza
2015-08-25 16:02:36 +02:00
parent 8037a82fef
commit 8bdf03c50d
5 changed files with 38 additions and 38 deletions

View File

@@ -5,7 +5,7 @@
</a>
<ul id="drop-comment-flag-<%= comment.id %>" class="f-dropdown" data-dropdown-content aria-hidden="true" tabindex="-1">
<li>
<%= link_to t("shared.flag_as_inappropiate"), flag_as_inappropiate_comment_path(comment), method: :put, remote: true %>
<%= link_to t("shared.flag_as_inappropiate"), flag_as_inappropiate_comment_path(comment), method: :put, remote: true, title: t("shared.flag_as_inappropiate") %>
</li>
</ul>
<% end %>
@@ -17,7 +17,7 @@
</a>
<ul id="drop-comment-unflag-<%= comment.id %>" class="f-dropdown" data-dropdown-content aria-hidden="true" tabindex="-1">
<li>
<%= link_to t("shared.undo_flag_as_inappropiate"), undo_flag_as_inappropiate_comment_path(comment), method: :put, remote: true %>
<%= link_to t("shared.undo_flag_as_inappropiate"), undo_flag_as_inappropiate_comment_path(comment), method: :put, remote: true, title: t("shared.undo_flag_as_inappropiate") %>
</li>
</ul>
<% end %>

View File

@@ -134,7 +134,7 @@ en:
shared:
tags_cloud:
tags: Topics
flag_as_inappropiate: Flag as inappropiate
flag_as_inappropiate: Flag as inappropriate
undo_flag_as_inappropiate: Undo flag
collective: Collective
mailer:

View File

@@ -133,7 +133,7 @@ feature 'Comments' do
expect(page).to have_css(".comment.comment.comment.comment.comment.comment.comment.comment")
end
scenario "Flagging as inappropiate", :js do
scenario "Flagging as inappropriate", :js do
user = create(:user)
debate = create(:debate)
comment = create(:comment, commentable: debate)
@@ -142,15 +142,15 @@ feature 'Comments' do
visit debate_path(debate)
within "#comment_#{comment.id}" do
expect(page).to_not have_link "Undo flag as inappropiate"
click_on 'Flag as inappropiate'
expect(page).to have_link "Undo flag as inappropiate"
expect(page).to_not have_link "Undo flag as inappropriate"
click_on 'Flag as inappropriate'
expect(page).to have_link "Undo flag as inappropriate"
end
expect(InappropiateFlag.flagged?(user, comment)).to be
end
scenario "Undoing flagging as inappropiate", :js do
scenario "Undoing flagging as inappropriate", :js do
user = create(:user)
debate = create(:debate)
comment = create(:comment, commentable: debate)
@@ -160,9 +160,9 @@ feature 'Comments' do
visit debate_path(debate)
within "#comment_#{comment.id}" do
expect(page).to_not have_link("Flag as inappropiate", exact: true)
expect(page).to_not have_link("Flag as inappropriate", exact: true)
click_on 'Undo flag as inappropiate'
expect(page).to have_link("Flag as inappropiate", exact: true)
expect(page).to have_link("Flag as inappropriate", exact: true)
end
expect(InappropiateFlag.flagged?(user, comment)).to_not be

View File

@@ -104,43 +104,43 @@ feature 'Moderate Comments' do
visit moderation_comments_path
expect(page).to_not have_link('All')
expect(page).to have_link('Pending')
expect(page).to have_link('Reviewed')
expect(page).to have_link('Archived')
visit moderation_comments_path(filter: 'all')
expect(page).to_not have_link('All')
expect(page).to have_link('Pending')
expect(page).to have_link('Reviewed')
expect(page).to have_link('Archived')
visit moderation_comments_path(filter: 'pending_review')
expect(page).to have_link('All')
expect(page).to_not have_link('Pending')
expect(page).to have_link('Reviewed')
expect(page).to have_link('Archived')
visit moderation_comments_path(filter: 'reviewed')
visit moderation_comments_path(filter: 'archived')
expect(page).to have_link('All')
expect(page).to have_link('Pending')
expect(page).to_not have_link('Reviewed')
expect(page).to_not have_link('Archived')
end
scenario "Filtering comments" do
create(:comment, :flagged_as_inappropiate, body: "Pending comment")
create(:comment, :flagged_as_inappropiate, :hidden, body: "Hidden comment")
create(:comment, :flagged_as_inappropiate, :reviewed, body: "Reviewed comment")
create(:comment, :flagged_as_inappropiate, :reviewed, body: "Archived comment")
visit moderation_comments_path(filter: 'all')
expect(page).to have_content('Pending comment')
expect(page).to_not have_content('Hidden comment')
expect(page).to have_content('Reviewed comment')
expect(page).to have_content('Archived comment')
visit moderation_comments_path(filter: 'pending_review')
expect(page).to have_content('Pending comment')
expect(page).to_not have_content('Hidden comment')
expect(page).to_not have_content('Reviewed comment')
expect(page).to_not have_content('Archived comment')
visit moderation_comments_path(filter: 'reviewed')
visit moderation_comments_path(filter: 'archived')
expect(page).to_not have_content('Pending comment')
expect(page).to_not have_content('Hidden comment')
expect(page).to have_content('Reviewed comment')
expect(page).to have_content('Archived comment')
end
scenario "Reviewing links remember the pagination setting and the filter" do
@@ -149,7 +149,7 @@ feature 'Moderate Comments' do
visit moderation_comments_path(filter: 'pending_review', page: 2)
click_link('Mark as reviewed', match: :first)
click_link('Archive', match: :first)
uri = URI.parse(current_url)
query_params = Rack::Utils.parse_nested_query(uri.query).symbolize_keys
@@ -172,7 +172,7 @@ feature 'Moderate Comments' do
expect(page).to have_content('spammy spam')
expect(page).to have_content('1')
expect(page).to have_link('Hide')
expect(page).to have_link('Mark as reviewed')
expect(page).to have_link('Archive')
end
end
@@ -189,13 +189,13 @@ feature 'Moderate Comments' do
scenario 'Marking the comment as reviewed' do
within("#comment_#{@comment.id}") do
click_link('Mark as reviewed')
click_link('Archive')
end
expect(current_path).to eq(moderation_comments_path)
within("#comment_#{@comment.id}") do
expect(page).to have_content('Reviewed')
expect(page).to have_content('Archived')
end
expect(@comment.reload).to be_reviewed

View File

@@ -47,43 +47,43 @@ feature 'Moderate debates' do
visit moderation_debates_path
expect(page).to_not have_link('All')
expect(page).to have_link('Pending')
expect(page).to have_link('Reviewed')
expect(page).to have_link('Archived')
visit moderation_debates_path(filter: 'all')
expect(page).to_not have_link('All')
expect(page).to have_link('Pending')
expect(page).to have_link('Reviewed')
expect(page).to have_link('Archived')
visit moderation_debates_path(filter: 'pending_review')
expect(page).to have_link('All')
expect(page).to_not have_link('Pending')
expect(page).to have_link('Reviewed')
expect(page).to have_link('Archived')
visit moderation_debates_path(filter: 'reviewed')
visit moderation_debates_path(filter: 'archived')
expect(page).to have_link('All')
expect(page).to have_link('Pending')
expect(page).to_not have_link('Reviewed')
expect(page).to_not have_link('Archived')
end
scenario "Filtering debates" do
create(:debate, :flagged_as_inappropiate, title: "Pending debate")
create(:debate, :flagged_as_inappropiate, :hidden, title: "Hidden debate")
create(:debate, :flagged_as_inappropiate, :reviewed, title: "Reviewed debate")
create(:debate, :flagged_as_inappropiate, :reviewed, title: "Archived debate")
visit moderation_debates_path(filter: 'all')
expect(page).to have_content('Pending debate')
expect(page).to_not have_content('Hidden debate')
expect(page).to have_content('Reviewed debate')
expect(page).to have_content('Archived debate')
visit moderation_debates_path(filter: 'pending_review')
expect(page).to have_content('Pending debate')
expect(page).to_not have_content('Hidden debate')
expect(page).to_not have_content('Reviewed debate')
expect(page).to_not have_content('Archived debate')
visit moderation_debates_path(filter: 'reviewed')
visit moderation_debates_path(filter: 'archived')
expect(page).to_not have_content('Pending debate')
expect(page).to_not have_content('Hidden debate')
expect(page).to have_content('Reviewed debate')
expect(page).to have_content('Archived debate')
end
scenario "Reviewing links remember the pagination setting and the filter" do
@@ -92,7 +92,7 @@ feature 'Moderate debates' do
visit moderation_debates_path(filter: 'pending_review', page: 2)
click_link('Mark as reviewed', match: :first)
click_link('Archive', match: :first)
uri = URI.parse(current_url)
query_params = Rack::Utils.parse_nested_query(uri.query).symbolize_keys
@@ -114,7 +114,7 @@ feature 'Moderate debates' do
expect(page).to have_content('buy buy buy')
expect(page).to have_content('1')
expect(page).to have_link('Hide')
expect(page).to have_link('Mark as reviewed')
expect(page).to have_link('Archive')
end
end
@@ -131,13 +131,13 @@ feature 'Moderate debates' do
scenario 'Marking the debate as reviewed' do
within("#debate_#{@debate.id}") do
click_link('Mark as reviewed')
click_link('Archive')
end
expect(current_path).to eq(moderation_debates_path)
within("#debate_#{@debate.id}") do
expect(page).to have_content('Reviewed')
expect(page).to have_content('Archived')
end
expect(@debate.reload).to be_reviewed