spec/box/release/base_spec.rb in box-release-0.0.3 vs spec/box/release/base_spec.rb in box-release-0.0.4

- old
+ new

@@ -18,11 +18,11 @@ subject.stub :download_directory => "/dummy" subject.file.should == "/dummy/release.tar" end end - + describe "#download" do before(:each) do FileUtils.rm_f(subject.file) end @@ -120,9 +120,33 @@ end it "should be false when name is nil" do subject.name = nil subject.should_not be_newer(stub(:name => "version-1")) + end + + end + + describe "#normalize_url" do + + context 'when url is relative' do + + it "should use reference_url if defined" do + subject.reference_url = "http://dummy/path/to/latest.yml" + subject.normalize_url("release").should == "http://dummy/path/to/release" + end + + it "should not change url if reference_url is not defined" do + subject.reference_url = nil + subject.normalize_url("release").should == "release" + end + + end + + let(:absolute_url) { "http://dummy/path/to/release" } + + it "should change an absolute url" do + subject.normalize_url(absolute_url).should == absolute_url end end end