require "rails_helper" RSpec.describe AccountSessionsController, type: :controller do let(:second_account) { create(:account) } let(:current_user) { create(:user) } before do AccountAuth.create(user: current_user, account: second_account, role: :account_manager) sign_in current_user end describe "#update" do it "responds successfully" do post :update, params: { account_session: account_sessions_params(second_account) } expect(response).to redirect_to signed_in_root_path end end private def account_sessions_params(account) { account_id: account.id } end end