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.74 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.73 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.72 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.71 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.66 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.65 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
activeadmin-0.6.0 spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.64 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.63 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.62 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.61 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.60 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.59 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.58 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.57 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.56 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.50 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
lalala-4.0.0.dev.46 vendor/deps/active_admin/spec/unit/batch_actions/settings_spec.rb
activeadmin-0.5.1 spec/unit/batch_actions/settings_spec.rb
activeadmin-0.5.0 spec/unit/batch_actions/settings_spec.rb