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
lalala-4.0.0.dev.128 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.126 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.125 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.124 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.123 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.118 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.116 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.114 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.113 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.111 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.109 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.107 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.94 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.92 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.90 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.84 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.80 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.79 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.78 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.77 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb