spec/exploits/target_spec.rb in ronin-exploits-0.2.0 vs spec/exploits/target_spec.rb in ronin-exploits-0.2.1

- old
+ new

@@ -1,13 +1,18 @@ require 'ronin/exploits/target' require 'spec_helper' describe Exploits::Target do + before(:all) do + @exploit = Exploits::Exploit.create(:name => 'exploit with targets') + end + before(:each) do @target = Exploits::Target.new( - :data => {:var => 1, :test => 'hello'} + :data => {:var => 1, :test => 'hello'}, + :exploit => @exploit ) end it "should not have an Arch by default" do @target.arch.should be_nil @@ -66,12 +71,14 @@ @target.var.should == 2 end it "should be able to serialize and deserialize it's target data" do - @target.save! + @target.save target = Exploits::Target.get(@target.id) + target.should_not be_nil + target.data[:var].should == 1 target.data[:test].should == 'hello' end it "should not raise TargetDataMissing when setting new data" do