Sha256: 52c98e61a32a6fee1ab97921aad0ac3c4ab5fd868d2a8b39b9218c3b64fd0259

Contents?: true

Size: 1.95 KB

Versions: 47

Compression:

Stored size: 1.95 KB

Contents

require 'spec_helper'

describe ActiveAdmin::Views::Pages::Layout do

  let(:assigns){ {} }
  let(:helpers) do 
    helpers = mock_action_view

    helpers.stub :active_admin_application => active_admin_application,
                 :active_admin_config => mock('Config', :action_items? => nil, :breadcrumb => nil, :sidebar_sections? => nil),
                 :active_admin_namespace => active_admin_namespace,
                 :breadcrumb_links => [],
                 :content_for => "",
                 :csrf_meta_tag => "",
                 :current_active_admin_user => nil,
                 :current_active_admin_user? => false,
                 :current_menu => mock('Menu', :items => []),
                 :flash => {},
                 :javascript_path => "/dummy/",
                 :link_to => "",
                 :render_or_call_method_or_proc_on => "",
                 :stylesheet_link_tag => mock(:html_safe => ""),
                 :view_factory => view_factory,
                 :params => {:controller => 'UsersController', :action => 'edit'}

    helpers
  end

  let(:active_admin_namespace){ ActiveAdmin::Namespace.new(ActiveAdmin::Application.new, :myspace) }
  let(:active_admin_application){ ActiveAdmin.application }
  let(:view_factory) { ActiveAdmin::ViewFactory.new }

  let(:layout) do
    render_arbre_component assigns, helpers do
      insert_tag ActiveAdmin::Views::Pages::Layout
    end
  end

  it "should be the @page_title if assigned in the controller" do
    assigns[:page_title] = "My Page Title"

    layout.title.should == "My Page Title"
  end

  it "should be the default translation" do
    helpers.params[:action] = "edit"

    layout.title.should == "Edit"
  end

  describe "the body" do

    it "should have class 'active_admin'" do
      layout.build.class_list.should include 'active_admin'
    end

    it "should have namespace class" do
      layout.build.class_list.should include "#{active_admin_namespace.name}_namespace"
    end

  end

end

Version data entries

47 entries across 47 versions & 2 rubygems

Version Path
lalala-4.0.0.dev.141 vendor/deps/active_admin/spec/unit/views/pages/layout_spec.rb
lalala-4.0.0.dev.136 vendor/deps/active_admin/spec/unit/views/pages/layout_spec.rb
lalala-4.0.0.dev.135 vendor/deps/active_admin/spec/unit/views/pages/layout_spec.rb
lalala-4.0.0.dev.134 vendor/deps/active_admin/spec/unit/views/pages/layout_spec.rb
lalala-4.0.0.dev.133 vendor/deps/active_admin/spec/unit/views/pages/layout_spec.rb
lalala-4.0.0.dev.132 vendor/deps/active_admin/spec/unit/views/pages/layout_spec.rb
lalala-4.0.0.dev.131 vendor/deps/active_admin/spec/unit/views/pages/layout_spec.rb
lalala-4.0.0.dev.129 vendor/deps/active_admin/spec/unit/views/pages/layout_spec.rb
lalala-4.0.0.dev.128 vendor/deps/active_admin/spec/unit/views/pages/layout_spec.rb
lalala-4.0.0.dev.126 vendor/deps/active_admin/spec/unit/views/pages/layout_spec.rb
lalala-4.0.0.dev.125 vendor/deps/active_admin/spec/unit/views/pages/layout_spec.rb
lalala-4.0.0.dev.124 vendor/deps/active_admin/spec/unit/views/pages/layout_spec.rb
lalala-4.0.0.dev.123 vendor/deps/active_admin/spec/unit/views/pages/layout_spec.rb
lalala-4.0.0.dev.118 vendor/deps/active_admin/spec/unit/views/pages/layout_spec.rb
lalala-4.0.0.dev.116 vendor/deps/active_admin/spec/unit/views/pages/layout_spec.rb
lalala-4.0.0.dev.114 vendor/deps/active_admin/spec/unit/views/pages/layout_spec.rb
lalala-4.0.0.dev.113 vendor/deps/active_admin/spec/unit/views/pages/layout_spec.rb
lalala-4.0.0.dev.111 vendor/deps/active_admin/spec/unit/views/pages/layout_spec.rb
lalala-4.0.0.dev.109 vendor/deps/active_admin/spec/unit/views/pages/layout_spec.rb
lalala-4.0.0.dev.107 vendor/deps/active_admin/spec/unit/views/pages/layout_spec.rb