diff options
| author | Gabriel Mazetto <brodock@gmail.com> | 2017-02-13 12:21:12 +0100 |
|---|---|---|
| committer | Gabriel Mazetto <brodock@gmail.com> | 2017-05-31 14:33:03 +0200 |
| commit | bc6d131b74ba4cdf7acadea5a5b7d23f083f47ed (patch) | |
| tree | 2cff048cee92204e1579957531fa6027e8e8e7db /spec/support | |
| parent | a4460f420bbbac30fbcec3395261c89749b52bbd (diff) | |
| download | gitlab-ce-bc6d131b74ba4cdf7acadea5a5b7d23f083f47ed.tar.gz | |
Added specs for SystemCheck and custom matcher
Diffstat (limited to 'spec/support')
| -rw-r--r-- | spec/support/matchers/execute_check.rb | 19 |
1 files changed, 19 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..9664eb3879d --- /dev/null +++ b/spec/support/matchers/execute_check.rb @@ -0,0 +1,19 @@ +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| + return 'This matcher must be used with SystemCheck' unless actual == SystemCheck + end +end |
