Skip to content

Commit

Permalink
Move basic feed test for blocked users (forem#16165)
Browse files Browse the repository at this point in the history
  • Loading branch information
djuber authored Jan 18, 2022
1 parent 617d66c commit 97d62ba
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
10 changes: 0 additions & 10 deletions spec/services/articles/feeds/basic_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,5 @@
result = feed.feed
expect(result).not_to include(hot_story)
end

it "doesn't display blocked articles", type: :system, js: true do
selector = "article[data-content-user-id='#{hot_story.user_id}']"
sign_in user
visit root_path
expect(page).to have_selector(selector, visible: :visible)
create(:user_block, blocker: user, blocked: hot_story.user, config: "default")
visit root_path
expect(page).to have_selector(selector, visible: :hidden)
end
end
end
26 changes: 26 additions & 0 deletions spec/system/articles/feeds/basic_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
require "rails_helper"

RSpec.describe Articles::Feeds::Basic, type: :system, js: true do
let(:user) { create(:user) }
let(:hot_story) do
create(:article, hotness_score: 1000, score: 1000, published_at: 3.hours.ago)
end

before do
create(:article, hotness_score: 10)
end

context "with a user" do
let(:feed) { described_class.new(user: user, number_of_articles: 100, page: 1) }

it "doesn't display blocked articles", type: :system, js: true do
selector = "article[data-content-user-id='#{hot_story.user_id}']"
sign_in user
visit root_path
expect(page).to have_selector(selector, visible: :visible)
create(:user_block, blocker: user, blocked: hot_story.user, config: "default")
visit root_path
expect(page).to have_selector(selector, visible: :hidden)
end
end
end

0 comments on commit 97d62ba

Please sign in to comment.