Skip to content

Commit

Permalink
Add #import_option and #from_file
Browse files Browse the repository at this point in the history
  • Loading branch information
egypt committed Nov 30, 2012
1 parent e298c5b commit 2cbc15a
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions spec/lib/msf/core/data_store_spec.rb
Expand Up @@ -18,10 +18,25 @@
subject["FoO"].should == "bar"
subject["foO"].should == "bar"
end
context "#to_h" do
it "should return a Hash with correct values" do
subject.to_h.should == { "foo" => "bar", "fizz" => "buzz" }
end
end
end

describe Msf::DataStore do

describe "#import_option" do
subject do
s = described_class.new
s.import_option("foo", "bar")
s.import_option("fizz", "buzz")
s
end
it_behaves_like "datastore"
end

describe "#import_options_from_hash" do
subject do
hash = { "foo" => "bar", "fizz" => "buzz" }
Expand All @@ -42,4 +57,22 @@
it_behaves_like "datastore"
end

describe "#from_file" do
subject do
ini_instance = double
ini_instance.stub(:group?).and_return(true)
ini_instance.stub(:[]).and_return( { "foo" => "bar", "fizz" => "buzz" } )

ini = stub_const("Rex::Parser::Ini", Class.new)
ini.stub(:from_file).and_return(ini_instance)

s = described_class.new
s.from_file("path")
s
end

it_behaves_like "datastore"
end


end

0 comments on commit 2cbc15a

Please sign in to comment.