Sha256: b992cbd425aedd805e671d11a923efee9fb19ecde9011ca27e4d93d98e423117

Contents?: true

Size: 329 Bytes

Versions: 3

Compression:

Stored size: 329 Bytes

Contents

require 'uri'

RSpec::Matchers.define :have_query_param do |key|
  match do |url|
    query_params_from(url)[key].present?
  end

  def query_params_from(url)
    Hash[query_for(url).split('&').map { |x| x.split('=', 2) }]
  end

  def uri_for(url)
    URI.parse(url)
  end

  def query_for(url)
    uri_for(url).query
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
saml-kit-1.0.9 lib/saml/kit/rspec/have_query_param.rb
saml-kit-1.0.8 lib/saml/kit/rspec/have_query_param.rb
saml-kit-1.0.7 lib/saml/kit/rspec/have_query_param.rb