diff --git a/Library/Homebrew/test/compiler_selector_spec.rb b/Library/Homebrew/test/compiler_selector_spec.rb index afedc9d8b1..f1b4120fb3 100644 --- a/Library/Homebrew/test/compiler_selector_spec.rb +++ b/Library/Homebrew/test/compiler_selector_spec.rb @@ -10,12 +10,7 @@ describe CompilerSelector do let(:compilers) { [:clang, :gnu] } let(:software_spec) { SoftwareSpec.new } let(:cc) { :clang } - let(:versions) do - double( - llvm_build_version: Version::NULL, - clang_build_version: Version.create("600"), - ) - end + let(:versions) { class_double(DevelopmentTools, clang_build_version: Version.create("600")) } before do allow(versions).to receive(:gcc_version) do |name| @@ -46,13 +41,15 @@ describe CompilerSelector do it "returns gcc-6 if gcc formula offers gcc-6 on mac", :needs_macos do software_spec.fails_with(:clang) - allow(Formulary).to receive(:factory).with("gcc").and_return(double(version: Version.new("6.0"))) + allow(Formulary).to receive(:factory).with("gcc") + .and_return(instance_double(Formula, version: Version.new("6.0"))) expect(selector.compiler).to eq("gcc-6") end it "returns gcc-5 if gcc formula offers gcc-5 on linux", :needs_linux do software_spec.fails_with(:clang) - allow(Formulary).to receive(:factory).with("gcc@11").and_return(double(version: Version.new("5.0"))) + allow(Formulary).to receive(:factory).with("gcc@11") + .and_return(instance_double(Formula, version: Version.new("5.0"))) expect(selector.compiler).to eq("gcc-5") end @@ -60,14 +57,16 @@ describe CompilerSelector do software_spec.fails_with(:clang) software_spec.fails_with(gcc: "5") software_spec.fails_with(gcc: "7") - allow(Formulary).to receive(:factory).with("gcc@11").and_return(double(version: Version.new("5.0"))) + allow(Formulary).to receive(:factory).with("gcc@11") + .and_return(instance_double(Formula, version: Version.new("5.0"))) expect(selector.compiler).to eq("gcc-6") end it "returns gcc-7 if gcc formula offers gcc-5 and fails with gcc <= 6 on linux", :needs_linux do software_spec.fails_with(:clang) software_spec.fails_with(:gcc) { version "6" } - allow(Formulary).to receive(:factory).with("gcc@11").and_return(double(version: Version.new("5.0"))) + allow(Formulary).to receive(:factory).with("gcc@11") + .and_return(instance_double(Formula, version: Version.new("5.0"))) expect(selector.compiler).to eq("gcc-7") end