Move create test into a describe block

This commit is contained in:
Karina Kwiatek 2023-01-02 09:15:51 +01:00
parent 0f01177c67
commit f80d4ce935
1 changed files with 32 additions and 30 deletions

View File

@ -3,6 +3,9 @@
require "rails_helper" require "rails_helper"
describe ServicesController, type: :controller do describe ServicesController, type: :controller do
describe "#create" do
subject { get :create, params: { provider: "twitter" } }
context "successful Twitter sign in" do context "successful Twitter sign in" do
let(:user) { FactoryBot.create(:user) } let(:user) { FactoryBot.create(:user) }
@ -22,8 +25,6 @@ describe ServicesController, type: :controller do
OmniAuth.config.mock_auth[:twitter] = nil OmniAuth.config.mock_auth[:twitter] = nil
end end
subject { get :create, params: { provider: "twitter" } }
context "no services connected" do context "no services connected" do
it "creates a service integration" do it "creates a service integration" do
expect { subject }.to change { Service.count }.by(1) expect { subject }.to change { Service.count }.by(1)
@ -40,8 +41,9 @@ describe ServicesController, type: :controller do
end end
end end
end end
end
context "#update" do describe "#update" do
subject { patch :update, params: } subject { patch :update, params: }
context "not signed in" do context "not signed in" do