Rylan Polster d5d7b6c3db
style: remove RSpec/MultipleDescribes violations
Co-authored-by: Nanda H Krishna <nanda.harishankar@gmail.com>
2021-02-01 20:30:51 -05:00

36 lines
866 B
Ruby

# typed: false
# frozen_string_literal: true
require "download_strategy"
describe DownloadStrategyDetector do
describe "::detect" do
subject(:strategy_detector) { described_class.detect(url, strategy) }
let(:url) { Object.new }
let(:strategy) { nil }
context "when given Git URL" do
let(:url) { "git://example.com/foo.git" }
it { is_expected.to eq(GitDownloadStrategy) }
end
context "when given a GitHub Git URL" do
let(:url) { "https://github.com/homebrew/brew.git" }
it { is_expected.to eq(GitHubGitDownloadStrategy) }
end
it "defaults to curl" do
expect(strategy_detector).to eq(CurlDownloadStrategy)
end
it "raises an error when passed an unrecognized strategy" do
expect {
described_class.detect("foo", Class.new)
}.to raise_error(TypeError)
end
end
end