Sha256: d8800e05736ea8d74f8750d33de8f20575483969fca0cc7597f7bc13be9daa4e

Contents?: true

Size: 939 Bytes

Versions: 10

Compression:

Stored size: 939 Bytes

Contents

require 'rails_helper'

module MnoEnterprise
  describe UserSetupController, type: :controller do
    render_views
    routes { MnoEnterprise::Engine.routes }
    
    # Create user and organization + mutual associations
    let(:organization) { build(:organization) }
    let(:user) { build(:user) }
    before { api_stub_for(get: "/users/#{user.id}", response: from_api(user)) }
    before { allow(organization).to receive(:users).and_return([user]) }
    before { allow_any_instance_of(User).to receive(:organizations).and_return([organization]) }
    
    
    
    describe 'GET #index' do
      subject { get :index }
      
      describe 'guest' do
        before { subject }
        it { expect(response).to redirect_to(new_user_session_path) }
      end
      
      describe 'signed in' do
        before { sign_in user }
        before { subject }
        it { expect(response).to be_success }
      end
    end
    
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
mno-enterprise-frontend-2.0.9 spec/controllers/mno_enterprise/user_setup_controller_spec.rb
mno-enterprise-frontend-2.0.8 spec/controllers/mno_enterprise/user_setup_controller_spec.rb
mno-enterprise-frontend-2.0.7 spec/controllers/mno_enterprise/user_setup_controller_spec.rb
mno-enterprise-frontend-2.0.6 spec/controllers/mno_enterprise/user_setup_controller_spec.rb
mno-enterprise-frontend-2.0.5 spec/controllers/mno_enterprise/user_setup_controller_spec.rb
mno-enterprise-frontend-2.0.4 spec/controllers/mno_enterprise/user_setup_controller_spec.rb
mno-enterprise-frontend-2.0.3 spec/controllers/mno_enterprise/user_setup_controller_spec.rb
mno-enterprise-frontend-2.0.2 spec/controllers/mno_enterprise/user_setup_controller_spec.rb
mno-enterprise-frontend-2.0.1 spec/controllers/mno_enterprise/user_setup_controller_spec.rb
mno-enterprise-frontend-2.0.0 spec/controllers/mno_enterprise/user_setup_controller_spec.rb