diff options
Diffstat (limited to 'spec/support/matchers/be_url.rb')
-rw-r--r-- | spec/support/matchers/be_url.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/support/matchers/be_url.rb b/spec/support/matchers/be_url.rb index f8096af1b22..69171f53891 100644 --- a/spec/support/matchers/be_url.rb +++ b/spec/support/matchers/be_url.rb @@ -1,5 +1,11 @@ +# frozen_string_literal: true + RSpec::Matchers.define :be_url do |_| match do |actual| URI.parse(actual) rescue false end end + +# looks better when used like: +# expect(thing).to receive(:method).with(a_valid_url) +RSpec::Matchers.alias_matcher :a_valid_url, :be_url |