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.59 vendor/deps/active_admin/spec/unit/views/pages/layout_spec.rb
lalala-4.0.0.dev.58 vendor/deps/active_admin/spec/unit/views/pages/layout_spec.rb
lalala-4.0.0.dev.57 vendor/deps/active_admin/spec/unit/views/pages/layout_spec.rb
lalala-4.0.0.dev.56 vendor/deps/active_admin/spec/unit/views/pages/layout_spec.rb
lalala-4.0.0.dev.50 vendor/deps/active_admin/spec/unit/views/pages/layout_spec.rb
lalala-4.0.0.dev.46 vendor/deps/active_admin/spec/unit/views/pages/layout_spec.rb
activeadmin-0.5.1 spec/unit/views/pages/layout_spec.rb