Sha256: c49a469e284165dcb8d8da3a88b1b340b3635220c22790ebe5cb2d27d4ee8ea7

Contents?: true

Size: 720 Bytes

Versions: 17

Compression:

Stored size: 720 Bytes

Contents

require "spec_helper"
require "shamu/rack"

describe Shamu::Rack::QueryParams do
  let( :headers )      { {} }
  let( :env )          { { "rack.input" => StringIO.new } }
  let( :query_params ) { Shamu::Rack::QueryParams.new( env ) }

  it "gets a cookie" do
    env[ "QUERY_STRING" ] = "toggles=yep"
    expect( query_params.get( "toggles" ) ).to eq "yep"
  end

  it "handles array parameters" do
    env[ "QUERY_STRING" ] = "level[]=one&level[]=two"
    expect( query_params.get( "level" ) ).to eq [ "one", "two" ]
  end

  it "handles hash parameters" do
    env[ "QUERY_STRING" ] = "option[save]=yes&option[method]=tail"
    expect( query_params.get( "option" ) ).to eq "save" => "yes", "method" => "tail"
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
shamu-0.0.24 spec/lib/shamu/rack/query_params_spec.rb
shamu-0.0.21 spec/lib/shamu/rack/query_params_spec.rb
shamu-0.0.20 spec/lib/shamu/rack/query_params_spec.rb
shamu-0.0.19 spec/lib/shamu/rack/query_params_spec.rb
shamu-0.0.18 spec/lib/shamu/rack/query_params_spec.rb
shamu-0.0.17 spec/lib/shamu/rack/query_params_spec.rb
shamu-0.0.15 spec/lib/shamu/rack/query_params_spec.rb
shamu-0.0.14 spec/lib/shamu/rack/query_params_spec.rb
shamu-0.0.13 spec/lib/shamu/rack/query_params_spec.rb
shamu-0.0.11 spec/lib/shamu/rack/query_params_spec.rb
shamu-0.0.9 spec/lib/shamu/rack/query_params_spec.rb
shamu-0.0.8 spec/lib/shamu/rack/query_params_spec.rb
shamu-0.0.7 spec/lib/shamu/rack/query_params_spec.rb
shamu-0.0.5 spec/lib/shamu/rack/query_params_spec.rb
shamu-0.0.4 spec/lib/shamu/rack/query_params_spec.rb
shamu-0.0.3 spec/lib/shamu/rack/query_params_spec.rb
shamu-0.0.2 spec/lib/shamu/rack/query_params_spec.rb