spec/unit/routing_spec.rb in activeadmin-0.4.4 vs spec/unit/routing_spec.rb in activeadmin-0.5.0.pre
- old
+ new
@@ -1,29 +1,75 @@
+# encoding: utf-8
+
require 'spec_helper'
describe ActiveAdmin, "Routing", :type => :routing do
- before :each do
+ before do
load_defaults!
reload_routes!
end
include Rails.application.routes.url_helpers
- describe "dashboard" do
- context "when in admin namespace" do
- it "should route the admin dashboard" do
- admin_dashboard_path.should == "/admin"
+ describe "root" do
+ before do
+ pending "Y U NO PASS?"
+ end
+ context "when default configuration" do
+ context "when in admin namespace" do
+ it "should route the admin dashboard" do
+ get('/admin').should route_to('admin/dashboard#index')
+ end
end
+
+ context "when in root namespace" do
+ before(:each) do
+ load_resources { ActiveAdmin.register(Post, :namespace => false) }
+ reload_routes!
+ end
+
+ it "should route the root dashboard" do
+ pending "Y U NO PASS?"
+
+ get('/').should route_to('dashboard#index')
+ end
+ end
end
- context "when in root namespace" do
- before(:each) do
- load_resources { ActiveAdmin.register(Post, :namespace => false) }
+
+ context "when customized configuration to root to post#index" do
+ before do
+ @original_root = ActiveAdmin.application.root_to
+ ActiveAdmin.application.root_to = "posts#index"
end
- it "should route the root dashboard" do
- dashboard_path.should == "/"
+
+ after do
+ ActiveAdmin.application.root_to = @original_root
+ reload_routes!
end
+
+ context "when in admin namespace" do
+ before do
+ load_resources { ActiveAdmin.register(Post) }
+ end
+
+ it "should route to admin/posts#index" do
+ get('/admin').should route_to('admin/posts#index')
+ end
+ end
+
+ context "when in root namespace" do
+ before do
+ load_resources { ActiveAdmin.register(Post, :namespace => false) }
+ end
+
+ it "should route to posts#index" do
+ pending "Y U NO PASS?"
+
+ get('/').should route_to('posts#index')
+ end
+ end
end
end
describe "standard resources" do
context "when in admin namespace" do
@@ -104,23 +150,23 @@
end
describe "page" do
context "when default namespace" do
before(:each) do
- load_resources { ActiveAdmin.register_page("Status") }
+ load_resources { ActiveAdmin.register_page("Chocolate I lØve You!") }
end
it "should route to the page under /admin" do
- admin_status_path.should == "/admin/status"
+ admin_chocolate_i_love_you_path.should == "/admin/chocolate_i_love_you"
end
context "when in the root namespace" do
before(:each) do
- load_resources { ActiveAdmin.register_page("Status", :namespace => false) }
+ load_resources { ActiveAdmin.register_page("Chocolate I lØve You!", :namespace => false) }
end
it "should route to page under /" do
- status_path.should == "/status"
+ chocolate_i_love_you_path.should == "/chocolate_i_love_you"
end
end
context "when singular page name" do
before(:each) do