Sha256: b7955b3d1045dc74ab549c70b33e8290c4c31c7230681936acbdb2fda965f95c

Contents?: true

Size: 630 Bytes

Versions: 7

Compression:

Stored size: 630 Bytes

Contents

# frozen_string_literal: true

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

  context 'when the user is not authenticated' do
    before do
      get '/tenants'
    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') }

    before do
      identity.user.add_tenant(tenant)
      login(identity.claim)
      get '/tenants'
    end

    after do
      logout
    end

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

Version data entries

7 entries across 7 versions & 1 rubygems

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