Add tests for InboxController

This commit is contained in:
Andreas Nedbal 2022-11-17 22:07:10 +01:00 committed by Andreas Nedbal
parent 22289f2946
commit 78df5af040
1 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,32 @@
# frozen_string_literal: true
require "rails_helper"
describe InboxController, type: :controller do
let(:user) { FactoryBot.create(:user) }
describe "#show" do
subject { get :show }
context "when user is signed in" do
before(:each) { sign_in(user) }
it "shows the inbox" do
subject
expect(response).to render_template("show")
end
end
end
describe "#create" do
subject { post :create }
context "when user is signed in" do
before(:each) { sign_in(user) }
it "creates an inbox entry" do
expect { subject }.to(change { user.inboxes.count }.by(1))
end
end
end
end