summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2017-06-02 15:15:54 +0000
committerSean McGivern <sean@mcgivern.me.uk>2017-06-02 15:15:54 +0000
commitd2f149539e53c9cd76fa439944d3d5ad2ff9c64c (patch)
tree05b174b12ff47b00271db30c89b1ad809f0940ef /spec/support
parentf123b6523328cec6445b32977f913e565f3965da (diff)
parent0d4d9a6a63b2ac60ffeeeaef389295919c3119f4 (diff)
downloadgitlab-ce-d2f149539e53c9cd76fa439944d3d5ad2ff9c64c.tar.gz
Merge branch '28080-system-checks' into 'master'
SystemCheck library for executing checks from a rake task See merge request !9173
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/matchers/execute_check.rb23
-rw-r--r--spec/support/rake_helpers.rb5
2 files changed, 28 insertions, 0 deletions
diff --git a/spec/support/matchers/execute_check.rb b/spec/support/matchers/execute_check.rb
new file mode 100644
index 00000000000..7232fad52fb
--- /dev/null
+++ b/spec/support/matchers/execute_check.rb
@@ -0,0 +1,23 @@
+RSpec::Matchers.define :execute_check do |expected|
+ match do |actual|
+ expect(actual).to eq(SystemCheck)
+ expect(actual).to receive(:run) do |*args|
+ expect(args[1]).to include(expected)
+ end
+ end
+
+ match_when_negated do |actual|
+ expect(actual).to eq(SystemCheck)
+ expect(actual).to receive(:run) do |*args|
+ expect(args[1]).not_to include(expected)
+ end
+ end
+
+ failure_message do |actual|
+ 'This matcher must be used with SystemCheck' unless actual == SystemCheck
+ end
+
+ failure_message_when_negated do |actual|
+ 'This matcher must be used with SystemCheck' unless actual == SystemCheck
+ end
+end
diff --git a/spec/support/rake_helpers.rb b/spec/support/rake_helpers.rb
index 4a8158ed79b..5cb415111d2 100644
--- a/spec/support/rake_helpers.rb
+++ b/spec/support/rake_helpers.rb
@@ -7,4 +7,9 @@ module RakeHelpers
def stub_warn_user_is_not_gitlab
allow_any_instance_of(Object).to receive(:warn_user_is_not_gitlab)
end
+
+ def silence_output
+ allow($stdout).to receive(:puts)
+ allow($stdout).to receive(:print)
+ end
end