Sha256: 3957cbdd82d1efa85132afaf6863ae6307df8d641cb7dd967ad1d065c424c79b

Contents?: true

Size: 1.4 KB

Versions: 12

Compression:

Stored size: 1.4 KB

Contents

require 'spec_helper'

describe Kuhsaft::Cms::PagesHelper do
  describe '#content_tab_active' do
    it 'returns active when page has a title and no errors' do
      @page = create(:page, title: 'Page 1', slug: 'page1')
      expect(helper.content_tab_active(@page)).to be(:active)
    end

    it 'returns nil when page has no translation' do
      @page = create(:page, title: 'Page 1', slug: 'page1')
      I18n.with_locale :de do
        expect(helper.content_tab_active(@page)).to be_nil
      end
    end
  end

  describe '#metadata_tab_active' do
    it 'returns active when page is not translated' do
      @page = create(:page, title: 'Page 1', slug: 'page1')
      I18n.with_locale :de do
        expect(helper.metadata_tab_active(@page)).to be(:active)
      end
    end
  end

  describe '#hide_content_tab?' do
    it 'has a page without translations' do
      @page = create(:page, title: 'Page 1', slug: 'page1')
      I18n.with_locale :de do
        expect(helper.hide_content_tab?(@page)).to be_true
      end
    end

    it 'has a redirect page' do
      @page = create(:page, title: 'Page 1', slug: 'page1',
                            page_type: Kuhsaft::PageType::REDIRECT, redirect_url: 'en/references')
      expect(helper.hide_content_tab?(@page)).to be_true
    end

    it 'has a not saved page' do
      @page = Kuhsaft::Page.new
      expect(helper.hide_content_tab?(@page)).to be_true
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
qbrick-2.5.0.pre spec/helpers/kuhsaft/cms/pages_helper_spec.rb
kuhsaft-2.4.3 spec/helpers/kuhsaft/cms/pages_helper_spec.rb
kuhsaft-2.4.2 spec/helpers/kuhsaft/cms/pages_helper_spec.rb
kuhsaft-2.4.1 spec/helpers/kuhsaft/cms/pages_helper_spec.rb
kuhsaft-2.4.0 spec/helpers/kuhsaft/cms/pages_helper_spec.rb
kuhsaft-2.3.6 spec/helpers/kuhsaft/cms/pages_helper_spec.rb
kuhsaft-2.3.5 spec/helpers/kuhsaft/cms/pages_helper_spec.rb
kuhsaft-2.3.4 spec/helpers/kuhsaft/cms/pages_helper_spec.rb
kuhsaft-2.3.3 spec/helpers/kuhsaft/cms/pages_helper_spec.rb
kuhsaft-2.3.2 spec/helpers/kuhsaft/cms/pages_helper_spec.rb
kuhsaft-2.3.1 spec/helpers/kuhsaft/cms/pages_helper_spec.rb
kuhsaft-2.3.0 spec/helpers/kuhsaft/cms/pages_helper_spec.rb