metasploit-framework/spec/lib/rex/parser/ini_spec.rb

35 lines
599 B
Ruby
Raw Normal View History

require 'rex/parser/ini'
2016-01-29 17:31:40 +00:00
RSpec.describe Rex::Parser::Ini do
let(:ini_contents) { <<EOF
# global comment
global settting = blah
[foo]
a = b
[bar]
b = c
[baf]
c = d
EOF
}
let(:ini) { described_class.from_s(ini_contents) }
context "#each_group" do
it "enumerates the groups" do
groups = []
ini.each_group { |group| groups << group }
groups.should eq(%w(foo bar baf))
end
end
context "#each_key" do
it "enumerates the groups" do
groups = []
ini.each_key.map { |group| groups << group }
groups.should eq(%w(foo bar baf))
end
end
end