spec/unit/util/collection_spec.rb in facter-1.6.4 vs spec/unit/util/collection_spec.rb in facter-1.6.5
- old
+ new
@@ -1,9 +1,8 @@
-#!/usr/bin/env ruby
+#!/usr/bin/env rspec
-require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
-
+require 'spec_helper'
require 'facter/util/collection'
describe Facter::Util::Collection do
it "should have a method for adding facts" do
Facter::Util::Collection.new.should respond_to(:add)
@@ -90,9 +89,19 @@
Facter::Util::Fact.expects(:new).returns fact
fact.expects(:add)
@coll.add(:myname) {}
+ end
+
+ it "should discard resolutions that throw an exception when added" do
+ lambda {
+ @coll.add('yay') do
+ raise
+ setcode { 'yay' }
+ end
+ }.should_not raise_error
+ @coll.value('yay').should be_nil
end
end
end
it "should have a method for retrieving facts by name" do