From 04a72a9c0fcef886e8ed46dd5a8d16736e2500df Mon Sep 17 00:00:00 2001 From: Tommaso Barbato Date: Sun, 3 Dec 2023 12:34:27 +0100 Subject: [PATCH] Fix tests --- spec/app_spec.rb | 26 +++++++++++++------------- spec/branch_spec.rb | 38 +++++++++++++++++++------------------- spec/release_spec.rb | 28 ++++++++++++++-------------- 3 files changed, 46 insertions(+), 46 deletions(-) diff --git a/spec/app_spec.rb b/spec/app_spec.rb index 905c03e..fd66bb5 100644 --- a/spec/app_spec.rb +++ b/spec/app_spec.rb @@ -63,43 +63,43 @@ expect(json).to eq({ 'status' => 'normal', - 'branches' => ['2.7', '2.6'], - 'latest' => ['2.7.2', '2.6.6'] + 'branches' => ['3.2', '3.1'], + 'latest' => ['3.2.2', '3.1.4'] }) end end describe 'branch endpoint' do - let(:endpoint) { '/api/2.7' } + let(:endpoint) { '/api/3.2' } it 'returns the branch info' do get endpoint expect(json).to eq({ - 'branch' => '2.7', + 'branch' => '3.2', 'status' => 'normal', - 'release_date' => '2019-12-25', + 'release_date' => '2022-12-25', 'eol_date' => nil, - 'latest' => '2.7.2', + 'latest' => '3.2.2', 'releases' => [ - '2.7.2', '2.7.1', '2.7.0', '2.7.0-rc2', '2.7.0-rc1', - '2.7.0-preview3', '2.7.0-preview2', '2.7.0-preview1' + '3.2.2', '3.2.1', '3.2.0', '3.2.0-rc1', + '3.2.0-preview3', '3.2.0-preview2', '3.2.0-preview1' ] }) end end describe 'release endpoint' do - let(:endpoint) { '/api/2.7.0' } + let(:endpoint) { '/api/3.2.0' } it 'returns the release info' do get endpoint expect(json).to eq({ - 'release' => '2.7.0', - 'branch' => '2.7', + 'release' => '3.2.0', + 'branch' => '3.2', 'status' => 'normal', - 'release_date' => '2019-12-25', + 'release_date' => '2022-12-25', 'latest' => false, 'prerelease' => false }) @@ -113,7 +113,7 @@ get endpoint expect(json).to eq({ - 'last_update' => '2020-10-24 07:30:00 +0000' + 'last_update' => '2023-12-03 11:23:35 +0000' }) end end diff --git a/spec/branch_spec.rb b/spec/branch_spec.rb index 34fd560..a718c27 100644 --- a/spec/branch_spec.rb +++ b/spec/branch_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.describe Branch, :github do - subject(:branch) { described_class['2.5'] } + subject(:branch) { described_class['3.0'] } before(:each) do Branch.build! @@ -11,7 +11,7 @@ describe '#latest' do it 'returns the latest version of the branch' do expect(branch.latest).to be_a(Release) - expect(branch.latest.to_s).to eq('2.5.8') + expect(branch.latest.to_s).to eq('3.0.6') end end @@ -23,16 +23,16 @@ describe '#to_s' do it 'returns the branch name as string' do - expect(branch.to_s).to eq('2.5') + expect(branch.to_s).to eq('3.0') end end describe '#to_json' do it 'returns the branch attributes as JSON' do expect(branch.to_json).to eq( - '{"branch":"2.5","status":"security","release_date":"2017-12-25",' \ - '"eol_date":"2021-03-31","latest":"2.5.8","releases":["2.5.8","2.5.7",' \ - '"2.5.6","2.5.5","2.5.4","2.5.3","2.5.2","2.5.1","2.5.0","2.5.0-rc1","2.5.0-preview1"]}' + '{"branch":"3.0","status":"security","release_date":"2020-12-25",' \ + '"eol_date":null,"latest":"3.0.6","releases":["3.0.6","3.0.5",' \ + '"3.0.4","3.0.3","3.0.2","3.0.1","3.0.0","3.0.0-rc1","3.0.0-preview2","3.0.0-preview1"]}' ) end end @@ -40,14 +40,14 @@ describe '#attributes' do it 'returns the branch attributes as hash' do expect(branch.attributes).to eq({ - branch: '2.5', + branch: '3.0', status: 'security', - release_date: Date.new(2017, 12, 25), - eol_date: Date.new(2021, 3, 31), - latest: '2.5.8', + release_date: Date.new(2020, 12, 25), + eol_date: nil, + latest: '3.0.6', releases: [ - '2.5.8', '2.5.7', '2.5.6', '2.5.5', '2.5.4', '2.5.3', - '2.5.2', '2.5.1', '2.5.0', '2.5.0-rc1', '2.5.0-preview1' + '3.0.6', '3.0.5', '3.0.4', '3.0.3', '3.0.2', '3.0.1', + '3.0.0', '3.0.0-rc1', '3.0.0-preview2', '3.0.0-preview1' ] }) end @@ -55,15 +55,15 @@ describe '.[]' do it 'returns the branch with the matching name' do - expect(described_class['2.5']).to be_a(described_class) - expect(described_class['2.5'].to_s).to eq('2.5') + expect(described_class['3.0']).to be_a(described_class) + expect(described_class['3.0'].to_s).to eq('3.0') end end describe '.status' do it 'returns the branches with the matching status' do expect(described_class.status('security')).to all(be_a(described_class)) - expect(described_class.status('security').first.to_s).to eq('2.5') + expect(described_class.status('security').first.to_s).to eq('3.0') end end @@ -85,7 +85,7 @@ it 'returns the latest 4 branches as string' do expect(described_class.examples_branches).to all(be_a String) expect(described_class.examples_branches).to eq([ - '3.0', '2.7', '2.6', '2.5' + '3.3', '3.2', '3.1', '3.0' ]) end end @@ -103,21 +103,21 @@ it 'returns 6 releases of the 4 most recent branches as string' do expect(described_class.examples_releases).to all(be_a String) expect(described_class.examples_releases).to eq([ - '3.0.0-preview1', '2.7.2', '2.7.1', '2.6.6', '2.5.8', '2.4.10' + '3.3.0-preview3', '3.3.0-preview2', '3.2.2', '3.2.1', '3.1.4', '3.0.6' ]) end end describe '.sha' do it 'returns the commit sha of the data' do - expect(described_class.sha).to eq('8c7d486e4ac97fc2aa31db3f16881e438b4cd863') + expect(described_class.sha).to eq('54cfc1f1332e0e7888c9266fcb0c351b3534a661') end end describe '.all' do it 'returns all branches' do expect(described_class.all).to all(be_a(described_class)) - expect(described_class.all.first.to_s).to eq('3.0') + expect(described_class.all.first.to_s).to eq('3.3') expect(described_class.all.last.to_s).to eq('1.9') end diff --git a/spec/release_spec.rb b/spec/release_spec.rb index 6c8715a..944762d 100644 --- a/spec/release_spec.rb +++ b/spec/release_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.describe Release, :github do - subject(:release) { described_class['2.6.4'] } + subject(:release) { described_class['3.1.2'] } before(:each) do Branch.build! @@ -23,7 +23,7 @@ describe '#branch' do it 'returns the branch of the release' do expect(release.branch).to be_a(Branch) - expect(release.branch.to_s).to eq('2.6') + expect(release.branch.to_s).to eq('3.1') end end @@ -35,15 +35,15 @@ describe '#to_s' do it 'returns the release version as string' do - expect(release.to_s).to eq('2.6.4') + expect(release.to_s).to eq('3.1.2') end end describe '#to_json' do it 'returns the release attributes as JSON' do expect(release.to_json).to eq( - '{"release":"2.6.4","branch":"2.6","status":"normal","release_date":' \ - '"2019-08-28","latest":false,"prerelease":false}' + '{"release":"3.1.2","branch":"3.1","status":"normal","release_date":' \ + '"2022-04-12","latest":false,"prerelease":false}' ) end end @@ -51,10 +51,10 @@ describe '#attributes' do it 'returns the release attributes as hash' do expect(release.attributes).to eq({ - release: '2.6.4', - branch: '2.6', + release: '3.1.2', + branch: '3.1', status: 'normal', - release_date: Date.new(2019, 8, 28), + release_date: '2022-04-12', latest: false, prerelease: false }) @@ -63,17 +63,17 @@ describe '.[]' do it 'returns the release with the matching version' do - expect(described_class['2.6.4']).to be_a(described_class) - expect(described_class['2.6.4'].to_s).to eq('2.6.4') + expect(described_class['3.1.2']).to be_a(described_class) + expect(described_class['3.1.2'].to_s).to eq('3.1.2') end end describe '.branch' do it 'returns the releases of a branch' do - branch = Branch['2.6'] + branch = Branch['3.1'] expect(described_class.branch(branch)).to all(be_a(described_class)) - expect(described_class.branch(branch).first.to_s).to eq('2.6.6') + expect(described_class.branch(branch).first.to_s).to eq('3.1.4') end end @@ -86,14 +86,14 @@ describe '.sha' do it 'returns the commit sha of the data' do - expect(described_class.sha).to eq('39f327ba6d87a745e9a695c80a1c443e328fcb99') + expect(described_class.sha).to eq('7333cd8e25691bbb2325f6d5d4e1a07b0805cd2b') end end describe '.all' do it 'returns all releases' do expect(described_class.all).to all(be_a(described_class)) - expect(described_class.all.first.to_s).to eq('3.0.0-preview1') + expect(described_class.all.first.to_s).to eq('3.3.0-preview3') expect(described_class.all.last.to_s).to eq('1.9.0') end