aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorMarkus Reiter2017-03-04 22:59:13 +0100
committerMarkus Reiter2017-03-05 00:57:34 +0100
commitcc4fb35ae46fbbdeabbc564cae09507450838070 (patch)
tree6c64ebdc362f996fa51fdae5755f6602383d4c66 /Library/Homebrew
parentf84ad9ca2ea0e86a2ba43c8b4b9cdffd0a707f5a (diff)
downloadbrew-cc4fb35ae46fbbdeabbc564cae09507450838070.tar.bz2
Move Cask `shared_examples` to `test/support`.
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/cask/spec/cask/dsl/caveats_spec.rb1
-rw-r--r--Library/Homebrew/cask/spec/cask/dsl/postflight_spec.rb2
-rw-r--r--Library/Homebrew/cask/spec/cask/dsl/preflight_spec.rb2
-rw-r--r--Library/Homebrew/cask/spec/cask/dsl/uninstall_postflight_spec.rb1
-rw-r--r--Library/Homebrew/cask/spec/cask/dsl/uninstall_preflight_spec.rb2
-rw-r--r--Library/Homebrew/test/support/helper/spec/shared_examples/hbc_dsl_base.rb (renamed from Library/Homebrew/cask/spec/support/shared_examples/dsl_base.rb)0
-rw-r--r--Library/Homebrew/test/support/helper/spec/shared_examples/hbc_staged.rb (renamed from Library/Homebrew/cask/spec/support/shared_examples/staged.rb)40
7 files changed, 26 insertions, 22 deletions
diff --git a/Library/Homebrew/cask/spec/cask/dsl/caveats_spec.rb b/Library/Homebrew/cask/spec/cask/dsl/caveats_spec.rb
index 777491d66..07940cd0a 100644
--- a/Library/Homebrew/cask/spec/cask/dsl/caveats_spec.rb
+++ b/Library/Homebrew/cask/spec/cask/dsl/caveats_spec.rb
@@ -1,4 +1,5 @@
require "spec_helper"
+require "test/support/helper/spec/shared_examples/hbc_dsl_base"
describe Hbc::DSL::Caveats do
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/basic-cask.rb") }
diff --git a/Library/Homebrew/cask/spec/cask/dsl/postflight_spec.rb b/Library/Homebrew/cask/spec/cask/dsl/postflight_spec.rb
index 116a7c8a8..d7a8f219d 100644
--- a/Library/Homebrew/cask/spec/cask/dsl/postflight_spec.rb
+++ b/Library/Homebrew/cask/spec/cask/dsl/postflight_spec.rb
@@ -1,4 +1,6 @@
require "spec_helper"
+require "test/support/helper/spec/shared_examples/hbc_dsl_base"
+require "test/support/helper/spec/shared_examples/hbc_staged"
describe Hbc::DSL::Postflight do
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/basic-cask.rb") }
diff --git a/Library/Homebrew/cask/spec/cask/dsl/preflight_spec.rb b/Library/Homebrew/cask/spec/cask/dsl/preflight_spec.rb
index 90d2634db..81b0c7975 100644
--- a/Library/Homebrew/cask/spec/cask/dsl/preflight_spec.rb
+++ b/Library/Homebrew/cask/spec/cask/dsl/preflight_spec.rb
@@ -1,4 +1,6 @@
require "spec_helper"
+require "test/support/helper/spec/shared_examples/hbc_dsl_base"
+require "test/support/helper/spec/shared_examples/hbc_staged"
describe Hbc::DSL::Preflight do
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/basic-cask.rb") }
diff --git a/Library/Homebrew/cask/spec/cask/dsl/uninstall_postflight_spec.rb b/Library/Homebrew/cask/spec/cask/dsl/uninstall_postflight_spec.rb
index 4b7dd7557..448e1b411 100644
--- a/Library/Homebrew/cask/spec/cask/dsl/uninstall_postflight_spec.rb
+++ b/Library/Homebrew/cask/spec/cask/dsl/uninstall_postflight_spec.rb
@@ -1,4 +1,5 @@
require "spec_helper"
+require "test/support/helper/spec/shared_examples/hbc_dsl_base"
describe Hbc::DSL::UninstallPostflight do
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/basic-cask.rb") }
diff --git a/Library/Homebrew/cask/spec/cask/dsl/uninstall_preflight_spec.rb b/Library/Homebrew/cask/spec/cask/dsl/uninstall_preflight_spec.rb
index a4930e99e..aac34e76a 100644
--- a/Library/Homebrew/cask/spec/cask/dsl/uninstall_preflight_spec.rb
+++ b/Library/Homebrew/cask/spec/cask/dsl/uninstall_preflight_spec.rb
@@ -1,4 +1,6 @@
require "spec_helper"
+require "test/support/helper/spec/shared_examples/hbc_dsl_base"
+require "test/support/helper/spec/shared_examples/hbc_staged"
describe Hbc::DSL::UninstallPreflight do
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/basic-cask.rb") }
diff --git a/Library/Homebrew/cask/spec/support/shared_examples/dsl_base.rb b/Library/Homebrew/test/support/helper/spec/shared_examples/hbc_dsl_base.rb
index 400ff40f6..400ff40f6 100644
--- a/Library/Homebrew/cask/spec/support/shared_examples/dsl_base.rb
+++ b/Library/Homebrew/test/support/helper/spec/shared_examples/hbc_dsl_base.rb
diff --git a/Library/Homebrew/cask/spec/support/shared_examples/staged.rb b/Library/Homebrew/test/support/helper/spec/shared_examples/hbc_staged.rb
index d815ef7a0..31083ee58 100644
--- a/Library/Homebrew/cask/spec/support/shared_examples/staged.rb
+++ b/Library/Homebrew/test/support/helper/spec/shared_examples/hbc_staged.rb
@@ -1,21 +1,17 @@
-require "spec_helper"
-
require "hbc/staged"
shared_examples Hbc::Staged do
- let(:fake_pathname_exists) {
- fake_pathname = Pathname.new("/path/to/file/that/exists")
- allow(fake_pathname).to receive(:exist?).and_return(true)
- allow(fake_pathname).to receive(:expand_path).and_return(fake_pathname)
- fake_pathname
- }
-
- let(:fake_pathname_does_not_exist) {
- fake_pathname = Pathname.new("/path/to/file/that/does/not/exist")
- allow(fake_pathname).to receive(:exist?).and_return(false)
- allow(fake_pathname).to receive(:expand_path).and_return(fake_pathname)
- fake_pathname
- }
+ let(:existing_path) { Pathname.new("/path/to/file/that/exists") }
+ let(:non_existent_path) { Pathname.new("/path/to/file/that/does/not/exist") }
+
+ before(:each) do
+ allow(existing_path).to receive(:exist?).and_return(true)
+ allow(existing_path).to receive(:expand_path)
+ .and_return(existing_path)
+ allow(non_existent_path).to receive(:exist?).and_return(false)
+ allow(non_existent_path).to receive(:expand_path)
+ .and_return(non_existent_path)
+ end
it "can run system commands with list-form arguments" do
Hbc::FakeSystemCommand.expects_command(
@@ -56,7 +52,7 @@ shared_examples Hbc::Staged do
end
it "can set the permissions of a file" do
- fake_pathname = fake_pathname_exists
+ fake_pathname = existing_path
allow(staged).to receive(:Pathname).and_return(fake_pathname)
Hbc::FakeSystemCommand.expects_command(
@@ -69,7 +65,7 @@ shared_examples Hbc::Staged do
end
it "can set the permissions of multiple files" do
- fake_pathname = fake_pathname_exists
+ fake_pathname = existing_path
allow(staged).to receive(:Pathname).and_return(fake_pathname)
Hbc::FakeSystemCommand.expects_command(
@@ -82,13 +78,13 @@ shared_examples Hbc::Staged do
end
it "cannot set the permissions of a file that does not exist" do
- fake_pathname = fake_pathname_does_not_exist
+ fake_pathname = non_existent_path
allow(staged).to receive(:Pathname).and_return(fake_pathname)
staged.set_permissions(fake_pathname.to_s, "777")
end
it "can set the ownership of a file" do
- fake_pathname = fake_pathname_exists
+ fake_pathname = existing_path
allow(staged).to receive(:current_user).and_return("fake_user")
allow(staged).to receive(:Pathname).and_return(fake_pathname)
@@ -103,7 +99,7 @@ shared_examples Hbc::Staged do
end
it "can set the ownership of multiple files" do
- fake_pathname = fake_pathname_exists
+ fake_pathname = existing_path
allow(staged).to receive(:current_user).and_return("fake_user")
allow(staged).to receive(:Pathname).and_return(fake_pathname)
@@ -118,7 +114,7 @@ shared_examples Hbc::Staged do
end
it "can set the ownership of a file with a different user and group" do
- fake_pathname = fake_pathname_exists
+ fake_pathname = existing_path
allow(staged).to receive(:Pathname).and_return(fake_pathname)
@@ -133,7 +129,7 @@ shared_examples Hbc::Staged do
it "cannot set the ownership of a file that does not exist" do
allow(staged).to receive(:current_user).and_return("fake_user")
- fake_pathname = fake_pathname_does_not_exist
+ fake_pathname = non_existent_path
allow(staged).to receive(:Pathname).and_return(fake_pathname)
shutup do