Sha256: 102dcb1704037db86c14d12bb209e71b6791dea9d7c92813dea59c0812cf4e00

Contents?: true

Size: 1.07 KB

Versions: 25

Compression:

Stored size: 1.07 KB

Contents

require 'rails_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
      expect(resource.sidebar_sections.size).to eq(1)
    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
      expect(resource.sidebar_sections.size).to eq(2)
      expect(resource.sidebar_sections_for("index")).to eq [only_index]
    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/resource/sidebars_spec.rb
activeadmin_addons-1.1.1 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/spec/unit/resource/sidebars_spec.rb
yousty-activeadmin-1.0.17.pre spec/unit/resource/sidebars_spec.rb
yousty-activeadmin-1.0.16.pre spec/unit/resource/sidebars_spec.rb
activeadmin_addons-1.1.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/spec/unit/resource/sidebars_spec.rb
activeadmin_addons-1.0.1 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/spec/unit/resource/sidebars_spec.rb
activeadmin_addons-1.0.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/spec/unit/resource/sidebars_spec.rb
yousty-activeadmin-1.0.15.pre spec/unit/resource/sidebars_spec.rb
activeadmin-orac-1.0.0.pre4 spec/unit/resource/sidebars_spec.rb
activeadmin-orac-1.0.0 spec/unit/resource/sidebars_spec.rb
activeadmin-orac-1.0.0.pre.orac spec/unit/resource/sidebars_spec.rb
yousty-activeadmin-1.0.14.pre spec/unit/resource/sidebars_spec.rb
yousty-activeadmin-1.0.13.pre spec/unit/resource/sidebars_spec.rb
yousty-activeadmin-1.0.12.pre spec/unit/resource/sidebars_spec.rb
yousty-activeadmin-1.0.11.pre spec/unit/resource/sidebars_spec.rb
yousty-activeadmin-1.0.10.pre spec/unit/resource/sidebars_spec.rb
yousty-activeadmin-1.0.9.pre spec/unit/resource/sidebars_spec.rb
yousty-activeadmin-1.0.8.pre spec/unit/resource/sidebars_spec.rb
activeadmin-1.0.0.pre4 spec/unit/resource/sidebars_spec.rb
activeadmin-1.0.0.pre3 spec/unit/resource/sidebars_spec.rb