Sha256: 17ae53b6447eab0bbdb52f8f6cf950ac5ced1427b09c0f9bc1c4bd90849ada90

Contents?: true

Size: 1.36 KB

Versions: 26

Compression:

Stored size: 1.36 KB

Contents

require 'spec_helper'

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

  let(:owner) { create(:user, permissions: {owner: '*'}) }
  let(:student_api_client) { create :api_client, role: :student, grant: 'central/*' }
  let(:owner_api_client) { create :api_client, role: :owner, 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! owner

    visit '/nonexistentroute'

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

  scenario 'api without authorization' do
    Capybara.current_session.driver.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:;owner:']
  end

  scenario 'api with authentication' do
    Capybara.current_session.driver.header 'Authorization', "Bearer #{owner_api_client.token}"

    visit '/api/nonexistentroute'

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

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
mumuki-laboratory-6.7.3 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-6.7.2 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-6.7.1 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-6.7.0 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-6.6.1 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-6.6.0 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-6.5.1 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-6.5.0 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-6.4.2 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-6.4.1 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-6.4.0 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-6.2.0 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-6.1.5 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-6.0.4 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-6.1.4 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-6.1.3 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-6.0.3 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-6.1.2 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-6.1.1 spec/features/not_found_private_flow_spec.rb
mumuki-laboratory-6.1.0 spec/features/not_found_private_flow_spec.rb