Sha256: 23d928fb08ea08ba680f8c518ba6d3b64bfb11f8034e5385433ecd9469727c23

Contents?: true

Size: 1.3 KB

Versions: 69

Compression:

Stored size: 1.3 KB

Contents

require 'spec_helper' 

describe ActiveAdmin::Dashboards::Section do

  def section(options = {})
    name = options.delete(:name) || "Recent Posts"
    ActiveAdmin::Dashboards::Section.new(:admin, name, options){ }
  end

  describe "accessors" do
    it "should have a namespace" do
      section.namespace.should == :admin
    end

    it "should have a block" do
      section.block.class.should == Proc
    end

    it "should have a name" do
      section.name.should == 'Recent Posts'
    end
  end

  describe "priority" do
    context "when not set" do
      subject{ section.priority }
      it { should == ActiveAdmin::Dashboards::Section::DEFAULT_PRIORITY }
    end

    context "when set" do
      subject{ section(:priority => 1).priority }
      it { should == 1 }
    end
  end

  describe "icon" do
    it "should set the icon" do
      s = section(:icon => :my_icon)
      s.icon.should == :my_icon
    end
    it "should be nil by default" do
      section.icon.should be_nil
    end
  end

  describe "sorting sections" do
    it "should sort by priority then alpha" do
      s1 = section :name => "Woot"
      s2 = section :name => :Alpha
      s3 = section :name => "Zulu", :priority => 1
      s4 = section :name => "Beta", :priority => 100
      [s1,s2,s3,s4].sort.should == [s3, s2, s1, s4]
    end
  end

end

Version data entries

69 entries across 69 versions & 5 rubygems

Version Path
lalala-4.0.0.dev.141 vendor/deps/active_admin/spec/unit/dashboard_section_spec.rb
lalala-4.0.0.dev.136 vendor/deps/active_admin/spec/unit/dashboard_section_spec.rb
lalala-4.0.0.dev.135 vendor/deps/active_admin/spec/unit/dashboard_section_spec.rb
lalala-4.0.0.dev.134 vendor/deps/active_admin/spec/unit/dashboard_section_spec.rb
lalala-4.0.0.dev.133 vendor/deps/active_admin/spec/unit/dashboard_section_spec.rb
lalala-4.0.0.dev.132 vendor/deps/active_admin/spec/unit/dashboard_section_spec.rb
lalala-4.0.0.dev.131 vendor/deps/active_admin/spec/unit/dashboard_section_spec.rb
lalala-4.0.0.dev.129 vendor/deps/active_admin/spec/unit/dashboard_section_spec.rb
lalala-4.0.0.dev.128 vendor/deps/active_admin/spec/unit/dashboard_section_spec.rb
lalala-4.0.0.dev.126 vendor/deps/active_admin/spec/unit/dashboard_section_spec.rb
lalala-4.0.0.dev.125 vendor/deps/active_admin/spec/unit/dashboard_section_spec.rb
lalala-4.0.0.dev.124 vendor/deps/active_admin/spec/unit/dashboard_section_spec.rb
lalala-4.0.0.dev.123 vendor/deps/active_admin/spec/unit/dashboard_section_spec.rb
lalala-4.0.0.dev.118 vendor/deps/active_admin/spec/unit/dashboard_section_spec.rb
lalala-4.0.0.dev.116 vendor/deps/active_admin/spec/unit/dashboard_section_spec.rb
lalala-4.0.0.dev.114 vendor/deps/active_admin/spec/unit/dashboard_section_spec.rb
lalala-4.0.0.dev.113 vendor/deps/active_admin/spec/unit/dashboard_section_spec.rb
lalala-4.0.0.dev.111 vendor/deps/active_admin/spec/unit/dashboard_section_spec.rb
lalala-4.0.0.dev.109 vendor/deps/active_admin/spec/unit/dashboard_section_spec.rb
lalala-4.0.0.dev.107 vendor/deps/active_admin/spec/unit/dashboard_section_spec.rb