Sha256: d76aec25e427a1513994d3f70bb9ea7e227e588d9d4b776a2664a4fd849738e3

Contents?: true

Size: 719 Bytes

Versions: 5

Compression:

Stored size: 719 Bytes

Contents

require 'spec_helper'
require 'active_admin/helpers/settings'

describe ActiveAdmin::Settings do

  # A Class with settings module included
  let(:klass) do
    Class.new do
      include ActiveAdmin::Settings
    end
  end

  it "should add a new setting with a default" do
    klass.setting :my_setting, "Hello World"
    expect(klass.default_settings[:my_setting]).to eq "Hello World"
  end

  it "should initialize the defaults" do
    klass.setting :my_setting, "Hello World"
    expect(klass.new.my_setting).to eq "Hello World"
  end

  it "should support settings of nil" do
    klass.setting :my_setting, :some_val
    inst = klass.new
    inst.my_setting = nil
    expect(inst.my_setting).to eq nil
  end

end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
active_administration-0.0.3 spec/unit/helpers/settings_spec.rb
activeadministration-0.0.2 spec/unit/helpers/settings_spec.rb
active_administration-0.0.2 spec/unit/helpers/settings_spec.rb
activeadministration-0.0.1 spec/unit/helpers/settings_spec.rb
active_administration-0.0.1 spec/unit/helpers/settings_spec.rb