File tree Expand file tree Collapse file tree 2 files changed +35
-8
lines changed Expand file tree Collapse file tree 2 files changed +35
-8
lines changed Original file line number Diff line number Diff line change @@ -49,14 +49,7 @@ def initialize(path = nil)
49
49
end
50
50
end
51
51
52
- #
53
- # Enumerates the groups hash keys.
54
- #
55
- def each_group ( &block )
56
- self . keys . each { |k |
57
- yield
58
- }
59
- end
52
+ alias each_group each_key
60
53
61
54
#
62
55
# Adds a group of the supplied name if it doesn't already exist.
Original file line number Diff line number Diff line change
1
+ require 'rex/parser/ini'
2
+
3
+ describe Rex ::Parser ::Ini do
4
+ let ( :ini_contents ) { <<EOF
5
+ # global comment
6
+ global settting = blah
7
+ [foo]
8
+ a = b
9
+ [bar]
10
+ b = c
11
+
12
+ [baf]
13
+ c = d
14
+ EOF
15
+ }
16
+
17
+ let ( :ini ) { described_class . from_s ( ini_contents ) }
18
+
19
+ context "#each_group" do
20
+ it "enumerates the groups" do
21
+ groups = [ ]
22
+ ini . each_group { |group | groups << group }
23
+ groups . should eq ( %w( foo bar baf ) )
24
+ end
25
+ end
26
+
27
+ context "#each_key" do
28
+ it "enumerates the groups" do
29
+ groups = [ ]
30
+ ini . each_key . map { |group | groups << group }
31
+ groups . should eq ( %w( foo bar baf ) )
32
+ end
33
+ end
34
+ end
You can’t perform that action at this time.
0 commit comments