2013-12-13 08:18:57 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2015-12-09 05:55:36 -05:00
|
|
|
describe Gitlab::Upgrader, lib: true do
|
2013-12-13 08:18:57 -05:00
|
|
|
let(:upgrader) { Gitlab::Upgrader.new }
|
|
|
|
let(:current_version) { Gitlab::VERSION }
|
|
|
|
|
|
|
|
describe 'current_version_raw' do
|
2015-02-12 13:17:35 -05:00
|
|
|
it { expect(upgrader.current_version_raw).to eq(current_version) }
|
2013-12-13 08:18:57 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'latest_version?' do
|
2016-08-01 11:00:44 -04:00
|
|
|
it 'is true if newest version' do
|
2015-05-21 17:49:06 -04:00
|
|
|
allow(upgrader).to receive(:latest_version_raw).and_return(current_version)
|
2015-02-12 13:17:35 -05:00
|
|
|
expect(upgrader.latest_version?).to be_truthy
|
2013-12-13 08:18:57 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'latest_version_raw' do
|
2016-08-01 11:00:44 -04:00
|
|
|
it 'is the latest version for GitLab 5' do
|
2015-05-21 17:49:06 -04:00
|
|
|
allow(upgrader).to receive(:current_version_raw).and_return("5.3.0")
|
2015-02-12 13:17:35 -05:00
|
|
|
expect(upgrader.latest_version_raw).to eq("v5.4.2")
|
2013-12-13 08:18:57 -05:00
|
|
|
end
|
2015-05-23 06:11:23 -04:00
|
|
|
|
2016-08-01 11:00:44 -04:00
|
|
|
it 'gets the latest version from tags' do
|
2015-05-30 12:15:10 -04:00
|
|
|
allow(upgrader).to receive(:fetch_git_tags).and_return([
|
2015-05-23 06:11:23 -04:00
|
|
|
'6f0733310546402c15d3ae6128a95052f6c8ea96 refs/tags/v7.1.1',
|
|
|
|
'facfec4b242ce151af224e20715d58e628aa5e74 refs/tags/v7.1.1^{}',
|
|
|
|
'f7068d99c79cf79befbd388030c051bb4b5e86d4 refs/tags/v7.10.4',
|
|
|
|
'337225a4fcfa9674e2528cb6d41c46556bba9dfa refs/tags/v7.10.4^{}',
|
|
|
|
'880e0ba0adbed95d087f61a9a17515e518fc6440 refs/tags/v7.11.1',
|
|
|
|
'6584346b604f981f00af8011cd95472b2776d912 refs/tags/v7.11.1^{}',
|
|
|
|
'43af3e65a486a9237f29f56d96c3b3da59c24ae0 refs/tags/v7.11.2',
|
|
|
|
'dac18e7728013a77410e926a1e64225703754a2d refs/tags/v7.11.2^{}',
|
|
|
|
'0bf21fd4b46c980c26fd8c90a14b86a4d90cc950 refs/tags/v7.9.4',
|
|
|
|
'b10de29edbaff7219547dc506cb1468ee35065c3 refs/tags/v7.9.4^{}'])
|
|
|
|
expect(upgrader.latest_version_raw).to eq("v7.11.2")
|
|
|
|
end
|
2013-12-13 08:18:57 -05:00
|
|
|
end
|
|
|
|
end
|