Sha256: 83cdd0e51ca78ed850927c60e6de83c3fb3d6dbf0e78f5bd9d9d5bdf02a9fa89

Contents?: true

Size: 1.23 KB

Versions: 16

Compression:

Stored size: 1.23 KB

Contents

require 'spec_helper'

describe ActiveAdmin::Resource::Sidebars do

  let(:resource) do
    namespace = ActiveAdmin::Namespace.new(ActiveAdmin::Application.new, :admin)
    namespace.register(Post)
  end

  let(:sidebar) { ActiveAdmin::SidebarSection.new(:help) }

  describe "adding a new sidebar section" do

    before do
      resource.clear_sidebar_sections!
      resource.sidebar_sections << sidebar
    end

    it "should add a sidebar section" do
      resource.should have(1).sidebar_sections
    end

  end

  describe "retrieving sections for a controller action" do

    let(:only_index){ ActiveAdmin::SidebarSection.new(:help, :only => :index) }
    let(:only_show){ ActiveAdmin::SidebarSection.new(:help, :only => :show) }

    before do
      resource.clear_sidebar_sections!
      resource.sidebar_sections << only_index
      resource.sidebar_sections << only_show
    end

    it "should only return the relevant action items" do
      resource.should have(2).sidebar_sections
      resource.sidebar_sections_for("index").should == [only_index]
    end

  end

  describe "default sidebar sections" do

    it "should have a filters section by default" do
      resource.sidebar_sections.first.name.should == :filters
    end

  end
end

Version data entries

16 entries across 16 versions & 3 rubygems

Version Path
activeadmin-0.4.4 spec/unit/resource/sidebars_spec.rb
activeadmin-0.4.3 spec/unit/resource/sidebars_spec.rb
activeadmin-0.4.2 spec/unit/resource/sidebars_spec.rb
activeadmin-0.4.1 spec/unit/resource/sidebars_spec.rb
activeadmin-0.4.0 spec/unit/resource/sidebars_spec.rb
andrewroth_activeadmin-0.3.4.4 spec/unit/resource/sidebars_spec.rb
andrewroth_activeadmin-0.3.4.3 spec/unit/resource/sidebars_spec.rb
andrewroth_activeadmin-0.3.4.2 spec/unit/resource/sidebars_spec.rb
andrewroth_activeadmin-0.3.4.1 spec/unit/resource/sidebars_spec.rb
andrewroth_activeadmin-0.3.4 spec/unit/resource/sidebars_spec.rb
activeadmin-0.3.4 spec/unit/resource/sidebars_spec.rb
activeadmin-0.3.3 spec/unit/resource/sidebars_spec.rb
activeadmin-0.3.2 spec/unit/resource/sidebars_spec.rb
activeadmin-0.3.1 spec/unit/resource/sidebars_spec.rb
activeadmin-0.3.0 spec/unit/resource/sidebars_spec.rb
nsm-activeadmin-0.2.2 spec/unit/resource/sidebars_spec.rb