Sha256: 2e6bab811b372d7345da8b7f0bd20b86c940c58597caa23306b7640c32c3a864

Contents?: true

Size: 1.96 KB

Versions: 13

Compression:

Stored size: 1.96 KB

Contents

require 'spec_helper'

feature 'Lessons Flow' do
  let(:exercise) { create(:exercise, name:  'E1') }
  let!(:complement) { create(:complement) }
  let!(:lesson) { create(:lesson, name: 'L1', exercises: [exercise]) }
  let!(:chapter) { create(:chapter, name: 'C1', lessons: [lesson]) }


  let(:other_organization) { create(:organization, name: 'other') }
  let(:other_book) { create(:book) }
  let(:other_exercise) { create(:exercise) }
  let!(:other_complement) { create(:complement, book: other_book) }
  let!(:other_lesson) { create(:lesson, exercises: [other_exercise]) }
  let!(:other_chapter) { create(:chapter, lessons: [other_lesson], book: other_book) }

  before { reindex_current_organization! }
  before { reindex_organization! other_organization }

  scenario 'visit lesson in path' do
    visit "/lessons/#{lesson.id}"

    expect(page).to have_text('L1')
  end

  scenario 'visit lesson not in path' do
    visit "/lessons/#{other_lesson.id}"
    expect(page).to have_text('You may have mistyped the address or the page may have moved')
  end

  scenario 'visit chapter in path' do
    visit "/chapters/#{chapter.id}"

    expect(page).to have_text('C1')
  end

  scenario 'visit chapter not in path' do
    visit "/chapters/#{other_chapter.id}"
    expect(page).to have_text('You may have mistyped the address or the page may have moved')
  end

  scenario 'visit exercise in path' do
    visit "/exercises/#{exercise.id}"

    expect(page).to have_text('E1')
  end

  scenario 'visit exercise not in path' do
    visit "/exercises/#{other_exercise.id}"
    expect(page).to have_text('You may have mistyped the address or the page may have moved')
  end

  scenario 'visit exercise in path' do
    visit "/complements/#{complement.id}"

    expect(page).to have_text(complement.name)
  end

  scenario 'visit exercise not in path' do
    visit "/complements/#{other_complement.id}"
    expect(page).to have_text('You may have mistyped the address or the page may have moved')
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
mumuki-laboratory-5.0.12 spec/features/links_flow_spec.rb
mumuki-laboratory-5.0.11 spec/features/links_flow_spec.rb
mumuki-laboratory-5.0.10 spec/features/links_flow_spec.rb
mumuki-laboratory-5.0.9 spec/features/links_flow_spec.rb
mumuki-laboratory-5.0.8 spec/features/links_flow_spec.rb
mumuki-laboratory-5.0.7 spec/features/links_flow_spec.rb
mumuki-laboratory-5.0.6 spec/features/links_flow_spec.rb
mumuki-laboratory-5.0.5 spec/features/links_flow_spec.rb
mumuki-laboratory-5.0.4 spec/features/links_flow_spec.rb
mumuki-laboratory-5.0.3 spec/features/links_flow_spec.rb
mumuki-laboratory-5.0.2 spec/features/links_flow_spec.rb
mumuki-laboratory-5.0.1 spec/features/links_flow_spec.rb
mumuki-laboratory-5.0.0 spec/features/links_flow_spec.rb