retrospring/spec/controllers/moderation/inbox_controller_spec.rb
2022-06-23 22:17:14 +02:00

29 lines
747 B
Ruby

# 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) }
let!(:inboxes) { FactoryBot.create_list(:inbox, 60, user: target_user) }
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