mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-03-20 19:50:00 +01:00
Add tests for InboxController
This commit is contained in:
parent
22289f2946
commit
78df5af040
1 changed files with 32 additions and 0 deletions
32
spec/controllers/inbox_controller_spec.rb
Normal file
32
spec/controllers/inbox_controller_spec.rb
Normal 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
|
Loading…
Reference in a new issue