Sha256: c8aa1015e6b186886634966d7c2b4e33fcc00f08a8d0fe060ee3a3bee761307f

Contents?: true

Size: 1.02 KB

Versions: 16

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'

describe RailsAdmin::ApplicationController do
  describe "#to_model_name" do
    it "works with modules" do
      expect(controller.to_model_name("conversations~conversation")).to eq("Conversations::Conversation")
    end
  end

  describe "helper method _get_plugin_name" do
    it "works by default" do
      expect(controller.send(:_get_plugin_name)).to eq(['Dummy App', 'Admin'])
    end

    it "works for static names" do
      RailsAdmin.config do |config|
        config.main_app_name = ['static','value']
      end
      expect(controller.send(:_get_plugin_name)).to eq(['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"
      expect(controller.send(:_get_plugin_name)).to eq(["Dummy App Application", "Dashboard"])
    end
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
rails_admin-0.6.0 spec/controllers/rails_admin/application_controller_spec.rb
rails_admin-0.5.0 spec/controllers/rails_admin/application_controller_spec.rb
rails_admin-0.4.9 spec/controllers/rails_admin/application_controller_spec.rb
rails_admin-0.4.8 spec/controllers/rails_admin/application_controller_spec.rb
rails_admin-0.4.7 spec/controllers/rails_admin/application_controller_spec.rb
rails_admin-0.4.6 spec/controllers/rails_admin/application_controller_spec.rb
rails_admin-0.4.5 spec/controllers/rails_admin/application_controller_spec.rb
rails_admin-0.4.4 spec/controllers/rails_admin/application_controller_spec.rb
rails_admin-lbgraham-0.4.2 spec/controllers/rails_admin/application_controller_spec.rb
rails_admin-0.4.3 spec/controllers/rails_admin/application_controller_spec.rb
rails_admin-0.4.2 spec/controllers/rails_admin/application_controller_spec.rb
rails_admin-0.4.1 spec/controllers/rails_admin/application_controller_spec.rb
rails_admin-0.4.0 spec/controllers/rails_admin/application_controller_spec.rb
rails_admin-0.3.0 spec/controllers/application_controller_spec.rb
rails_admin-0.2.0 spec/controllers/application_controller_spec.rb
rails_admin-0.1.2 spec/controllers/application_controller_spec.rb