summaryrefslogtreecommitdiff
path: root/spec/support/matchers/be_url.rb
blob: 69171f53891fd71f8dbd5d509d84299362e94810 (plain)
1
2
3
4
5
6
7
8
9
10
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