diff options
| author | Mike McQuaid | 2017-02-23 09:12:18 +0000 |
|---|---|---|
| committer | GitHub | 2017-02-23 09:12:18 +0000 |
| commit | 1a436b4d24d50011bc444cf5d2016f5c0f808dec (patch) | |
| tree | 9659fbe8f1ed557e74ddaf7fde9c3c8ff8821da2 /Library/Homebrew/test/compiler_failure_spec.rb | |
| parent | 5e9057500419d1a2b41efe784e9f12ae232e7f6e (diff) | |
| parent | 3f8e52e5742cdd3d992ddee79741a4c4e45ab4bf (diff) | |
| download | brew-1a436b4d24d50011bc444cf5d2016f5c0f808dec.tar.bz2 | |
Merge branch 'master' into mirror_audit
Diffstat (limited to 'Library/Homebrew/test/compiler_failure_spec.rb')
| -rw-r--r-- | Library/Homebrew/test/compiler_failure_spec.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/Library/Homebrew/test/compiler_failure_spec.rb b/Library/Homebrew/test/compiler_failure_spec.rb new file mode 100644 index 000000000..b4fab0b27 --- /dev/null +++ b/Library/Homebrew/test/compiler_failure_spec.rb @@ -0,0 +1,37 @@ +require "compilers" + +RSpec::Matchers.alias_matcher :fail_with, :be_fails_with + +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", name: :clang, version: 425)) + end + + it "can be given a build number in a block" do + failure = described_class.create(:clang) { build 211 } + expect(failure).to fail_with(double("Compiler", name: :clang, version: 210)) + expect(failure).not_to fail_with(double("Compiler", name: :clang, version: 318)) + end + + it "can be given an empty block" do + failure = described_class.create(:clang) {} + expect(failure).to fail_with(double("Compiler", name: :clang, version: 425)) + end + + it "creates a failure when given a hash" do + failure = described_class.create(gcc: "4.8") + expect(failure).to fail_with(double("Compiler", name: "gcc-4.8", version: "4.8")) + expect(failure).to fail_with(double("Compiler", name: "gcc-4.8", version: "4.8.1")) + expect(failure).not_to fail_with(double("Compiler", name: "gcc-4.7", version: "4.7")) + end + + it "creates a failure when given a hash and a block with aversion" do + failure = described_class.create(gcc: "4.8") { version "4.8.1" } + expect(failure).to fail_with(double("Compiler", name: "gcc-4.8", version: "4.8")) + expect(failure).to fail_with(double("Compiler", name: "gcc-4.8", version: "4.8.1")) + expect(failure).not_to fail_with(double("Compiler", name: "gcc-4.8", version: "4.8.2")) + end + end +end |
