spec/build/dependency/chain_spec.rb in build-dependency-1.0.0 vs spec/build/dependency/chain_spec.rb in build-dependency-1.1.0

- old
+ new

@@ -19,27 +19,27 @@ # THE SOFTWARE. RSpec.describe Build::Dependency do describe "valid dependency resolution" do let(:a) do - Package.new.tap do |package| + Package.new('apple-tree').tap do |package| package.provides 'apple' do fruit ['apple'] end end end let(:b) do - Package.new.tap do |package| + Package.new('orange-tree').tap do |package| package.provides 'orange' do fruit ['orange'] end end end let(:c) do - Package.new.tap do |package| + Package.new('blender').tap do |package| package.provides 'fruit-juice' do juice ['ice', 'cold'] end package.depends 'apple' @@ -52,20 +52,26 @@ expect(chain.ordered.collect(&:first)).to be == [a, b, c] expect(chain.unresolved).to be == [] end let(:d) do - Package.new.tap do |package| + Package.new('bakery').tap do |package| package.provides 'pie' package.depends 'apple' end end it "shouldn't include unrelated units" do chain = Build::Dependency::Chain.expand(['pie'], [a, b, c, d]) expect(chain.unresolved).to be == [] expect(chain.ordered.collect(&:first)).to be == [a, d] + end + + it "should format nicely" do + chain = Build::Dependency::Chain.expand(['fruit-juice'], [a, b, c]) + resolution = chain.ordered.first + expect(resolution.to_s).to be == 'resolution "apple-tree" -> "apple"' end end describe "incomplete dependency resolution" do it "should report conflicts" do