summaryrefslogtreecommitdiff
path: root/spec/unit/controller/call_spec.rb
blob: 7ff6c4097e583f1fba30ceeb8307f74941f2aac9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
require 'spec_helper'

describe Zero::Controller, '.call' do
  subject { controller.call(env) }
  let(:controller) { SpecController }
  let(:env) { EnvGenerator.get('/foo') }

  before :each do
    controller.renderer = Object.new
  end

  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

  it "does not modify an existing request" do
    r = Zero::Request.new(env)
    r.params['foo'] = 'bar'
    subject
    r = Zero::Request.new(env)
    expect(r.params['foo']).to eq('bar')
  end
end