Sha256: 202e1a6c9ce4ae95045c5b161d7017db27111426956e4c789d0099f1a3934295

Contents?: true

Size: 948 Bytes

Versions: 9

Compression:

Stored size: 948 Bytes

Contents

# Required methods:
#   * controller_class
#   * controller
#
shared_examples_for "BaseController" do
  let(:controller_class) { described_class }

  describe "Menu" do
    describe "setting the current tab" do
      before do 
        controller.stub!(:active_admin_config => resource, :parent? => true)
        controller.send :set_current_tab # Run the before filter
      end
      subject{ controller.instance_variable_get(:@current_tab) }

      context "when menu item name is 'Resources' without a parent menu item" do
        let(:resource){ mock(:menu_item_name => "Resources", :parent_menu_item_name => nil, :belongs_to? => false) }
        it { should == "Resources" }
      end

      context "when there is a parent menu item of 'Admin'" do
        let(:resource){ mock(:parent_menu_item_name => "Admin", :menu_item_name => "Resources", :belongs_to? => false) }
        it { should == "Admin/Resources" }
      end
    end
  end

end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
activeadmin-0.4.4 spec/unit/base_controller_shared_examples.rb
activeadmin-0.4.3 spec/unit/base_controller_shared_examples.rb
activeadmin-0.4.2 spec/unit/base_controller_shared_examples.rb
activeadmin-0.4.1 spec/unit/base_controller_shared_examples.rb
activeadmin-0.4.0 spec/unit/base_controller_shared_examples.rb
andrewroth_activeadmin-0.3.4.4 spec/unit/base_controller_shared_examples.rb
andrewroth_activeadmin-0.3.4.3 spec/unit/base_controller_shared_examples.rb
andrewroth_activeadmin-0.3.4.2 spec/unit/base_controller_shared_examples.rb
andrewroth_activeadmin-0.3.4.1 spec/unit/base_controller_shared_examples.rb