spec/unit/application_spec.rb in andrewroth_activeadmin-0.3.4 vs spec/unit/application_spec.rb in andrewroth_activeadmin-0.3.4.1
- old
+ new
@@ -37,21 +37,30 @@
it "should set the site's title link" do
application.site_title_link = "http://www.mygreatsite.com"
application.site_title_link.should == "http://www.mygreatsite.com"
end
+
+ it "should store the site's title image" do
+ application.site_title_image.should == ""
+ end
+
+ it "should set the site's title image" do
+ application.site_title_image = "http://railscasts.com/assets/episodes/stills/284-active-admin.png?1316476106"
+ application.site_title_image.should == "http://railscasts.com/assets/episodes/stills/284-active-admin.png?1316476106"
+ end
it "should have a view factory" do
application.view_factory.should be_an_instance_of(ActiveAdmin::ViewFactory)
end
it "should have deprecated admin notes by default" do
application.admin_notes.should be_nil
end
- it "should have admin notes in admin namespace by default" do
- application.allow_comments_in.should == [:admin]
+ it "should allow comments by default" do
+ application.allow_comments.should == true
end
describe "authentication settings" do
it "should have no default current_user_method" do
@@ -79,9 +88,46 @@
it "should load files from subdirectories" do
FileUtils.mkdir_p(File.expand_path("app/admin/public", Rails.root))
test_file = File.expand_path("app/admin/public/posts.rb", Rails.root)
FileUtils.touch(test_file)
application.files_in_load_path.should include(test_file)
+ end
+ end
+
+ describe "adding an inheritable setting" do
+
+ it "should add a setting to Application and Namespace" do
+ ActiveAdmin::Application.inheritable_setting :inheritable_setting, "inheritable_setting"
+ app = ActiveAdmin::Application.new
+ app.inheritable_setting.should == "inheritable_setting"
+ ns = ActiveAdmin::Namespace.new(app, :admin)
+ ns.inheritable_setting.should == "inheritable_setting"
+ end
+
+ end
+
+ describe "#namespace" do
+ it "should yield a new namespace" do
+ application.namespace :new_namespace do |ns|
+ ns.name.should == :new_namespace
+ end
+ end
+
+ it "should return an instantiated namespace" do
+ admin = application.find_or_create_namespace :admin
+ application.namespace :admin do |ns|
+ ns.should == admin
+ end
+ end
+ end
+
+ describe "#register_page" do
+ it "finds or create the namespace and register the page to it" do
+ namespace = mock
+ application.should_receive(:find_or_create_namespace).with("public").and_return namespace
+ namespace.should_receive(:register_page).with("My Page", {:namespace => "public"})
+
+ application.register_page("My Page", :namespace => "public")
end
end
end