Sha256: d45e79f0c33de8c5a12cab13f971d8fd5b9c998f5cabce3939e53a10ec13c9d2

Contents?: true

Size: 902 Bytes

Versions: 96

Compression:

Stored size: 902 Bytes

Contents

require 'spec_helper'

describe InvitationsController, type: :controller, organization_workspace: :test do
  let(:user) { create(:user) }

  before { set_current_user! user }

  describe 'when invitation does not exist' do
    before { get :join, params: {code: 'foo123' } }

    it { expect(response.status).to eq 404 }
  end

  describe 'when invitation exists' do
    let(:organization) { Organization.current }
    let(:course) { create(:course, slug: 'test/foo-1111', name: 'Generic Course', organization: organization) }
    let!(:invitation) { create(:invitation, code: 'foo123', course: course ) }

    before { get :join, params: {code: 'foo123', user: {first_name: 'new first_name', gender: 'female'} } }
    before { user.reload }

    it { expect(response.status).to eq 302 }
    it { expect(user.first_name).to eq 'new first_name' }
    it { expect(user.gender).to eq 'female' }
  end
end

Version data entries

96 entries across 96 versions & 1 rubygems

Version Path
mumuki-laboratory-9.23.0 spec/controllers/invitations_controller_spec.rb
mumuki-laboratory-9.22.0 spec/controllers/invitations_controller_spec.rb
mumuki-laboratory-9.21.0 spec/controllers/invitations_controller_spec.rb
mumuki-laboratory-9.20.1 spec/controllers/invitations_controller_spec.rb
mumuki-laboratory-9.20.0 spec/controllers/invitations_controller_spec.rb
mumuki-laboratory-9.19.0 spec/controllers/invitations_controller_spec.rb
mumuki-laboratory-9.18.1 spec/controllers/invitations_controller_spec.rb
mumuki-laboratory-9.18.0 spec/controllers/invitations_controller_spec.rb
mumuki-laboratory-9.17.0 spec/controllers/invitations_controller_spec.rb
mumuki-laboratory-9.16.0 spec/controllers/invitations_controller_spec.rb
mumuki-laboratory-9.15.0 spec/controllers/invitations_controller_spec.rb
mumuki-laboratory-9.14.1 spec/controllers/invitations_controller_spec.rb
mumuki-laboratory-9.14.0 spec/controllers/invitations_controller_spec.rb
mumuki-laboratory-9.13.2 spec/controllers/invitations_controller_spec.rb
mumuki-laboratory-9.13.1 spec/controllers/invitations_controller_spec.rb
mumuki-laboratory-9.13.0 spec/controllers/invitations_controller_spec.rb
mumuki-laboratory-9.12.1 spec/controllers/invitations_controller_spec.rb
mumuki-laboratory-9.12.0 spec/controllers/invitations_controller_spec.rb
mumuki-laboratory-9.11.0 spec/controllers/invitations_controller_spec.rb
mumuki-laboratory-9.10.0 spec/controllers/invitations_controller_spec.rb