#298: added extra specs for #has_new_packages?
This commit is contained in:
parent
4ed7543872
commit
99d7a2baa0
|
@ -293,7 +293,9 @@ class BuildList < ActiveRecord::Base
|
||||||
return true if nsp.release.to_i > sp.release.to_i
|
return true if nsp.release.to_i > sp.release.to_i
|
||||||
else
|
else
|
||||||
nsp_version.each_with_index do |nv, index|
|
nsp_version.each_with_index do |nv, index|
|
||||||
return true if nv > sp_version[index].to_i
|
ov = sp_version[index].to_i
|
||||||
|
return true if nv > ov
|
||||||
|
return false if nv < ov
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe BuildList do
|
describe BuildList do
|
||||||
|
before { stub_symlink_methods }
|
||||||
|
|
||||||
context 'validates that repository contains project' do
|
context 'validates that repository contains project' do
|
||||||
it 'when repository contains project' do
|
it 'when repository contains project' do
|
||||||
|
@ -16,7 +17,6 @@ describe BuildList do
|
||||||
end
|
end
|
||||||
|
|
||||||
context "#notify_users" do
|
context "#notify_users" do
|
||||||
before { stub_symlink_methods }
|
|
||||||
let!(:user) { FactoryGirl.create(:user) }
|
let!(:user) { FactoryGirl.create(:user) }
|
||||||
let!(:build_list) { FactoryGirl.create(:build_list,
|
let!(:build_list) { FactoryGirl.create(:build_list,
|
||||||
:user => user,
|
:user => user,
|
||||||
|
@ -155,13 +155,14 @@ describe BuildList do
|
||||||
|
|
||||||
end # notify_users
|
end # notify_users
|
||||||
|
|
||||||
context '#can_auto_publish?' do
|
context '#has_new_packages?' do
|
||||||
before { stub_symlink_methods }
|
|
||||||
let!(:build_list) { FactoryGirl.create( :build_list,
|
let!(:build_list) { FactoryGirl.create( :build_list,
|
||||||
:status => BuildList::SUCCESS,
|
:status => BuildList::SUCCESS,
|
||||||
:auto_publish => true) }
|
:auto_publish => true) }
|
||||||
let!(:build_list_package) { FactoryGirl.create( :build_list_package,
|
let!(:build_list_package) { FactoryGirl.create( :build_list_package,
|
||||||
:build_list => build_list,
|
:build_list => build_list,
|
||||||
|
:version => '3.1.12',
|
||||||
|
:release => 6,
|
||||||
:platform => build_list.save_to_platform,
|
:platform => build_list.save_to_platform,
|
||||||
:project => build_list.project) }
|
:project => build_list.project) }
|
||||||
let!(:published_build_list) { FactoryGirl.create( :build_list,
|
let!(:published_build_list) { FactoryGirl.create( :build_list,
|
||||||
|
@ -173,25 +174,57 @@ describe BuildList do
|
||||||
:build_list => published_build_list,
|
:build_list => published_build_list,
|
||||||
:platform => published_build_list.save_to_platform,
|
:platform => published_build_list.save_to_platform,
|
||||||
:actual => true,
|
:actual => true,
|
||||||
|
:version => '3.1.12',
|
||||||
|
:release => 6,
|
||||||
:project => published_build_list.project) }
|
:project => published_build_list.project) }
|
||||||
|
|
||||||
it 'ensures that return false if version of packages are same' do
|
it 'ensures that return false if version of packages are same' do
|
||||||
build_list.can_auto_publish?.should be_false
|
build_list.has_new_packages?.should be_false
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'ensures that return false if version of published package >' do
|
context 'ensures that return false if version of published package >' do
|
||||||
published_build_list_package.update_attributes(:version => '3.1.13')
|
|
||||||
build_list.can_auto_publish?.should be_false
|
it 'published: 3.1.13, new: 3.1.12' do
|
||||||
|
published_build_list_package.update_attributes(:version => '3.1.13')
|
||||||
|
build_list.has_new_packages?.should be_false
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'published: 3.1.12, new: 3.0.999' do
|
||||||
|
build_list_package.update_attributes(:version => '3.0.999')
|
||||||
|
build_list.has_new_packages?.should be_false
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'published: 3.0.rc1, new: 3.0.0' do
|
||||||
|
published_build_list_package.update_attributes(:version => '3.0.rc1')
|
||||||
|
build_list_package.update_attributes(:version => '3.0.0')
|
||||||
|
build_list.has_new_packages?.should be_false
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'ensures that return true if version of published package <' do
|
context 'ensures that return true if version of published package <' do
|
||||||
published_build_list_package.update_attributes(:version => '3.1.11')
|
|
||||||
build_list.can_auto_publish?.should be_true
|
it 'published: 3.1.11, new: 3.1.12' do
|
||||||
|
published_build_list_package.update_attributes(:version => '3.1.11')
|
||||||
|
build_list.has_new_packages?.should be_true
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'published: 3.0.999, new: 3.1.12' do
|
||||||
|
published_build_list_package.update_attributes(:version => '3.0.999')
|
||||||
|
build_list.has_new_packages?.should be_true
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'published: 3.0.0, new: 3.0.rc1' do
|
||||||
|
published_build_list_package.update_attributes(:version => '3.0.0')
|
||||||
|
build_list_package.update_attributes(:version => '3.0.rc1')
|
||||||
|
build_list.has_new_packages?.should be_true
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'ensures that return true if release of published package <' do
|
it 'ensures that return true if release of published package <' do
|
||||||
published_build_list_package.update_attributes(:release => 5)
|
published_build_list_package.update_attributes(:release => 5)
|
||||||
build_list.can_auto_publish?.should be_true
|
build_list.has_new_packages?.should be_true
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue