Sha256: 646e8612c8315d3ff2363358445298302aaed0963768766e918ec2b8c2163ea3

Contents?: true

Size: 1.58 KB

Versions: 25

Compression:

Stored size: 1.58 KB

Contents

shared_examples_for "ActiveAdmin::Resource" do
  describe "namespace" do
    it "should return the namespace" do
      expect(config.namespace).to eq(namespace)
    end
  end

  describe "page_presenters" do
    it "should return an empty hash by default" do
      expect(config.page_presenters).to eq({})
    end
  end

  it { respond_to :controller_name }
  it { respond_to :controller }
  it { respond_to :route_prefix }
  it { respond_to :route_collection_path }
  it { respond_to :comments? }
  it { respond_to :belongs_to? }
  it { respond_to :action_items? }
  it { respond_to :sidebar_sections? }

  describe "Naming" do
    it "implements #resource_label" do
      expect { config.resource_label }.to_not raise_error
    end

    it "implements #plural_resource_label" do
      expect { config.plural_resource_label }.to_not raise_error
    end
  end

  describe "Menu" do
    describe "#menu_item_options" do

      it "initializes a new menu item with defaults" do
          expect(config.menu_item_options[:label].call).to eq(config.plural_resource_label)
      end

      it "initialize a new menu item with custom options" do
        config.menu_item_options = { label: "Hello" }
        expect(config.menu_item_options[:label]).to eq("Hello")
      end

    end

    describe "#include_in_menu?" do
      it "should be included in menu by default" do
        expect(config.include_in_menu?).to eq(true)
      end

      it "should not be included in menu when menu set to false" do
        config.menu_item_options = false
        expect(config.include_in_menu?).to eq(false)
      end
    end

  end
end

Version data entries

25 entries across 25 versions & 4 rubygems

Version Path
activeadmin_addons-1.1.2 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-a5a53c3f2b8f/spec/unit/config_shared_examples.rb
activeadmin_addons-1.1.1 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/spec/unit/config_shared_examples.rb
yousty-activeadmin-1.0.17.pre spec/unit/config_shared_examples.rb
yousty-activeadmin-1.0.16.pre spec/unit/config_shared_examples.rb
activeadmin_addons-1.1.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/spec/unit/config_shared_examples.rb
activeadmin_addons-1.0.1 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/spec/unit/config_shared_examples.rb
activeadmin_addons-1.0.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/spec/unit/config_shared_examples.rb
yousty-activeadmin-1.0.15.pre spec/unit/config_shared_examples.rb
activeadmin-orac-1.0.0.pre4 spec/unit/config_shared_examples.rb
activeadmin-orac-1.0.0 spec/unit/config_shared_examples.rb
activeadmin-orac-1.0.0.pre.orac spec/unit/config_shared_examples.rb
yousty-activeadmin-1.0.14.pre spec/unit/config_shared_examples.rb
yousty-activeadmin-1.0.13.pre spec/unit/config_shared_examples.rb
yousty-activeadmin-1.0.12.pre spec/unit/config_shared_examples.rb
yousty-activeadmin-1.0.11.pre spec/unit/config_shared_examples.rb
yousty-activeadmin-1.0.10.pre spec/unit/config_shared_examples.rb
yousty-activeadmin-1.0.9.pre spec/unit/config_shared_examples.rb
yousty-activeadmin-1.0.8.pre spec/unit/config_shared_examples.rb
activeadmin-1.0.0.pre4 spec/unit/config_shared_examples.rb
activeadmin-1.0.0.pre3 spec/unit/config_shared_examples.rb