From b20c0c527c89ec08548849163388d43207609fcd Mon Sep 17 00:00:00 2001 From: Gibheer Date: Tue, 18 Dec 2012 04:24:24 +0100 Subject: reuse render for actual rendering The splitting of rendering and processing is good, but on the other side it makes some double steps or even introduce workarounds. That is why I made the method #render just a call to the renderer. This should help much more than the strict seperation. The method will only return the resulting string and not add it to the body of the response. That still has to be taken care of by the user. --- spec/unit/controller/render_spec.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 spec/unit/controller/render_spec.rb (limited to 'spec') diff --git a/spec/unit/controller/render_spec.rb b/spec/unit/controller/render_spec.rb new file mode 100644 index 0000000..771db28 --- /dev/null +++ b/spec/unit/controller/render_spec.rb @@ -0,0 +1,19 @@ +require 'spec_helper' + +describe Zero::Controller, '#render' do + subject { Zero::Controller.new(env) } + let(:env) { EnvGenerator.get('/foo') } + let(:renderer) { mock } + let(:template) { '/foo' } + + before :each do + Zero::Controller.renderer = renderer + renderer.should_receive(:render).with(template, + kind_of(Zero::Request::AcceptType), subject) + end + after :each do + Zero::Controller.renderer = nil + end + + it { subject.render(template) } +end -- cgit v1.2.3-70-g09d2