Sha256: 9580766a441a55f728de2eaa561872c9f847979c7b350702101489b154fd2f89

Contents?: true

Size: 1016 Bytes

Versions: 2

Compression:

Stored size: 1016 Bytes

Contents

require File.dirname(__FILE__) + '/../../spec_helper'

describe Admin::PartDescriptionHelper do
  include Admin::PartDescriptionHelper

  class DescriptionPageFactory < PageFactory::Base
    part 'normal', :description => 'sub'
  end

  class DescriptionPart < PagePart ; end

  before do
    @page = Page.new :page_factory => 'DescriptionPageFactory'
    @part = PagePart.new :name => 'normal'
  end

  it "should get description from page factory" do
    description_for(@part).should eql('sub')
  end

  it "should return nothing if page is unset" do
    # as is the case when adding parts
    @page = nil
    description_for(@part).should be_blank
  end

  it "should return nothing if factory is unset" do
    @page.page_factory = nil
    description_for(@part).should be_blank
  end

  it "should not describe a different part class" do
    part = DescriptionPart.new :name => 'normal'
    description_for(part).should be_blank
  end

  private

    def logger
      double('logger').as_null_object
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
radiant-page_factory-extension-1.0.1 spec/helpers/admin/part_description_helper_spec.rb
radiant-page_factory-extension-1.0.0 spec/helpers/admin/part_description_helper_spec.rb