Sha256: 7f139e7a5de09bcda4d4151e8f1afc418991fa87c95110e4323464ac249468e1

Contents?: true

Size: 1.49 KB

Versions: 1

Compression:

Stored size: 1.49 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') 

describe "Registering an object to administer" do

  context "with no configuration" do
    it "should call register on the namespace" do
      namespace = ActiveAdmin::Namespace.new(:admin)
      ActiveAdmin.namespaces[namespace.name] = namespace
      namespace.should_receive(:register)

      ActiveAdmin.register Category
    end
  end

  context "with a different namespace" do
    it "should call register on the namespace" do
      namespace = ActiveAdmin::Namespace.new(:hello_world)
      ActiveAdmin.namespaces[namespace.name] = namespace
      namespace.should_receive(:register)

      ActiveAdmin.register Category, :namespace => :hello_world
    end
    it "should generate a path to the dashboard" do
      ActiveAdmin.register Category, :namespace => :hello_world
      reload_routes!
      Rails.application.routes.url_helpers.methods.should include("hello_world_dashboard_path")
    end
  end

  context "with no namespace" do
    it "should call register on the root namespace" do
      namespace = ActiveAdmin::Namespace.new(:root)
      ActiveAdmin.namespaces[namespace.name] = namespace
      namespace.should_receive(:register)

      ActiveAdmin.register Category, :namespace => false
    end

    it "should generate a path to the dashboard" do
      ActiveAdmin.register Category, :namespace => false
      reload_routes!
      Rails.application.routes.url_helpers.methods.should include("dashboard_path")
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activeadmin-0.1.0 spec/unit/registration_spec.rb