Sha256: 105a9966b9d221777cb6ad80522a2b7dbcd94902d7f8d6fb1d06584ddbf3adb8

Contents?: true

Size: 1.83 KB

Versions: 62

Compression:

Stored size: 1.83 KB

Contents

require 'spec_helper'

describe "Batch Actions Settings" do
  let(:app) { ActiveAdmin::Application.new }
  let(:ns) { ActiveAdmin::Namespace.new(app, "Admin") }
  let(:post_resource) { ns.register Post }

  it "should be disabled globally by default" do
    # Note: the default initializer would set it to true

    app.batch_actions.should be_false
    ns.batch_actions.should be_false
    post_resource.batch_actions_enabled?.should be_false
  end

  it "should be settable to true" do
    app.batch_actions = true
    app.batch_actions.should == true
  end

  it "should be an inheritable_setting" do
    app.batch_actions = true
    ns.batch_actions.should == true
  end

  it "should be settable at the namespace level" do
    app.batch_actions = true
    ns.batch_actions = false

    app.batch_actions.should == true
    ns.batch_actions.should == false
  end

  it "should be settable at the resource level" do
    post_resource.batch_actions_enabled?.should == false
    post_resource.batch_actions = true
    post_resource.batch_actions_enabled?.should == true
  end

  it "should inherit the setting on the resource from the namespace" do
    ns.batch_actions = false
    post_resource.batch_actions_enabled?.should == false
    post_resource.batch_actions.should be_empty

    post_resource.batch_actions = true
    post_resource.batch_actions_enabled?.should == true
    post_resource.batch_actions.should_not be_empty
  end

  it "should inherit the setting from the namespace when set to nil" do
    ns.batch_actions = true

    post_resource.batch_actions = true
    post_resource.batch_actions_enabled?.should == true
    post_resource.batch_actions.should_not be_empty

    post_resource.batch_actions = nil
    post_resource.batch_actions_enabled?.should == true # inherited from namespace
    post_resource.batch_actions.should_not be_empty
  end
end

Version data entries

62 entries across 62 versions & 4 rubygems

Version Path
activeadmin-0.6.6 spec/unit/batch_actions/settings_spec.rb
activeadmin-0.6.5 spec/unit/batch_actions/settings_spec.rb
activeadmin-0.6.4 spec/unit/batch_actions/settings_spec.rb
yousty-activeadmin-1.0.4.pre spec/unit/batch_actions/settings_spec.rb
yousty-activeadmin-1.0.3.pre spec/unit/batch_actions/settings_spec.rb
yousty-activeadmin-1.0.2.pre spec/unit/batch_actions/settings_spec.rb
activeadmin-0.6.3 spec/unit/batch_actions/settings_spec.rb
yousty-activeadmin-1.0.1.pre spec/unit/batch_actions/settings_spec.rb
yousty-activeadmin-1.0.0.pre spec/unit/batch_actions/settings_spec.rb
activeadmin-0.6.2 spec/unit/batch_actions/settings_spec.rb
activeadmin-0.6.1 spec/unit/batch_actions/settings_spec.rb
aa-rails4-0.6.0 spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.141 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.136 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.135 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.134 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.133 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.132 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.131 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.129 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb