2021-01-31 14:50:29 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require "download_strategy"
|
|
|
|
|
2024-02-18 15:11:11 -08:00
|
|
|
RSpec.describe AbstractDownloadStrategy do
|
2025-03-12 11:39:01 -07:00
|
|
|
subject(:strategy) { Class.new(described_class).new(url, name, version, **specs) }
|
2021-01-31 14:50:29 -05:00
|
|
|
|
|
|
|
let(:specs) { {} }
|
|
|
|
let(:name) { "foo" }
|
|
|
|
let(:url) { "https://example.com/foo.tar.gz" }
|
|
|
|
let(:version) { nil }
|
|
|
|
let(:args) { %w[foo bar baz] }
|
|
|
|
|
|
|
|
specify "#source_modified_time" do
|
2024-12-19 15:27:14 -05:00
|
|
|
mktmpdir("mtime").cd do
|
2021-01-31 14:50:29 -05:00
|
|
|
FileUtils.touch "foo", mtime: Time.now - 10
|
|
|
|
FileUtils.touch "bar", mtime: Time.now - 100
|
|
|
|
FileUtils.ln_s "not-exist", "baz"
|
|
|
|
expect(strategy.source_modified_time).to eq(File.mtime("foo"))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|