Sha256: 5244dcfcb445d66ea15ef5b9255cfb13c0df11dcd956852d45006c2b3fcc54b8
Contents?: true
Size: 1.7 KB
Versions: 1
Compression:
Stored size: 1.7 KB
Contents
# encoding: UTF-8 # # Copyright 2011 Brennan Frydl (http://bfrydl.com/) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. require 'spec_helper' describe Settis::Container do before :each do @container = Class.new do extend Settis::Container end end describe '#namespace' do it 'stores the namespace prefix for Redis keys' do @container.namespace.should == 'settings' @container.namespace 'test' @container.namespace.should == 'test' end end describe '#redis' do it 'returns a Redis::Namespace specific to the container' do stub(@container).namespace { 'configuration' } @container.redis.should be_a(Redis::Namespace) @container.redis.namespace.should == 'configuration' end end describe '#setting' do it 'defines a new setting' do mock(Settis::ScalarSetting).new(@container, 'title', is_a(Settis::StringSerializer), :default => 'Hello World') @container.setting :title, :string, :default => 'Hello World' end it 'does not allow duplicate names' do stub(Settis::ScalarSetting).new.once @container.setting :title, :string expect { @container.setting :title, :integer }.to raise_error(ArgumentError) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
settis-0.2.0 | spec/settis/container_spec.rb |