Skip to content

Commit

Permalink
Adding test for multi-path categories
Browse files Browse the repository at this point in the history
  • Loading branch information
flbulgarelli committed Jul 8, 2015
1 parent 5da3e11 commit 716f2c4
Showing 1 changed file with 32 additions and 8 deletions.
40 changes: 32 additions & 8 deletions spec/features/standard_flow_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,51 @@
feature 'Standard Flow' do
let(:haskell) { create(:haskell) }
let!(:exercises) {
create(:exercise, title: 'Succ', guide: guide, position: 1, description: 'Description of foo')
create(:exercise, title: 'Succ', guide: guide, position: 1, description: 'Description of foo')
}
let!(:category) { create(:category, name: 'Functional Programming') }
let!(:path) { create(:path, category: category, language: haskell) }
let!(:guide) { create(:guide, name: 'getting-started', description: 'An awesome guide',
language: haskell, position: 1, path: path) }

scenario 'do a guide for first time, starting from home' do

before do
visit '/'
end

context 'single path' do
scenario 'do a guide for first time, starting from home' do
within('.jumbotron') do
click_on 'Start Practicing!'
end

within('.category-panel') do
click_on 'Start Practicing!'
end

within('.jumbotron') do
click_on 'Start Practicing!'
expect(page).to have_text('Succ')
end
end

within('.category-panel') do
click_on 'haskell'
end
context 'multiple paths' do
let(:js) { create(:language, name: 'js') }
let!(:path_js) { create(:path, category: category, language: js) }
let!(:guide_js) { create(:guide, name: 'getting-started-js', description: 'An awesome JS guide',
language: js, position: 1, path: path_js) }

scenario 'do a guide for first time, starting from home' do
within('.jumbotron') do
click_on 'Start Practicing!'
end

click_on 'Start Practicing!'
within('.category-panel') do
click_on 'haskell'
end

expect(page).to have_text('Succ')
click_on 'Start Practicing!'
expect(page).to have_text('Succ')
end
end


Expand Down

0 comments on commit 716f2c4

Please sign in to comment.