Add tests for InboxController
This commit is contained in:
parent
22289f2946
commit
78df5af040
|
@ -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
|
Loading…
Reference in New Issue