-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
19bc523
commit 27834dc
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
require 'spec_helper' | ||
|
||
feature 'Progressive Tips' do | ||
let(:user) { create(:user) } | ||
|
||
let(:haskell) { create(:haskell) } | ||
|
||
let!(:problem) { build(:problem, name: 'Succ1', description: 'Description of Succ1', layout: :input_right, progressive_tips: [[5, 'try this'], [10, '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 'logged user' do | ||
before { set_current_user! user } | ||
before { assignment.update! status: :failed } | ||
|
||
scenario 'visit exercise by slug' do | ||
assignment.update! failed_submissions_count: 2 | ||
visit "/exercises/#{problem.slug}" | ||
|
||
expect(page).to_not have_text('try this') | ||
expect(page).to_not have_text('try that') | ||
end | ||
|
||
scenario 'visit exercise by id, editor right layout' do | ||
assignment.update! failed_submissions_count: 5 | ||
visit "/exercises/#{problem.id}" | ||
|
||
expect(page).to have_text('try this') | ||
expect(page).to_not have_text('try that') | ||
end | ||
|
||
scenario 'visit exercise by id, hidden layout, no hint, not queriable language' do | ||
assignment.update! failed_submissions_count: 10 | ||
visit "/exercises/#{problem.id}" | ||
|
||
expect(page).to have_text('try this') | ||
expect(page).to have_text('try that') | ||
end | ||
end | ||
end |