Sha256: 0327d4bf61327939f359b9a823959e9f128c15f34446ea35765b16892735b202

Contents?: true

Size: 1.33 KB

Versions: 5

Compression:

Stored size: 1.33 KB

Contents

require File.expand_path("../../spec_helper", __FILE__)

describe Page do
  context 'when the parent page has single_use_children' do
    it 'should remove its class from the parent page allowed_children_cache after create' do
      ArchivePage.stub!(:single_use_children).and_return([ArchiveDayIndexPage])
      parent = ArchivePage.create!(:slug => 'archive', :title => 'archive',
                          :breadcrumb => 'archive',
                          :allowed_children_cache => 'Page,ArchiveDayIndexPage')
      page = ArchiveDayIndexPage.new(:slug => 'day', :title => 'day', :breadcrumb => 'day')
      page.parent = parent
      page.save!
      parent.allowed_children_cache.should_not include('ArchiveDayIndexPage')
    end
    it 'should add its class to the parent page allowed_children_cache after destroy' do
      ArchivePage.stub!(:single_use_children).and_return([ArchiveDayIndexPage])
      parent = ArchivePage.create!(:slug => 'archive', :title => 'archive',
                          :breadcrumb => 'archive',
                          :allowed_children_cache => 'Page,ArchiveDayIndexPage')
      page = ArchiveDayIndexPage.new(:slug => 'day', :title => 'day', :breadcrumb => 'day')
      page.parent = parent
      page.save!
      page.destroy
      parent.allowed_children_cache.should include('ArchiveDayIndexPage')
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
radiant-1.0.0 ruby-debug/ruby/1.8/gems/radiant-archive-extension-1.0.7/spec/models/page_spec.rb
radiant-archive-extension-1.0.7 spec/models/page_spec.rb
radiant-archive-extension-1.0.6 spec/models/page_spec.rb
radiant-archive-extension-1.0.5 spec/models/page_spec.rb
radiant-archive-extension-1.0.4 spec/models/page_spec.rb