Sha256: d01095c466114828586a3231fab202a33d0281d6fdbe895f351715eeadd62f08

Contents?: true

Size: 1.19 KB

Versions: 5

Compression:

Stored size: 1.19 KB

Contents

require 'spec_helper'

describe Refinery::PageImages::Engine do
  before(:all) do
    class Refinery::PageImages::EnableForMock
      class Model; end
      class Tab; end
    end
  end

  after(:all) do
    Refinery::PageImages.instance_eval { remove_const(:EnableForMock) }
  end

  before(:each) do
    Refinery::PageImages.config.stub(:enable_for).and_return(enable_for_config)
  end

  def enable_for_config
    [{ :model => 'Refinery::PageImages::EnableForMock::Model',
       :tab => 'Refinery::PageImages::EnableForMock::Tab' }]
  end

  describe "attach initializer" do
    it "calls attach on all configured model" do
      Refinery::PageImages.config.stub(:enable_for).and_return(enable_for_config)

      Refinery::PageImages::EnableForMock::Model.should_receive(:has_many_page_images).once
      Refinery::Page.should_not_receive(:has_many_page_images)
      ActionDispatch::Reloader.prepare!
    end
  end

  describe "attach_initialize_tabs!" do
    it "registers tabs for all configured engine" do
      Refinery::PageImages::EnableForMock::Tab.should_receive(:register).once
      Refinery::Pages::Tab.should_not_receive(:register)
      Refinery::PageImages::Engine.initialize_tabs!
    end
  end

end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
refinerycms-page-images-2.1.1 spec/lib/refinery/initializer_spec.rb
refinerycms-page-options-2.1.2 spec/lib/refinery/initializer_spec.rb
refinerycms-page-options-2.1.1 spec/lib/refinery/initializer_spec.rb
refinerycms-page-options-2.1.0 spec/lib/refinery/initializer_spec.rb
refinerycms-page-images-2.1.0 spec/lib/refinery/initializer_spec.rb