spec/server/rack/http_resource_spec.rb in volt-0.9.3.pre1 vs spec/server/rack/http_resource_spec.rb in volt-0.9.3.pre2
- old
+ new
@@ -32,33 +32,33 @@
get '/stuff/{{ stuff_id }}', controller: 'simple', action: 'show'
end
end
it 'should initialize the correct controller and call the correct action' do
- http_resource = Volt::HttpResource.new(app, @routes)
+ http_resource = Volt::HttpResource.new(app, volt_app, @routes)
env = Rack::MockRequest.env_for('http://example.com/stuff')
request = Volt::HttpRequest.new(env)
- controller = SimpleController.new({}, request)
+ controller = SimpleController.new(volt_app, {}, request)
expect(SimpleController).to receive(:new).and_return(controller)
response = http_resource.call(env)
expect(response.status).to eq(200)
expect(response.body).to eq(['just some text'])
expect(controller.action_called).to eq(true)
end
it 'should parse the correct params to the controller' do
- http_resource = Volt::HttpResource.new(app, @routes)
+ http_resource = Volt::HttpResource.new(app, volt_app, @routes)
env = Rack::MockRequest.env_for('http://example.com/stuff/99?test=another_param')
request = Volt::HttpRequest.new(env)
response = http_resource.call(env)
expect(response.status).to eq(200)
expect(response.body).to eq(['show with id 99 and another_param called'])
end
it 'should call the supplied app if routes are not matched and cause a 404' do
- http_resource = Volt::HttpResource.new(app, @routes)
+ http_resource = Volt::HttpResource.new(app, volt_app, @routes)
env = Rack::MockRequest.env_for('http://example.com/not_a_valid_param')
request = Volt::HttpRequest.new(env)
response = http_resource.call(env)
expect(response[0]).to eq(404)
#expect(response.body).to eq(['show with id 99 and another_param called'])