Sha256: 6845b6fcfa60f56940ad05ae286f6250debb5970f74d524f68ace80f786d0ff7

Contents?: true

Size: 1.72 KB

Versions: 32

Compression:

Stored size: 1.72 KB

Contents

require 'spec_helper'

describe ApplicationHelper, organization_workspace: :test do
  helper ApplicationHelper
  helper LinksHelper

  describe 'page_title' do
    context 'in path' do
      let(:exercise) { lesson.exercises.first }
      let(:lesson) {
        create(:lesson, name: 'A Guide', exercises: [
            create(:exercise, name: 'An Exercise')]) }
      let!(:chapter) { create(:chapter, name: 'C1', lessons: [lesson]) }

      before { reindex_current_organization! }

      it { expect(page_title nil).to eq 'Mumuki - test - Improve your programming skills' }
      it { expect(page_title Problem.new).to eq 'Mumuki - test - Improve your programming skills' }
      it { expect(page_title exercise).to eq 'C1: A Guide - An Exercise - Mumuki - test' }
    end
  end

  describe '#link_to_exercise' do
    let(:exercise) { lesson.exercises.third }
    let(:lesson) {
      create(:lesson, name: 'bar', exercises: [
          create(:exercise, name: 'foo2', id: 10),
          create(:exercise, name: 'foo2', id: 20),
          create(:exercise, name: 'foo3', id: 30)
      ]) }
    let!(:chapter) { create(:chapter, name: 'C1', lessons: [lesson]) }

    before { reindex_current_organization! }

    it { expect(link_to_path_element(exercise, mode: :plain)).to eq '<a href="/exercises/30-c1-bar-foo3">foo3</a>' }
    it { expect(link_to_path_element(exercise, mode: :friendly)).to eq '<a href="/exercises/30-c1-bar-foo3">C1: bar - foo3</a>' }
    it { expect(link_to_path_element(exercise)).to eq '<a href="/exercises/30-c1-bar-foo3">3. foo3</a>' }
  end

  describe '#link_to_guide' do
    let(:lesson) { create(:lesson, id: 1, name: 'foo') }
    it { expect(link_to_path_element(lesson)).to start_with '<a href="/lessons/1-foo">foo' }
  end

end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
mumuki-laboratory-6.1.5 spec/helpers/application_helper_spec.rb
mumuki-laboratory-6.0.4 spec/helpers/application_helper_spec.rb
mumuki-laboratory-6.1.4 spec/helpers/application_helper_spec.rb
mumuki-laboratory-6.1.3 spec/helpers/application_helper_spec.rb
mumuki-laboratory-6.0.3 spec/helpers/application_helper_spec.rb
mumuki-laboratory-6.1.2 spec/helpers/application_helper_spec.rb
mumuki-laboratory-6.1.1 spec/helpers/application_helper_spec.rb
mumuki-laboratory-6.1.0 spec/helpers/application_helper_spec.rb
mumuki-laboratory-6.0.2 spec/helpers/application_helper_spec.rb
mumuki-laboratory-6.0.1 spec/helpers/application_helper_spec.rb
mumuki-laboratory-6.0.0 spec/helpers/application_helper_spec.rb
mumuki-laboratory-5.13.0 spec/helpers/application_helper_spec.rb
mumuki-laboratory-5.12.1 spec/helpers/application_helper_spec.rb
mumuki-laboratory-5.12.0 spec/helpers/application_helper_spec.rb
mumuki-laboratory-5.11.0 spec/helpers/application_helper_spec.rb
mumuki-laboratory-5.10.4 spec/helpers/application_helper_spec.rb
mumuki-laboratory-5.10.3 spec/helpers/application_helper_spec.rb
mumuki-laboratory-5.10.2 spec/helpers/application_helper_spec.rb
mumuki-laboratory-5.10.1 spec/helpers/application_helper_spec.rb
mumuki-laboratory-5.10.0 spec/helpers/application_helper_spec.rb