Sha256: 59b761b0cba52b08d27148103346bbc7f1189d04cb3f676044a6a3797a995481

Contents?: true

Size: 329 Bytes

Versions: 8

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

8 entries across 8 versions & 1 rubygems

Version Path
saml-kit-1.0.6 lib/saml/kit/rspec/have_query_param.rb
saml-kit-1.0.5 lib/saml/kit/rspec/have_query_param.rb
saml-kit-1.0.4 lib/saml/kit/rspec/have_query_param.rb
saml-kit-1.0.3 lib/saml/kit/rspec/have_query_param.rb
saml-kit-1.0.2 lib/saml/kit/rspec/have_query_param.rb
saml-kit-1.0.1 lib/saml/kit/rspec/have_query_param.rb
saml-kit-1.0.0 lib/saml/kit/rspec/have_query_param.rb
saml-kit-0.3.6 lib/saml/kit/rspec/have_query_param.rb