Sha256: 08db767eb83cff74356adcf61e05ba9a1cddfa56afca82ed603308b70e78156c

Contents?: true

Size: 1.37 KB

Versions: 57

Compression:

Stored size: 1.37 KB

Contents

require 'spec_helper'

feature 'not found private on app', organization_workspace: :base do
  before { set_subdomain_host! Organization.base.name }
  before { Organization.base.switch! }

  let(:admin) { create(:user, permissions: {admin: '*'}) }
  let(:student_api_client) { create :api_client, role: :student, grant: 'central/*' }
  let(:admin_api_client) { create :api_client, role: :admin, grant: '*' }

  scenario 'app without authentication' do
    visit '/nonexistentroute'

    expect(page).to have_text 'You are not allowed to see this content'
  end

  scenario 'app with authentication' do
    set_current_user! admin

    visit '/nonexistentroute'

    expect(page).to have_text 'You may have mistyped the address or the page may have moved'
  end

  scenario 'api without authorization', :json_eq_error do
    set_request_header! 'Authorization', "Bearer #{student_api_client.token}"

    visit '/api/nonexistentroute'

    expect(page.text).to json_eq errors: [
      'The operation on organization base' +
      ' was forbidden to user foo+1@bar.com' +
      ' with permissions !student:central/*;teacher:;headmaster:;janitor:;admin:;owner:']
  end

  scenario 'api with authentication', :json_eq_error do
    set_request_header! 'Authorization', "Bearer #{admin_api_client.token}"

    visit '/api/nonexistentroute'

    expect(page.text).to json_eq errors: ['not found']
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
mumuki-laboratory-9.23.0 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-9.22.0 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-9.21.0 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-9.20.1 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-9.20.0 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-9.19.0 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-9.18.1 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-9.18.0 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-9.17.0 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-9.16.0 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-9.12.1 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-9.12.0 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-9.11.0 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-9.10.0 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-9.9.0 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-9.8.2 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-9.8.1 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-9.8.0 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-9.7.2 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-9.7.1 spec/features/not_found_private_flow_spec.rb