Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

45 lines (33 sloc) 0.906 kb
require 'rest-core/test'
describe RC::DefaultQuery do
describe 'when given query' do
before do
@app = RC::DefaultQuery.new(RC::Dry.new, {})
end
def app
@app
end
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
end
describe 'when not given query' do
before do
@app = RC::DefaultQuery.new(RC::Dry.new)
end
def app
@app
end
should 'merge query with {}' do
app.call({}){ |r| r.should.eq({RC::REQUEST_QUERY => {}}) }
end
end
end
Jump to Line
Something went wrong with that request. Please try again.