2022-06-19 15:59:47 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require "rails_helper"
|
|
|
|
|
|
|
|
describe Moderation::InboxController do
|
|
|
|
context "#index" do
|
|
|
|
subject { get :index, params: params }
|
|
|
|
|
|
|
|
let(:target_user) { FactoryBot.create(:user) }
|
2024-01-27 04:02:58 -08:00
|
|
|
let!(:inboxes) { FactoryBot.create_list(:inbox_entry, 60, user: target_user) }
|
2022-06-19 15:59:47 -07:00
|
|
|
let(:params) { { user: target_user.screen_name } }
|
|
|
|
|
|
|
|
context "moderator signed in" do
|
|
|
|
before do
|
|
|
|
sign_in(FactoryBot.create(:user, roles: [:moderator]))
|
|
|
|
end
|
|
|
|
|
|
|
|
it "renders the index template" do
|
|
|
|
subject
|
|
|
|
expect(response).to render_template(:index)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "assigns inbox entries" do
|
|
|
|
subject
|
|
|
|
expect(assigns(:inboxes).count).to eq(APP_CONFIG[:items_per_page])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|