cascading-configuration-array 1.1.3 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,155 +0,0 @@
1
-
2
- require_relative '../../lib/cascading-configuration-array.rb'
3
-
4
- describe CascadingConfiguration::LocalConfigurationArray do
5
-
6
- #########
7
- # []= #
8
- #########
9
-
10
- it 'can add elements' do
11
- array_instance = CascadingConfiguration::LocalConfigurationArray.new
12
- array_instance[0] = :some_setting
13
- array_instance.should == [ :some_setting ]
14
- array_instance.exclude_array.include?( :some_setting ).should == false
15
- array_instance[1] = :other_setting
16
- array_instance.should == [ :other_setting, :some_setting ]
17
- array_instance.exclude_array.include?( :other_setting ).should == false
18
- end
19
-
20
- ########
21
- # << #
22
- ########
23
-
24
- it 'can add elements' do
25
- array_instance = CascadingConfiguration::LocalConfigurationArray.new
26
- array_instance << :some_setting
27
- array_instance.should == [ :some_setting ]
28
- array_instance.exclude_array.include?( :some_setting ).should == false
29
- array_instance << :other_setting
30
- array_instance.should == [ :other_setting, :some_setting ]
31
- array_instance.exclude_array.include?( :other_setting ).should == false
32
- end
33
-
34
- #######
35
- # + #
36
- #######
37
-
38
- it 'can add elements' do
39
- array_instance = CascadingConfiguration::LocalConfigurationArray.new
40
- array_instance += [ :some_setting ]
41
- array_instance.should == [ :some_setting ]
42
- array_instance.exclude_array.include?( :some_setting ).should == false
43
- array_instance += [ :other_setting ]
44
- array_instance.should == [ :other_setting, :some_setting ]
45
- array_instance.exclude_array.include?( :other_setting ).should == false
46
- end
47
-
48
- ##########
49
- # push #
50
- ##########
51
-
52
- it 'can add elements' do
53
- array_instance = CascadingConfiguration::LocalConfigurationArray.new
54
- array_instance.push( :some_setting )
55
- array_instance.should == [ :some_setting ]
56
- array_instance.exclude_array.include?( :some_setting ).should == false
57
- array_instance.push( :other_setting )
58
- array_instance.should == [ :other_setting, :some_setting ]
59
- array_instance.exclude_array.include?( :other_setting ).should == false
60
- end
61
-
62
- ############
63
- # concat #
64
- ############
65
-
66
- it 'can concat arrays' do
67
- array_instance = CascadingConfiguration::LocalConfigurationArray.new
68
- array_instance.concat( [ :some_setting ] )
69
- array_instance.should == [ :some_setting ]
70
- array_instance.exclude_array.include?( :some_setting ).should == false
71
- array_instance.concat( [ :other_setting ] )
72
- array_instance.should == [ :other_setting, :some_setting ]
73
- array_instance.exclude_array.include?( :other_setting ).should == false
74
- end
75
-
76
- #######
77
- # - #
78
- #######
79
-
80
- it 'can exclude elements' do
81
- array_instance = CascadingConfiguration::LocalConfigurationArray.new
82
- array_instance += [ :some_setting, :other_setting ]
83
- array_instance -= [ :other_setting ]
84
- array_instance.should == [ :some_setting ]
85
- array_instance.exclude_array.include?( :other_setting ).should == true
86
- array_instance -= [ :some_setting ]
87
- array_instance.should == []
88
- array_instance.exclude_array.include?( :some_setting ).should == true
89
- end
90
-
91
- ############
92
- # delete #
93
- ############
94
-
95
- it 'can exclude elements' do
96
- array_instance = CascadingConfiguration::LocalConfigurationArray.new
97
- array_instance += [ :some_setting, :other_setting ]
98
- array_instance.delete( :other_setting )
99
- array_instance.should == [ :some_setting ]
100
- array_instance.exclude_array.include?( :other_setting ).should == true
101
- array_instance.delete( :some_setting )
102
- array_instance.should == []
103
- array_instance.exclude_array.include?( :some_setting ).should == true
104
- end
105
-
106
- #########
107
- # pop #
108
- #########
109
-
110
- it 'can pop the final element' do
111
- array_instance = CascadingConfiguration::LocalConfigurationArray.new
112
- array_instance += [ :other_setting, :some_setting ]
113
- array_instance.pop.should == :some_setting
114
- array_instance.should == [ :other_setting ]
115
- array_instance.exclude_array.include?( :some_setting ).should == true
116
- end
117
-
118
- ###########
119
- # shift #
120
- ###########
121
-
122
- it 'can shift the first element' do
123
- array_instance = CascadingConfiguration::LocalConfigurationArray.new
124
- array_instance += [ :other_setting, :some_setting ]
125
- array_instance.shift.should == :other_setting
126
- array_instance.should == [ :some_setting ]
127
- array_instance.exclude_array.include?( :other_setting ).should == true
128
- end
129
-
130
- ############
131
- # slice! #
132
- ############
133
-
134
- it 'can slice elements' do
135
- array_instance = CascadingConfiguration::LocalConfigurationArray.new
136
- array_instance += [ :other_setting, :some_setting ]
137
- array_instance.slice!( 0, 1 ).should == [ :other_setting ]
138
- array_instance.should == [ :some_setting ]
139
- array_instance.exclude_array.include?( :other_setting ).should == true
140
- end
141
-
142
- ###########
143
- # clear #
144
- ###########
145
-
146
- it 'can clear, causing present elements to be excluded' do
147
- array_instance = CascadingConfiguration::LocalConfigurationArray.new
148
- array_instance += [ :some_setting, :other_setting ]
149
- array_instance.clear
150
- array_instance.should == []
151
- array_instance.exclude_array.include?( :some_setting ).should == true
152
- array_instance.exclude_array.include?( :other_setting ).should == true
153
- end
154
-
155
- end