Sha256: cc0bda57f042362f1d6d5bb00893e9acf53444fe262030485940f984f28e4333

Contents?: true

Size: 1.49 KB

Versions: 116

Compression:

Stored size: 1.49 KB

Contents

require 'spec_helper'

feature 'Progressive Tips', organization_workspace: :test do
  let(:user) { create(:user) }

  let(:haskell) { create(:haskell) }

  let!(:problem) { build(:problem,
                          name: 'Succ1', description: 'Description of Succ1',
                          layout: :input_right, assistance_rules: [{when: :submission_failed, then: ['try this', 'try that']}] ) }
  let(:assignment) { problem.assignment_for(user) }

  let!(:chapter) {
    create(:chapter, name: 'Functional Programming', lessons: [
      create(:lesson, name: 'getting-started', description: 'An awesome guide', language: haskell, exercises: [problem])
    ]) }

  before { reindex_current_organization! }

  context 'visit failed exercise' do
    before { set_current_user! user }
    before { assignment.update! status: :failed }

    scenario '2 failed submissions' do
      assignment.update! attempts_count: 2
      visit "/exercises/#{problem.transparent_id}"

      expect(page).to have_text('Try this')
      expect(page).to_not have_text('Try that')
    end

    scenario '5 failed submissions' do
      assignment.update! attempts_count: 5
      visit "/exercises/#{problem.id}"

      expect(page).to_not have_text('Try this')
      expect(page).to have_text('Try that')
    end

    scenario '10 failed submissions' do
      assignment.update! attempts_count: 10
      visit "/exercises/#{problem.id}"

      expect(page).to_not have_text('Try this')
      expect(page).to have_text('Try that')
    end
  end
end

Version data entries

116 entries across 116 versions & 1 rubygems

Version Path
mumuki-laboratory-9.23.0 spec/features/progressive_tips_spec.rb
mumuki-laboratory-9.22.0 spec/features/progressive_tips_spec.rb
mumuki-laboratory-9.21.0 spec/features/progressive_tips_spec.rb
mumuki-laboratory-9.20.1 spec/features/progressive_tips_spec.rb
mumuki-laboratory-9.20.0 spec/features/progressive_tips_spec.rb
mumuki-laboratory-9.19.0 spec/features/progressive_tips_spec.rb
mumuki-laboratory-9.18.1 spec/features/progressive_tips_spec.rb
mumuki-laboratory-9.18.0 spec/features/progressive_tips_spec.rb
mumuki-laboratory-9.17.0 spec/features/progressive_tips_spec.rb
mumuki-laboratory-9.16.0 spec/features/progressive_tips_spec.rb
mumuki-laboratory-9.15.0 spec/features/progressive_tips_spec.rb
mumuki-laboratory-9.14.1 spec/features/progressive_tips_spec.rb
mumuki-laboratory-9.14.0 spec/features/progressive_tips_spec.rb
mumuki-laboratory-9.13.2 spec/features/progressive_tips_spec.rb
mumuki-laboratory-9.13.1 spec/features/progressive_tips_spec.rb
mumuki-laboratory-9.13.0 spec/features/progressive_tips_spec.rb
mumuki-laboratory-9.12.1 spec/features/progressive_tips_spec.rb
mumuki-laboratory-9.12.0 spec/features/progressive_tips_spec.rb
mumuki-laboratory-9.11.0 spec/features/progressive_tips_spec.rb
mumuki-laboratory-9.10.0 spec/features/progressive_tips_spec.rb