Sha256: 96e1151534f74b41f888b79589994fdb712d3a784d06229527d885112b2166b6
Contents?: true
Size: 974 Bytes
Versions: 5
Compression:
Stored size: 974 Bytes
Contents
require 'rest-core/test' describe RC::DefaultQuery do before do @app = RC::DefaultQuery.new(RC::Dry.new, {}) end describe 'when given query' do should 'do nothing' do @app.call({}){ |r| r[RC::REQUEST_QUERY].should.eq({}) } end should 'merge query' do @app.instance_eval{@query = {'q' => 'uery'}} @app.call({}){ |r| r.should.eq({RC::REQUEST_QUERY => {'q' => 'uery'}}) } format = {'format' => 'json'} env = {RC::REQUEST_QUERY => format} @app.call(env){ |r| r.should.eq({RC::REQUEST_QUERY => {'q' => 'uery'}.merge(format)}) } end should 'string_keys in query' do env = {'query' => {:symbol => 'value'}} @app.call(env){ |r| r.should.eq({RC::REQUEST_QUERY => {'symbol' => 'value'}}.merge(env)) } end end describe 'when not given query' do should 'merge query with {}' do @app.call({}){ |r| r.should.eq({RC::REQUEST_QUERY => {}}) } end end end
Version data entries
5 entries across 5 versions & 1 rubygems