Sha256: 98b3ce2eb5bb2d057dc955cbe9cae58e8aba8c0e369d9554728bb589f2dafdcd

Contents?: true

Size: 1.69 KB

Versions: 13

Compression:

Stored size: 1.69 KB

Contents

require 'spec_helper'

feature 'Exams Flow' do
  let(:exam) { create(:exam, classroom_id: '12345') }
  let(:other_exam) { create(:exam, organization: other_organization) }
  let!(:exam_not_in_path) { create :exam }

  let!(:chapter) {
    create(:chapter, lessons: [
        create(:lesson)]) }

  let(:other_organization) { create(:organization, name: 'baz') }

  before { reindex_current_organization! }

  context 'inexistent exam' do
    scenario 'visit exam by id, not in path' do
      visit "/exams/#{exam_not_in_path.id}"
      expect(page).to have_text('You have no permissions for this content. Maybe you logged in with another account.')
    end

    scenario 'visit exam by id, unknown exam' do
      visit '/exams/900000'
      expect(page).to have_text('You may have mistyped the address or the page may have moved')
    end
  end

  scenario 'visit exam not in path, by id, anonymous' do
   visit "/exams/#{other_exam.id}"
    expect(page).to have_text('You may have mistyped the address or the page may have moved')
  end

  scenario 'visit exam in path, by id, anonymous' do
    visit "/exams/#{exam.id}"

    expect(page).to have_text('You have no permissions for this content.')
  end

  scenario 'visit exam in path, by classroom id, anonymous' do
    visit "/exams/#{exam.classroom_id}"

    expect(page).to have_text('You have no permissions for this content.')
  end

  scenario 'visit exam in path, when there is no more time' do
    user = create(:user)
    set_current_user! user
    exam.authorize!(user)
    expect_any_instance_of(Exam).to receive(:enabled_for?).and_return(false)
    visit "/exams/#{exam.classroom_id}"

    expect(page).to have_text('This exam is no longer available.')
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
mumuki-laboratory-5.0.12 spec/features/exams_flow_spec.rb
mumuki-laboratory-5.0.11 spec/features/exams_flow_spec.rb
mumuki-laboratory-5.0.10 spec/features/exams_flow_spec.rb
mumuki-laboratory-5.0.9 spec/features/exams_flow_spec.rb
mumuki-laboratory-5.0.8 spec/features/exams_flow_spec.rb
mumuki-laboratory-5.0.7 spec/features/exams_flow_spec.rb
mumuki-laboratory-5.0.6 spec/features/exams_flow_spec.rb
mumuki-laboratory-5.0.5 spec/features/exams_flow_spec.rb
mumuki-laboratory-5.0.4 spec/features/exams_flow_spec.rb
mumuki-laboratory-5.0.3 spec/features/exams_flow_spec.rb
mumuki-laboratory-5.0.2 spec/features/exams_flow_spec.rb
mumuki-laboratory-5.0.1 spec/features/exams_flow_spec.rb
mumuki-laboratory-5.0.0 spec/features/exams_flow_spec.rb