diff options
| author | Mike McQuaid | 2017-11-30 09:30:10 +0000 |
|---|---|---|
| committer | GitHub | 2017-11-30 09:30:10 +0000 |
| commit | 3d96cd156a0a6560b60bebe3b286af4aafbe5851 (patch) | |
| tree | 4795a2fb03f7f784d1e872b67d0e7bc873c92da5 /Library | |
| parent | 23d99b4155fe9a97c6bf7bf052dd8354c935e6fa (diff) | |
| parent | 959538caf585cf1431b802dbc0c9da2054355aae (diff) | |
| download | brew-3d96cd156a0a6560b60bebe3b286af4aafbe5851.tar.bz2 | |
Merge pull request #3506 from MikeMcQuaid/cleaner_spec_os
cleaner_spec: have a single "cleans files" test.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/test/cleaner_spec.rb | 41 | ||||
| -rw-r--r-- | Library/Homebrew/test/spec_helper.rb | 4 |
2 files changed, 20 insertions, 25 deletions
diff --git a/Library/Homebrew/test/cleaner_spec.rb b/Library/Homebrew/test/cleaner_spec.rb index 6e603da0e..f6c6cb17b 100644 --- a/Library/Homebrew/test/cleaner_spec.rb +++ b/Library/Homebrew/test/cleaner_spec.rb @@ -12,30 +12,29 @@ describe Cleaner do end describe "#clean" do - it "cleans files", :needs_macos do + it "cleans files" do f.bin.mkpath f.lib.mkpath - cp "#{TEST_FIXTURE_DIR}/mach/a.out", f.bin - cp Dir["#{TEST_FIXTURE_DIR}/mach/*.dylib"], f.lib - subject.clean - - expect((f.bin/"a.out").stat.mode).to eq(0100555) - expect((f.lib/"fat.dylib").stat.mode).to eq(0100444) - expect((f.lib/"x86_64.dylib").stat.mode).to eq(0100444) - expect((f.lib/"i386.dylib").stat.mode).to eq(0100444) - end - - it "cleans files", :needs_linux do - f.bin.mkpath - f.lib.mkpath - cp "#{TEST_FIXTURE_DIR}/elf/hello", f.bin - cp Dir["#{TEST_FIXTURE_DIR}/elf/libhello.so.0"], f.lib - - subject.clean - - expect((f.bin/"hello").stat.mode).to eq(0100555) - expect((f.lib/"libhello.so.0").stat.mode).to eq(0100555) + if OS.mac? + cp "#{TEST_FIXTURE_DIR}/mach/a.out", f.bin + cp Dir["#{TEST_FIXTURE_DIR}/mach/*.dylib"], f.lib + elsif OS.linux? + cp "#{TEST_FIXTURE_DIR}/elf/hello", f.bin + cp Dir["#{TEST_FIXTURE_DIR}/elf/libhello.so.0"], f.lib + end + + subject.clean + + if OS.mac? + expect((f.bin/"a.out").stat.mode).to eq(0100555) + expect((f.lib/"fat.dylib").stat.mode).to eq(0100444) + expect((f.lib/"x86_64.dylib").stat.mode).to eq(0100444) + expect((f.lib/"i386.dylib").stat.mode).to eq(0100444) + elsif OS.linux? + expect((f.bin/"hello").stat.mode).to eq(0100555) + expect((f.lib/"libhello.so.0").stat.mode).to eq(0100555) + end end it "prunes the prefix if it is empty" do diff --git a/Library/Homebrew/test/spec_helper.rb b/Library/Homebrew/test/spec_helper.rb index 6258cbd91..08766ea37 100644 --- a/Library/Homebrew/test/spec_helper.rb +++ b/Library/Homebrew/test/spec_helper.rb @@ -61,10 +61,6 @@ RSpec.configure do |config| skip "Needs official command Taps." unless ENV["HOMEBREW_TEST_OFFICIAL_CMD_TAPS"] end - config.before(:each, :needs_linux) do - skip "Not on Linux." unless OS.linux? - end - config.before(:each, :needs_macos) do skip "Not on macOS." unless OS.mac? end |
