spec/manifest_handler_spec.rb in inqlude-0.0.7 vs spec/manifest_handler_spec.rb in inqlude-0.0.8

- old
+ new

@@ -7,24 +7,47 @@ s.manifest_path = File.expand_path('spec/data/') s.offline = true s end - it "reads manifests" do + let(:mh) do mh = ManifestHandler.new settings mh.read_remote - mh.manifests.count.should == 1 - mh.libraries.count.should == 1 + mh + end + + it "reads manifests" do + mh.manifests.count.should == 2 + mh.libraries.count.should == 2 mh.read_remote - mh.manifests.count.should == 1 - mh.libraries.count.should == 1 + mh.manifests.count.should == 2 + mh.libraries.count.should == 2 end it "provides access to manifests" do - mh = ManifestHandler.new settings - mh.read_remote - mh.manifest("awesomelib").class.should == Hash expect { mh.manifest("nonexisting") }.to raise_error + end + + context "#libraries" do + + it "returns all libraries" do + expect( mh.libraries.count ).to eq 2 + end + + it "returns stable libraries" do + libraries = mh.libraries :stable + expect( libraries.count ).to eq 1 + expect( libraries.first.manifests.last["name"] ).to eq "awesomelib" + expect( libraries.first.manifests.last["version"] ).to eq "0.2.0" + end + + it "returns development versions" do + libraries = mh.libraries :edge + expect( libraries.count ).to eq 1 + expect( libraries.first.manifests.last["name"] ).to eq "bleedingedge" + expect( libraries.first.manifests.last["version"] ).to eq "edge" + end + end end