Sha256: 75ddca28cd8e61e58e673d52616b50050d1154e0b19bd4bc72c23150ce55c3ab

Contents?: true

Size: 1.69 KB

Versions: 25

Compression:

Stored size: 1.69 KB

Contents

require 'rails_helper'

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

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

    { active_admin_application:   active_admin_application,
      active_admin_config:        double('Config', action_items?: nil, breadcrumb: nil, sidebar_sections?: nil),
      active_admin_namespace:     active_admin_namespace,
      csrf_meta_tag:              '',
      current_active_admin_user:  nil,
      current_active_admin_user?: false,
      current_menu:               double('Menu', items: []),
      params:                     {controller: 'UsersController', action: 'edit'},
      env:                        {}
    }.each do |method, returns|
      allow(helpers).to receive(method).and_return returns
    end

    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"

    expect(layout.title).to eq "My Page Title"
  end

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

    expect(layout.title).to eq "Edit"
  end

  describe "the body" do

    it "should have class 'active_admin'" do
      expect(layout.build.class_list).to include 'active_admin'
    end

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

  end

end

Version data entries

25 entries across 25 versions & 4 rubygems

Version Path
activeadmin_addons-1.1.2 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-a5a53c3f2b8f/spec/unit/views/pages/layout_spec.rb
activeadmin_addons-1.1.1 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/spec/unit/views/pages/layout_spec.rb
yousty-activeadmin-1.0.17.pre spec/unit/views/pages/layout_spec.rb
yousty-activeadmin-1.0.16.pre spec/unit/views/pages/layout_spec.rb
activeadmin_addons-1.1.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/spec/unit/views/pages/layout_spec.rb
activeadmin_addons-1.0.1 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/spec/unit/views/pages/layout_spec.rb
activeadmin_addons-1.0.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/spec/unit/views/pages/layout_spec.rb
yousty-activeadmin-1.0.15.pre spec/unit/views/pages/layout_spec.rb
activeadmin-orac-1.0.0.pre4 spec/unit/views/pages/layout_spec.rb
activeadmin-orac-1.0.0 spec/unit/views/pages/layout_spec.rb
activeadmin-orac-1.0.0.pre.orac spec/unit/views/pages/layout_spec.rb
yousty-activeadmin-1.0.14.pre spec/unit/views/pages/layout_spec.rb
yousty-activeadmin-1.0.13.pre spec/unit/views/pages/layout_spec.rb
yousty-activeadmin-1.0.12.pre spec/unit/views/pages/layout_spec.rb
yousty-activeadmin-1.0.11.pre spec/unit/views/pages/layout_spec.rb
yousty-activeadmin-1.0.10.pre spec/unit/views/pages/layout_spec.rb
yousty-activeadmin-1.0.9.pre spec/unit/views/pages/layout_spec.rb
yousty-activeadmin-1.0.8.pre spec/unit/views/pages/layout_spec.rb
activeadmin-1.0.0.pre4 spec/unit/views/pages/layout_spec.rb
activeadmin-1.0.0.pre3 spec/unit/views/pages/layout_spec.rb