Sha256: 2e742f7f40004c19a1eebd2fc9142c4ec8381b132a2c9c80f3983d35a1302502

Contents?: true

Size: 737 Bytes

Versions: 7

Compression:

Stored size: 737 Bytes

Contents

# frozen_string_literal: true

describe PUNK, "GET /groups" do
  include_context "Punk"

  context 'when the user is not authenticated' do
    before do
      get '/groups'
    end

    it { is_expected.not_to be_successful }
  end

  context 'when the user is authenticated' do
    let(:tenant) { create(:tenant) }
    let(:identity) { create(:identity, claim_type: 'phone') }
    let(:group) { create(:group, tenant: tenant) }

    before do
      identity.user.add_tenant(tenant)
      identity.user.add_group(group)
      login(identity.claim)
      get "/groups?tenant_id=#{tenant.id}"
    end

    after do
      logout
    end

    it { is_expected.to be_successful }
    its(:body) { is_expected.to match(group.name) }
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
punk-0.3.6 spec/routes/groups/get_groups_spec.rb
punk-0.3.5 spec/routes/groups/get_groups_spec.rb
punk-0.3.4 spec/routes/groups/get_groups_spec.rb
punk-0.3.3 spec/routes/groups/get_groups_spec.rb
punk-0.3.2 spec/routes/groups/get_groups_spec.rb
punk-0.3.1 spec/routes/groups/get_groups_spec.rb
punk-0.2.0 spec/routes/groups/get_groups_spec.rb