Sha256: ce89fcbab91158f6b0e5a2f5eeb570333e33ca4096983caadc30caac89c9fe6e

Contents?: true

Size: 1.74 KB

Versions: 13

Compression:

Stored size: 1.74 KB

Contents

require 'spec_helper'

feature 'Chapters flow' do
  let(:haskell) { create(:haskell) }

  let!(:chapter) {
    create(:chapter, name: 'Functional Programming', lessons: [
      create(:lesson, name: 'Values and Functions', language: haskell, description: 'Values are everywhere...', exercises: [
        create(:exercise, name: 'The Basic Values', description: "Let's say we want to declare a variable...")
      ]),
      create(:lesson, name: 'Monads and Functors', language: haskell, description: 'Monds are everywhere too...', exercises: [
        create(:exercise, name: 'The Maybe Functor', description: "Let's say we want to model absense of value...")
      ])
    ]) }

  before { reindex_current_organization! }

  context 'no appendix' do
    scenario 'show chapter, no appendix' do
      visit "/chapters/#{chapter.id}"

      expect(page).to have_text('Functional Programming')
      expect(page).to have_text('The Basic Values')

      expect(page).to have_text('Monads and Functors')
      expect(page).to have_text('The Maybe Functor')

      expect(page).to_not have_text('Appendix')
    end
  end

  context 'with appendix' do
    before { chapter.topic.update appendix: 'Check this article about endofunctors' }

    scenario 'show chapter, with appendix' do
      visit "/chapters/#{chapter.id}"

      expect(page).to have_text('Functional Programming')
      expect(page).to have_text('The Basic Values')

      expect(page).to have_text('Monads and Functors')
      expect(page).to have_text('The Maybe Functor')

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

    scenario 'show appendix' do
      visit "/chapters/#{chapter.id}/appendix"
      expect(page).to have_text('Appendix')
      expect(page).to have_text('endofunctors')
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

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