Sha256: bae96b3241e11dd0d5a791e455ba0fd3e5e5db051e5125bbbc8d584e55589a35

Contents?: true

Size: 1.76 KB

Versions: 9

Compression:

Stored size: 1.76 KB

Contents

require 'spec_helper'

describe Alchemy::Admin::PagesHelper do

  describe '#sitemap_folder_link' do
    let(:user) { admin_user }

    before { helper.stub(:current_alchemy_user).and_return(user) }

    subject { helper.sitemap_folder_link(page) }

    context "with folded page" do
      let(:page) { mock_model(Alchemy::Page, folded?: true) }

      it "renders a link with folded class" do
        should match /class="page_folder folded spinner"/
      end

      it "renders a link with hide title" do
        should match /title="Show childpages"/
      end
    end

    context "with collapsed page" do
      let(:page) { mock_model(Alchemy::Page, folded?: false) }

      it "renders a link with collapsed class" do
        should match /class="page_folder collapsed spinner"/
      end

      it "renders a link with hide title" do
        should match /title="Hide childpages"/
      end
    end
  end

  describe '#preview_sizes_for_select' do
    it "returns a options string of preview screen sizes for select tag" do
      helper.preview_sizes_for_select.should include('option', 'auto', '240', '320', '480', '768', '1024', '1280')
    end
  end

  describe '#combined_page_status' do
    let(:page) { FactoryGirl.build_stubbed(:page, restricted: true, visible: true, public: true, locked: true) }
    subject { helper.combined_page_status(page) }

    context 'when page is locked' do
      it { should_not match(/locked/) } # We don't want the locked status in the return string
    end

    context 'when page is restricted' do
      it { should match(/is restricted/) }
    end

    context 'when page is visible in navigation' do
      it { should match(/is visible/) }
    end

    context 'when page is published' do
      it { should match(/is published/) }
    end
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
alchemy_cms-3.0.4 spec/helpers/admin/pages_helper_spec.rb
alchemy_cms-3.0.3 spec/helpers/admin/pages_helper_spec.rb
alchemy_cms-3.0.2 spec/helpers/admin/pages_helper_spec.rb
alchemy_cms-3.0.1 spec/helpers/admin/pages_helper_spec.rb
alchemy_cms-3.0.0 spec/helpers/admin/pages_helper_spec.rb
alchemy_cms-3.0.0.rc8 spec/helpers/admin/pages_helper_spec.rb
alchemy_cms-3.0.0.rc7 spec/helpers/admin/pages_helper_spec.rb
alchemy_cms-3.0.0.rc6 spec/helpers/admin/pages_helper_spec.rb
alchemy_cms-3.0.0.rc5 spec/helpers/admin/pages_helper_spec.rb