tylerhunt-relax 0.0.5 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,67 +0,0 @@
1
- require File.dirname(__FILE__) + '/spec_helper'
2
-
3
- require 'relax/symbolic_hash'
4
-
5
- describe 'a symbolic hash' do
6
- before(:each) do
7
- @url = 'http://example.com/'
8
- @query = Relax::SymbolicHash.new
9
- end
10
-
11
- it 'should be accessible via string or symbol keys' do
12
- @query[:amount] = 10
13
- @query[:amount].should == 10
14
- @query['amount'].should == 10
15
- end
16
-
17
- it 'should convert keys to symbols' do
18
- @query['symbol'] = 'aleph'
19
- @query[:symbol].should == 'aleph'
20
- end
21
-
22
- it 'should convert keys to symbols' do
23
- @query['symbol'] = 'aleph'
24
- @query[:symbol].should == 'aleph'
25
- end
26
-
27
- it 'should test for keys by symbol' do
28
- @query[:symbol] = 'aleph'
29
- @query.key?('symbol').should be_true
30
- end
31
-
32
- it 'should delete values with a symbolic key' do
33
- @query[:symbol] = 'aleph'
34
- @query.delete('symbol')
35
- @query.key?(:symbol).should be_false
36
- end
37
-
38
- it 'should be mergeable' do
39
- @query[:one] = 2
40
- merged_query = @query.merge({ :one => 1, :two => 2 })
41
- merged_query[:one].should == 1
42
- merged_query[:two].should == 2
43
- end
44
-
45
- it 'should be able to duplicate itself' do
46
- @query[:one] = 'uno'
47
- @query[:two] = 'dos'
48
- new_query = @query.dup
49
- new_query[:one].should == 'uno'
50
- new_query[:two].should == 'dos'
51
-
52
- @query[:three] == 'tres'
53
- new_query.key?(:three).should be_false
54
- end
55
-
56
- it 'should be able to get multiple values by symbol' do
57
- @query[:one] = 1
58
- @query[:two] = 2
59
- @query.values_at(:one, :two).should == [1, 2]
60
- end
61
-
62
- it 'should be instantiable with a hash' do
63
- query = Relax::SymbolicHash.new({ :one => 1, :two => 2 })
64
- query[:one].should == 1
65
- query[:two].should == 2
66
- end
67
- end