Sha256: 0ce93eb674d3dff324fe06ce2e05718b3df360cd9d1e6c1c916def60bb331fbe
Contents?: true
Size: 885 Bytes
Versions: 11
Compression:
Stored size: 885 Bytes
Contents
# frozen_string_literal: true require "rails_helper" RSpec.describe MrCommon::DashboardController, type: :controller do describe "#index" do it "redirects unauthenticated users to the sign in path" do get :index expect(response).to redirect_to main_app.new_user_session_path end it "allows authorized users to reach the dashboard" do @user = create(:user) sign_in @user get :index expect(response.status).to eq 200 end it "redirects unauthorized users to the root_path" do @unauthorized_user = create(:user) sign_in @unauthorized_user allow(@unauthorized_user).to receive(MrCommon.current_user_authorization_method_name) { false } allow(controller).to receive(:current_user) { @unauthorized_user } get :index expect(response.status).to redirect_to main_app.root_path end end end
Version data entries
11 entries across 11 versions & 1 rubygems