Sha256: 5a563ec533b59f0b780d19033e5f5e1e423f397554c1d13e2b051e8a7dbd3401

Contents?: true

Size: 1.06 KB

Versions: 62

Compression:

Stored size: 1.06 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

end

Version data entries

62 entries across 62 versions & 4 rubygems

Version Path
lalala-4.0.0.dev.128 vendor/deps/active_admin/spec/unit/resource/sidebars_spec.rb
lalala-4.0.0.dev.126 vendor/deps/active_admin/spec/unit/resource/sidebars_spec.rb
lalala-4.0.0.dev.125 vendor/deps/active_admin/spec/unit/resource/sidebars_spec.rb
lalala-4.0.0.dev.124 vendor/deps/active_admin/spec/unit/resource/sidebars_spec.rb
lalala-4.0.0.dev.123 vendor/deps/active_admin/spec/unit/resource/sidebars_spec.rb
lalala-4.0.0.dev.118 vendor/deps/active_admin/spec/unit/resource/sidebars_spec.rb
lalala-4.0.0.dev.116 vendor/deps/active_admin/spec/unit/resource/sidebars_spec.rb
lalala-4.0.0.dev.114 vendor/deps/active_admin/spec/unit/resource/sidebars_spec.rb
lalala-4.0.0.dev.113 vendor/deps/active_admin/spec/unit/resource/sidebars_spec.rb
lalala-4.0.0.dev.111 vendor/deps/active_admin/spec/unit/resource/sidebars_spec.rb
lalala-4.0.0.dev.109 vendor/deps/active_admin/spec/unit/resource/sidebars_spec.rb
lalala-4.0.0.dev.107 vendor/deps/active_admin/spec/unit/resource/sidebars_spec.rb
lalala-4.0.0.dev.94 vendor/deps/active_admin/spec/unit/resource/sidebars_spec.rb
lalala-4.0.0.dev.92 vendor/deps/active_admin/spec/unit/resource/sidebars_spec.rb
lalala-4.0.0.dev.90 vendor/deps/active_admin/spec/unit/resource/sidebars_spec.rb
lalala-4.0.0.dev.84 vendor/deps/active_admin/spec/unit/resource/sidebars_spec.rb
lalala-4.0.0.dev.80 vendor/deps/active_admin/spec/unit/resource/sidebars_spec.rb
lalala-4.0.0.dev.79 vendor/deps/active_admin/spec/unit/resource/sidebars_spec.rb
lalala-4.0.0.dev.78 vendor/deps/active_admin/spec/unit/resource/sidebars_spec.rb
lalala-4.0.0.dev.77 vendor/deps/active_admin/spec/unit/resource/sidebars_spec.rb