Sha256: c3916ce68c3f019010ce3bbe75ace44bd1b1a8896470eb972e61f02a19e5206c

Contents?: true

Size: 1.17 KB

Versions: 13

Compression:

Stored size: 1.17 KB

Contents

require 'rails_helper'

describe 'redirection' do
  context 'when public controller raises no tenant set' do
    before do
      allow(MensajeContacto).to receive(:new).and_raise(ActsAsTenant::Errors::NoTenantSet)
    end

    it 'shows the error' do
      get '/contacto'

      expect(response).to have_http_status(:internal_server_error)
    end
  end

  context 'when logged in', :tpath_req do
    let(:logged_user) { create :user, :owner }

    before do
      sign_in logged_user
    end

    context 'when account is discarded' do
      it do
        get '/u/t/cosas'
        expect(response.body).to include 'No hay ningĂșn coso que mostrar'
        logged_user.user_accounts.first.account.discard!
        get '/u/t/cosas'
        expect(response).to redirect_to users_accounts_path, tpath: false
      end
    end

    # TODO: activar subdomains
    # context 'when belongs to other account', pending: 'subdomains not ready' do
    #   before do
    #     create :account, subdomain: 'other'
    #     host! 'other.example.com'
    #   end

    #   it do
    #     get '/u/t/cosas'

    #     expect(response).to redirect_to new_user_session_path, tpath: false
    #   end
    # end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
pg_rails-7.6.27 pg_engine/spec/requests/users/base_controller_spec.rb
pg_rails-7.6.26 pg_engine/spec/requests/users/base_controller_spec.rb
pg_rails-7.6.25 pg_engine/spec/requests/users/base_controller_spec.rb
pg_rails-7.6.24 pg_engine/spec/requests/users/base_controller_spec.rb
pg_rails-7.6.24.pre.5 pg_engine/spec/requests/users/base_controller_spec.rb
pg_rails-7.6.24.pre.4 pg_engine/spec/requests/users/base_controller_spec.rb
pg_rails-7.6.24.pre.3 pg_engine/spec/requests/users/base_controller_spec.rb
pg_rails-7.6.23 pg_engine/spec/requests/users/base_controller_spec.rb
pg_rails-7.6.22 pg_engine/spec/requests/users/base_controller_spec.rb
pg_rails-7.6.22.pre.3 pg_engine/spec/requests/users/base_controller_spec.rb
pg_rails-7.6.22.pre.2 pg_engine/spec/requests/users/base_controller_spec.rb
pg_rails-7.6.22.pre.1 pg_engine/spec/requests/users/base_controller_spec.rb
pg_rails-7.6.21 pg_engine/spec/requests/users/base_controller_spec.rb