spec/unit/util/fact_spec.rb in facter-1.5.9 vs spec/unit/util/fact_spec.rb in facter-1.6.0

- old
+ new

@@ -54,14 +54,14 @@ Facter::Util::Resolution.stubs(:new).returns @resolution @fact.add { } end - it "should re-sort the resolutions by length, so the most restricted resolutions are first" do - r1 = stub 'r1', :length => 1 - r2 = stub 'r2', :length => 2 - r3 = stub 'r3', :length => 0 + it "should re-sort the resolutions by weight, so the most restricted resolutions are first" do + r1 = stub 'r1', :weight => 1 + r2 = stub 'r2', :weight => 2 + r3 = stub 'r3', :weight => 0 Facter::Util::Resolution.expects(:new).times(3).returns(r1).returns(r2).returns(r3) @fact.add { } @fact.add { } @fact.add { } @@ -81,33 +81,33 @@ it "should return nil if there are no resolutions" do Facter::Util::Fact.new("yay").value.should be_nil end it "should return the first value returned by a resolution" do - r1 = stub 'r1', :length => 2, :value => nil, :suitable? => true - r2 = stub 'r2', :length => 1, :value => "yay", :suitable? => true - r3 = stub 'r3', :length => 0, :value => "foo", :suitable? => true + r1 = stub 'r1', :weight => 2, :value => nil, :suitable? => true + r2 = stub 'r2', :weight => 1, :value => "yay", :suitable? => true + r3 = stub 'r3', :weight => 0, :value => "foo", :suitable? => true Facter::Util::Resolution.expects(:new).times(3).returns(r1).returns(r2).returns(r3) @fact.add { } @fact.add { } @fact.add { } @fact.value.should == "yay" end it "should short-cut returning the value once one is found" do - r1 = stub 'r1', :length => 2, :value => "foo", :suitable? => true - r2 = stub 'r2', :length => 1, :suitable? => true # would fail if 'value' were asked for + r1 = stub 'r1', :weight => 2, :value => "foo", :suitable? => true + r2 = stub 'r2', :weight => 1, :suitable? => true # would fail if 'value' were asked for Facter::Util::Resolution.expects(:new).times(2).returns(r1).returns(r2) @fact.add { } @fact.add { } @fact.value end it "should skip unsuitable resolutions" do - r1 = stub 'r1', :length => 2, :suitable? => false # would fail if 'value' were asked for' - r2 = stub 'r2', :length => 1, :value => "yay", :suitable? => true + r1 = stub 'r1', :weight => 2, :suitable? => false # would fail if 'value' were asked for' + r2 = stub 'r2', :weight => 1, :value => "yay", :suitable? => true Facter::Util::Resolution.expects(:new).times(2).returns(r1).returns(r2) @fact.add { } @fact.add { } @fact.value.should == "yay"