Sha256: 2d7de3686225c704f53e680693f8c251b3f4841021611d4b545b3b5bd5b263b7
Contents?: true
Size: 1.44 KB
Versions: 9
Compression:
Stored size: 1.44 KB
Contents
require File.dirname(__FILE__) + "/../../spec_helper" describe Radiant::Config do before :each do @config = Radiant::Config set('test', 'cool') set('foo', 'bar') end it "should return the value of a key with the bracket accessor" do @config['test'].should == 'cool' end it "should return nil for keys that don't exist" do @config['non-existent-key'].should be_nil end it "should create a new key-value pair with the bracket accessor" do @config['new-key'] = "new-value" @config['new-key'].should == "new-value" end it "should set an existing key with the bracket accessor" do @config['foo'].should == 'bar' @config['foo'] = 'replaced' @config['foo'].should == 'replaced' end it "should convert to a hash" do @config.to_hash['test'].should == "cool" @config.to_hash['foo'].should == "bar" @config.to_hash.size.should >= 2 end describe "keys ending in '?'" do before :each do set('false?', false) set('true?', true) set('junk?', "some junk") end it "should return true or false" do @config['false?'].should be_false @config['true?'].should be_true end it "should return false for values that are not 'true'" do @config['junk?'].should be_false end end def set(key, value) setting = Radiant::Config.find_by_key(key) setting.destroy if setting Radiant::Config.new(:key => key, :value => value).save end end
Version data entries
9 entries across 9 versions & 1 rubygems