Sha256: 883abecc26e41fc6e5382c55d1b57e41d30c8c05a9bbb16f66291e0620d2103c

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

require 'spec_helper'

describe RailsAdmin::ApplicationController do
  describe "#to_model_name" do
    it "handles classes nested in modules of the same name" do
      controller.to_model_name("conversations~conversations").should eq("Conversations::Conversation")
    end
  end
  
  describe "helper method _get_plugin_name" do
    it "works by default" do
      controller.send(:_get_plugin_name).should == ['Dummy App', 'Admin']
    end
    
    it "works for static names" do
      RailsAdmin.config do |config|
        config.main_app_name = ['static','value']
      end
      controller.send(:_get_plugin_name).should == ['static', 'value']
    end
    
    it "works for dynamic names in the controller context" do
      RailsAdmin.config do |config|
        config.main_app_name = Proc.new { |controller| [Rails.application.engine_name.try(:titleize), controller.params[:action].titleize] }
      end
      controller.params[:action] = "dashboard"
      controller.send(:_get_plugin_name).should == ["Dummy App Application", "Dashboard"]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
elucid-rails_admin-0.0.1 spec/controllers/application_controller_spec.rb