Sha256: 54d820772bef54067999796fc4dd1da8f5a1399523612896918b3320f5784857

Contents?: true

Size: 1.48 KB

Versions: 28

Compression:

Stored size: 1.48 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.slug}"

      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

28 entries across 28 versions & 1 rubygems

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