diff options
Diffstat (limited to 'spec/support/matchers/be_one_of.rb')
-rw-r--r-- | spec/support/matchers/be_one_of.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/support/matchers/be_one_of.rb b/spec/support/matchers/be_one_of.rb new file mode 100644 index 00000000000..16ee32b67c3 --- /dev/null +++ b/spec/support/matchers/be_one_of.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +RSpec::Matchers.define :be_one_of do |collection| + match do |item| + expect(collection).to include(item) + end + + failure_message do |item| + "expected #{item} to be one of #{collection}" + end +end |