Sha256: 0c066655cc61f821a81db986ba48c451581cdea0badd31bf8d49b8603a3c418a

Contents?: true

Size: 961 Bytes

Versions: 1

Compression:

Stored size: 961 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Settings do

  it "should works as RailsSettings" do
    email = "my@mail.ru"
    Settings.email = email
    Settings.email.should == email
  end

  it "should save default" do
    email = "my@mail.ru"
    email2 = "my2@mail.ru"
    Settings.save_default(:email, email)
    Settings.email.should == email
    Settings.email = email2
    Settings.email.should == email2
    Settings.save_default(:email, email)
    Settings.email.should == email2
  end

  it 'should properly unload' do
    Settings.class_eval { cattr_accessor :loaded }
    Settings.load!
    Settings.loaded.should eq true
    Settings.unload!
    Settings.loaded.should eq false
  end

  it 'should support yaml type' do
    Settings.tdata(type: 'yaml')
    Settings.tdata = ['one', 'two', 'three']
    YAML.safe_load(Settings.get(:tdata).raw).should eq ['one', 'two', 'three']
    Settings.tdata.should eq ['one', 'two', 'three']
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_admin_settings-0.1.0 spec/settings_spec.rb