Sha256: f6170e8148cc57b6997c618df9202034dac1f9bc78b477946c503a1356760ee3

Contents?: true

Size: 1.49 KB

Versions: 10

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.find_or_init_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! attemps_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! attemps_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! attemps_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

10 entries across 10 versions & 1 rubygems

Version Path
mumuki-laboratory-5.8.3 spec/features/progressive_tips_spec.rb
mumuki-laboratory-5.8.1 spec/features/progressive_tips_spec.rb
mumuki-laboratory-5.8.0 spec/features/progressive_tips_spec.rb
mumuki-laboratory-5.7.0 spec/features/progressive_tips_spec.rb
mumuki-laboratory-5.6.3 spec/features/progressive_tips_spec.rb
mumuki-laboratory-5.6.2 spec/features/progressive_tips_spec.rb
mumuki-laboratory-5.6.1 spec/features/progressive_tips_spec.rb
mumuki-laboratory-5.6.0 spec/features/progressive_tips_spec.rb
mumuki-laboratory-5.5.0 spec/features/progressive_tips_spec.rb
mumuki-laboratory-5.4.0 spec/features/progressive_tips_spec.rb