Merge pull request #16650 from Homebrew/cask_upgrade_spec_flaky
test/cask/upgrade_spec: remove flaky specs.
This commit is contained in:
commit
eb9ac8d3e5
@ -29,193 +29,6 @@ describe Cask::Upgrade, :cask do
|
||||
allow_any_instance_of(described_class).to receive(:verbose?).and_return(true)
|
||||
end
|
||||
|
||||
context "when the upgrade is successful" do
|
||||
let(:installed) do
|
||||
[
|
||||
"outdated/local-caffeine",
|
||||
"outdated/local-transmission",
|
||||
"outdated/auto-updates",
|
||||
"outdated/version-latest",
|
||||
"outdated/renamed-app",
|
||||
]
|
||||
end
|
||||
|
||||
describe 'without --greedy it ignores the Casks with "version latest" or "auto_updates true"' do
|
||||
it "updates all the installed Casks when no token is provided" do
|
||||
expect(local_caffeine).to be_installed
|
||||
expect(local_caffeine_path).to be_a_directory
|
||||
expect(local_caffeine.installed_version).to eq "1.2.2"
|
||||
|
||||
expect(local_transmission).to be_installed
|
||||
expect(local_transmission_path).to be_a_directory
|
||||
expect(local_transmission.installed_version).to eq "2.60"
|
||||
|
||||
expect(renamed_app).to be_installed
|
||||
expect(renamed_app_old_path).to be_a_directory
|
||||
expect(renamed_app_new_path).not_to be_a_directory
|
||||
expect(renamed_app.installed_version).to eq "1.0.0"
|
||||
|
||||
described_class.upgrade_casks(args: args)
|
||||
|
||||
expect(local_caffeine).to be_installed
|
||||
expect(local_caffeine_path).to be_a_directory
|
||||
expect(local_caffeine.installed_version).to eq "1.2.3"
|
||||
|
||||
expect(local_transmission).to be_installed
|
||||
expect(local_transmission_path).to be_a_directory
|
||||
expect(local_transmission.installed_version).to eq "2.61"
|
||||
|
||||
expect(renamed_app).to be_installed
|
||||
expect(renamed_app_old_path).not_to be_a_directory
|
||||
expect(renamed_app_new_path).to be_a_directory
|
||||
expect(renamed_app.installed_version).to eq "2.0.0"
|
||||
end
|
||||
|
||||
it "updates only the Casks specified in the command line" do
|
||||
expect(local_caffeine).to be_installed
|
||||
expect(local_caffeine_path).to be_a_directory
|
||||
expect(local_caffeine.installed_version).to eq "1.2.2"
|
||||
|
||||
expect(local_transmission).to be_installed
|
||||
expect(local_transmission_path).to be_a_directory
|
||||
expect(local_transmission.installed_version).to eq "2.60"
|
||||
|
||||
expect(renamed_app).to be_installed
|
||||
expect(renamed_app_old_path).to be_a_directory
|
||||
expect(renamed_app_new_path).not_to be_a_directory
|
||||
expect(renamed_app.installed_version).to eq "1.0.0"
|
||||
|
||||
described_class.upgrade_casks(local_caffeine, args: args)
|
||||
|
||||
expect(local_caffeine).to be_installed
|
||||
expect(local_caffeine_path).to be_a_directory
|
||||
expect(local_caffeine.installed_version).to eq "1.2.3"
|
||||
|
||||
expect(local_transmission).to be_installed
|
||||
expect(local_transmission_path).to be_a_directory
|
||||
expect(local_transmission.installed_version).to eq "2.60"
|
||||
|
||||
expect(renamed_app).to be_installed
|
||||
expect(renamed_app_old_path).to be_a_directory
|
||||
expect(renamed_app_new_path).not_to be_a_directory
|
||||
expect(renamed_app.installed_version).to eq "1.0.0"
|
||||
end
|
||||
|
||||
it 'updates "auto_updates" and "latest" Casks when their tokens are provided in the command line' do
|
||||
expect(local_caffeine).to be_installed
|
||||
expect(local_caffeine_path).to be_a_directory
|
||||
expect(local_caffeine.installed_version).to eq "1.2.2"
|
||||
|
||||
expect(auto_updates).to be_installed
|
||||
expect(auto_updates_path).to be_a_directory
|
||||
expect(auto_updates.installed_version).to eq "2.57"
|
||||
|
||||
described_class.upgrade_casks(local_caffeine, auto_updates, args: args)
|
||||
|
||||
expect(local_caffeine).to be_installed
|
||||
expect(local_caffeine_path).to be_a_directory
|
||||
expect(local_caffeine.installed_version).to eq "1.2.3"
|
||||
|
||||
expect(auto_updates).to be_installed
|
||||
expect(auto_updates_path).to be_a_directory
|
||||
expect(auto_updates.installed_version).to eq "2.61"
|
||||
end
|
||||
end
|
||||
|
||||
describe "with --greedy it checks additional Casks" do
|
||||
it 'includes the Casks with "auto_updates true" or "version latest"' do
|
||||
expect(local_caffeine).to be_installed
|
||||
expect(local_caffeine_path).to be_a_directory
|
||||
expect(local_caffeine.installed_version).to eq "1.2.2"
|
||||
|
||||
expect(auto_updates).to be_installed
|
||||
expect(auto_updates_path).to be_a_directory
|
||||
expect(auto_updates.installed_version).to eq "2.57"
|
||||
|
||||
expect(local_transmission).to be_installed
|
||||
expect(local_transmission_path).to be_a_directory
|
||||
expect(local_transmission.installed_version).to eq "2.60"
|
||||
|
||||
expect(renamed_app).to be_installed
|
||||
expect(renamed_app_old_path).to be_a_directory
|
||||
expect(renamed_app_new_path).not_to be_a_directory
|
||||
expect(renamed_app.installed_version).to eq "1.0.0"
|
||||
|
||||
expect(version_latest).to be_installed
|
||||
expect(version_latest_paths).to all be_a_directory
|
||||
expect(version_latest.installed_version).to eq "latest"
|
||||
# Change download sha so that :latest cask decides to update itself
|
||||
version_latest.download_sha_path.write("fake download sha")
|
||||
expect(version_latest.outdated_download_sha?).to be(true)
|
||||
|
||||
described_class.upgrade_casks(greedy: true, args: args)
|
||||
|
||||
expect(local_caffeine).to be_installed
|
||||
expect(local_caffeine_path).to be_a_directory
|
||||
expect(local_caffeine.installed_version).to eq "1.2.3"
|
||||
|
||||
expect(auto_updates).to be_installed
|
||||
expect(auto_updates_path).to be_a_directory
|
||||
expect(auto_updates.installed_version).to eq "2.61"
|
||||
|
||||
expect(local_transmission).to be_installed
|
||||
expect(local_transmission_path).to be_a_directory
|
||||
expect(local_transmission.installed_version).to eq "2.61"
|
||||
|
||||
expect(renamed_app).to be_installed
|
||||
expect(renamed_app_old_path).not_to be_a_directory
|
||||
expect(renamed_app_new_path).to be_a_directory
|
||||
expect(renamed_app.installed_version).to eq "2.0.0"
|
||||
|
||||
expect(version_latest).to be_installed
|
||||
expect(version_latest_paths).to all be_a_directory
|
||||
expect(version_latest.installed_version).to eq "latest"
|
||||
expect(version_latest.outdated_download_sha?).to be(false)
|
||||
end
|
||||
|
||||
it 'does not include the Casks with "auto_updates true" or "version latest" when the version did not change' do
|
||||
expect(auto_updates).to be_installed
|
||||
expect(auto_updates_path).to be_a_directory
|
||||
expect(auto_updates.installed_version).to eq "2.57"
|
||||
|
||||
described_class.upgrade_casks(auto_updates, greedy: true, args: args)
|
||||
|
||||
expect(auto_updates).to be_installed
|
||||
expect(auto_updates_path).to be_a_directory
|
||||
expect(auto_updates.installed_version).to eq "2.61"
|
||||
|
||||
described_class.upgrade_casks(auto_updates, greedy: true, args: args)
|
||||
|
||||
expect(auto_updates).to be_installed
|
||||
expect(auto_updates_path).to be_a_directory
|
||||
expect(auto_updates.installed_version).to eq "2.61"
|
||||
end
|
||||
|
||||
it 'does not include the Casks with "version latest" when the version did not change' do
|
||||
expect(version_latest).to be_installed
|
||||
expect(version_latest_paths).to all be_a_directory
|
||||
expect(version_latest.installed_version).to eq "latest"
|
||||
# Change download sha so that :latest cask decides to update itself
|
||||
version_latest.download_sha_path.write("fake download sha")
|
||||
expect(version_latest.outdated_download_sha?).to be(true)
|
||||
|
||||
described_class.upgrade_casks(version_latest, greedy: true, args: args)
|
||||
|
||||
expect(version_latest).to be_installed
|
||||
expect(version_latest_paths).to all be_a_directory
|
||||
expect(version_latest.installed_version).to eq "latest"
|
||||
expect(version_latest.outdated_download_sha?).to be(false)
|
||||
|
||||
described_class.upgrade_casks(version_latest, greedy: true, args: args)
|
||||
|
||||
expect(version_latest).to be_installed
|
||||
expect(version_latest_paths).to all be_a_directory
|
||||
expect(version_latest.installed_version).to eq "latest"
|
||||
expect(version_latest.outdated_download_sha?).to be(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "when the upgrade is a dry run" do
|
||||
let(:installed) do
|
||||
[
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user