Resolve compiler_failure_spec violation

This commit is contained in:
Douglas Eichelberger 2023-01-22 17:05:33 -08:00
parent bd62afde91
commit d30ba99612

View File

@ -9,31 +9,57 @@ describe CompilerFailure do
describe "::create" do
it "creates a failure when given a symbol" do
failure = described_class.create(:clang)
expect(failure).to fail_with(double("Compiler", type: :clang, name: :clang, version: 600))
expect(failure).to fail_with(
instance_double(CompilerSelector::Compiler, "Compiler", type: :clang, name: :clang, version: 600),
)
end
it "can be given a build number in a block" do
failure = described_class.create(:clang) { build 700 }
expect(failure).to fail_with(double("Compiler", type: :clang, name: :clang, version: 700))
expect(failure).to fail_with(
instance_double(CompilerSelector::Compiler, "Compiler", type: :clang, name: :clang, version: 700),
)
end
it "can be given an empty block" do
failure = described_class.create(:clang) {}
expect(failure).to fail_with(double("Compiler", type: :clang, name: :clang, version: 600))
expect(failure).to fail_with(
instance_double(CompilerSelector::Compiler, "Compiler", type: :clang, name: :clang, version: 600),
)
end
it "creates a failure when given a hash" do
failure = described_class.create(gcc: "7")
expect(failure).to fail_with(double("Compiler", type: :gcc, name: "gcc-7", version: Version.new("7")))
expect(failure).to fail_with(double("Compiler", type: :gcc, name: "gcc-7", version: Version.new("7.1")))
expect(failure).not_to fail_with(double("Compiler", type: :gcc, name: "gcc-6", version: Version.new("6.0")))
expect(failure).to fail_with(
instance_double(CompilerSelector::Compiler, "Compiler", type: :gcc, name: "gcc-7", version: Version.new("7")),
)
expect(failure).to fail_with(
instance_double(
CompilerSelector::Compiler, "Compiler", type: :gcc, name: "gcc-7", version: Version.new("7.1")
),
)
expect(failure).not_to fail_with(
instance_double(
CompilerSelector::Compiler, "Compiler", type: :gcc, name: "gcc-6", version: Version.new("6.0")
),
)
end
it "creates a failure when given a hash and a block with aversion" do
failure = described_class.create(gcc: "7") { version "7.1" }
expect(failure).to fail_with(double("Compiler", type: :gcc, name: "gcc-7", version: Version.new("7")))
expect(failure).to fail_with(double("Compiler", type: :gcc, name: "gcc-7", version: Version.new("7.1")))
expect(failure).not_to fail_with(double("Compiler", type: :gcc, name: "gcc-7", version: Version.new("7.2")))
expect(failure).to fail_with(
instance_double(CompilerSelector::Compiler, "Compiler", type: :gcc, name: "gcc-7", version: Version.new("7")),
)
expect(failure).to fail_with(
instance_double(
CompilerSelector::Compiler, "Compiler", type: :gcc, name: "gcc-7", version: Version.new("7.1")
),
)
expect(failure).not_to fail_with(
instance_double(
CompilerSelector::Compiler, "Compiler", type: :gcc, name: "gcc-7", version: Version.new("7.2")
),
)
end
end
end