Sha256: c9948ef4bead000e0d3d41e474c297cff559f7094384384a746dd98e80f9bbf7

Contents?: true

Size: 1.08 KB

Versions: 11

Compression:

Stored size: 1.08 KB

Contents

require "spec_helper"

describe ActiveAdmin::Views::Pages::Form do
  describe "#title" do
    let!(:application){ ActiveAdmin::Application.new }
    let(:namespace){ ActiveAdmin::Namespace.new(application, "Admin") }
    let!(:params){ { :controller => "UsersController", :action => "edit" } }
    let(:helpers) do
      helpers = mock_action_view
      helpers.stub :active_admin_config => namespace.register(Post),
                   :params => params

      helpers
    end

    let(:arbre_context) do
      OpenStruct.new(:params => params, :helpers => helpers, :assigns => {})
    end

    context "when page_title is assigned" do
      it "should show the set page title" do
        arbre_context.assigns[:page_title] = "My Page Title"
        page = ActiveAdmin::Views::Pages::Form.new(arbre_context)
        page.title.should eq "My Page Title"
      end
    end

    context "when page_title is not assigned" do
      it "should show the correct I18n text" do
        page = ActiveAdmin::Views::Pages::Form.new(arbre_context)
        page.title.should eq "Edit Post"
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
activeadmin-0.6.6 spec/unit/views/pages/form_spec.rb
activeadmin-0.6.5 spec/unit/views/pages/form_spec.rb
activeadmin-0.6.4 spec/unit/views/pages/form_spec.rb
yousty-activeadmin-1.0.4.pre spec/unit/views/pages/form_spec.rb
yousty-activeadmin-1.0.3.pre spec/unit/views/pages/form_spec.rb
yousty-activeadmin-1.0.2.pre spec/unit/views/pages/form_spec.rb
activeadmin-0.6.3 spec/unit/views/pages/form_spec.rb
yousty-activeadmin-1.0.1.pre spec/unit/views/pages/form_spec.rb
yousty-activeadmin-1.0.0.pre spec/unit/views/pages/form_spec.rb
activeadmin-0.6.2 spec/unit/views/pages/form_spec.rb
activeadmin-0.6.1 spec/unit/views/pages/form_spec.rb