Sha256: e6da1e710340bbb44ed402d9f4ba28de7dfe953e92a27aaf0c23335f5d3ecbd9

Contents?: true

Size: 1.72 KB

Versions: 17

Compression:

Stored size: 1.72 KB

Contents

require 'spec_helper'

feature 'Exams Flow', organization_workspace: :test 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

17 entries across 17 versions & 1 rubygems

Version Path
mumuki-laboratory-5.9.1 spec/features/exams_flow_spec.rb
mumuki-laboratory-5.9.0 spec/features/exams_flow_spec.rb
mumuki-laboratory-5.8.3 spec/features/exams_flow_spec.rb
mumuki-laboratory-5.8.1 spec/features/exams_flow_spec.rb
mumuki-laboratory-5.8.0 spec/features/exams_flow_spec.rb
mumuki-laboratory-5.7.0 spec/features/exams_flow_spec.rb
mumuki-laboratory-5.6.3 spec/features/exams_flow_spec.rb
mumuki-laboratory-5.6.2 spec/features/exams_flow_spec.rb
mumuki-laboratory-5.6.1 spec/features/exams_flow_spec.rb
mumuki-laboratory-5.6.0 spec/features/exams_flow_spec.rb
mumuki-laboratory-5.5.0 spec/features/exams_flow_spec.rb
mumuki-laboratory-5.4.0 spec/features/exams_flow_spec.rb
mumuki-laboratory-5.3.0 spec/features/exams_flow_spec.rb
mumuki-laboratory-5.2.1 spec/features/exams_flow_spec.rb
mumuki-laboratory-5.2.0 spec/features/exams_flow_spec.rb
mumuki-laboratory-5.1.1 spec/features/exams_flow_spec.rb
mumuki-laboratory-5.1.0 spec/features/exams_flow_spec.rb