Sha256: 3978c91dbf129f70dc3a1fbba4bdd1d2b827308b33c186a4ce6054d8b1e5e005

Contents?: true

Size: 630 Bytes

Versions: 1

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

1 entries across 1 versions & 1 rubygems

Version Path
punk-0.4.1 spec/routes/tenants/get_tenants_spec.rb