2012-11-17 14:23:20 +01:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Zero::Controller, '.call' do
|
2012-12-10 21:12:45 +01:00
|
|
|
subject { controller.call(env) }
|
|
|
|
let(:controller) { SpecController }
|
2012-11-17 14:23:20 +01:00
|
|
|
let(:env) { EnvGenerator.get('/foo') }
|
|
|
|
|
2012-12-10 21:12:45 +01:00
|
|
|
before :each do
|
|
|
|
controller.renderer = Object.new
|
|
|
|
end
|
|
|
|
|
2012-11-17 14:23:20 +01:00
|
|
|
it "returns a response" do
|
|
|
|
subject.should be_respond_to(:to_a)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "returns an object with the first element being a status" do
|
|
|
|
subject[0].should be_kind_of(Numeric)
|
|
|
|
end
|
2012-11-29 22:22:21 +01:00
|
|
|
|
|
|
|
it "does not modify an existing request" do
|
|
|
|
r = Zero::Request.new(env)
|
|
|
|
r.params['foo'] = 'bar'
|
|
|
|
subject
|
2012-12-12 18:38:46 +01:00
|
|
|
r = Zero::Request.new(env)
|
2012-11-29 22:22:21 +01:00
|
|
|
expect(r.params['foo']).to eq('bar')
|
|
|
|
end
|
2012-11-17 14:23:20 +01:00
|
|
|
end
|