Sha256: bfedf8a510956540441a45174630ebdb8abbbc9b3d0cae0b60bf75260ed86e3f

Contents?: true

Size: 1.03 KB

Versions: 36

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

feature 'Dynamic Exam', organization_workspace: :test do
  let(:user) { create(:user, id: 1) }
  let(:user2) { create(:user, id: 2) }

  let!(:problem) { build(:problem, description: 'do f = $someVariable', randomizations: { someVariable: { type: :one_of, value: %w(some_string some_other_string)} }) }

  let!(:chapter) {
    create(:chapter, lessons: [
      create(:lesson, description: 'An awesome guide', exercises: [
        problem
      ])
    ]) }

  before { reindex_current_organization! }

  context 'not logged user' do
    scenario 'visit exercise by slug' do
      visit "/exercises/#{problem.slug}"

      expect(page).to have_text('do f = some_string')
    end
  end


  context 'logged user' do
    scenario 'visit exercise by slug' do
      set_current_user! user
      visit "/exercises/#{problem.slug}"

      expect(page).to have_text('do f = some_other_string')

      set_current_user! user2
      visit "/exercises/#{problem.slug}"

      expect(page).to have_text('do f = some_string')
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
mumuki-laboratory-6.5.1 spec/features/dynamic_exam_spec.rb
mumuki-laboratory-6.5.0 spec/features/dynamic_exam_spec.rb
mumuki-laboratory-6.4.2 spec/features/dynamic_exam_spec.rb
mumuki-laboratory-6.4.1 spec/features/dynamic_exam_spec.rb
mumuki-laboratory-6.4.0 spec/features/dynamic_exam_spec.rb
mumuki-laboratory-6.2.0 spec/features/dynamic_exam_spec.rb
mumuki-laboratory-6.1.5 spec/features/dynamic_exam_spec.rb
mumuki-laboratory-6.0.4 spec/features/dynamic_exam_spec.rb
mumuki-laboratory-6.1.4 spec/features/dynamic_exam_spec.rb
mumuki-laboratory-6.1.3 spec/features/dynamic_exam_spec.rb
mumuki-laboratory-6.0.3 spec/features/dynamic_exam_spec.rb
mumuki-laboratory-6.1.2 spec/features/dynamic_exam_spec.rb
mumuki-laboratory-6.1.1 spec/features/dynamic_exam_spec.rb
mumuki-laboratory-6.1.0 spec/features/dynamic_exam_spec.rb
mumuki-laboratory-6.0.2 spec/features/dynamic_exam_spec.rb
mumuki-laboratory-6.0.1 spec/features/dynamic_exam_spec.rb
mumuki-laboratory-6.0.0 spec/features/dynamic_exam_spec.rb
mumuki-laboratory-5.13.0 spec/features/dynamic_exam_spec.rb
mumuki-laboratory-5.12.1 spec/features/dynamic_exam_spec.rb
mumuki-laboratory-5.12.0 spec/features/dynamic_exam_spec.rb