Skip to content
Newer
Older
100644 60 lines (44 sloc) 1.28 KB
c0b3635 initial commit
chatgris authored Sep 28, 2011
1 # encoding: utf-8
2 require 'spec_helper'
3
4 describe Gaston::Store do
5 let(:store) { Gaston::Store.new({:config => 'test'})}
6 let(:multi_store) do
7 Gaston::Store.new({:config => 'test',
44d47a4 Fix unexpected method overwrite.
chatgris authored Jan 29, 2012
8 :nested => {:one => :level, :nested => {:two => ['warp', :zone]},
9 :spk => {:one => :bim}
10 }
c0b3635 initial commit
chatgris authored Sep 28, 2011
11 })
12 end
13
14 describe 'one level store' do
15
16 context 'existing method' do
17 it 'should return value through method' do
18 store.config.should eq('test')
19 end
20
21 it 'should respond to respond_to?' do
22 store.respond_to?(:config).should be_true
23 end
24
25 end
26
27 context 'no method' do
28
29 it 'should raise NoMethodError' do
30 lambda {
31 store.no_method
32 }.should raise_error(NoMethodError)
33 end
34
35 it 'should not respond to respond_to?' do
36 store.config.respond_to?(:no_method).should be_false
37 end
38
39 end
40
41 end
42
43 describe 'multi level store' do
44 it 'should be a Store' do
45 multi_store.nested.should be_a_kind_of Gaston::Store
46 end
47
48 it 'should be recursive' do
9e4601c get rid of method_missing
chatgris authored Oct 23, 2011
49 multi_store.nested.one.should eq(:level)
c0b3635 initial commit
chatgris authored Sep 28, 2011
50 multi_store.nested.nested.two.should eq(["warp", :zone])
51 end
52
44d47a4 Fix unexpected method overwrite.
chatgris authored Jan 29, 2012
53 it 'should return bim!' do
54 multi_store.nested.spk.one.should eq :bim
55 end
56
c0b3635 initial commit
chatgris authored Sep 28, 2011
57 end
58
59 end
Something went wrong with that request. Please try again.