Sha256: 841a96a4f4222dacaac99b04d5b687b0cc2fbc757eff355f68fd8390d69691b2
Contents?: true
Size: 1.13 KB
Versions: 2
Compression:
Stored size: 1.13 KB
Contents
require 'spec_helper' describe Landable::PageRenderResponder do let(:page) { build :page } let(:responder) { Landable::PageRenderResponder.new double(request: double, formats: []), [page] } describe '#to_html' do context 'okay' do it 'should render a 200' do content = double content_type = double Landable::RenderService.should_receive(:call) { content } page.should_receive(:content_type) { content_type } responder.should_receive(:render).with(text: content, content_type: content_type, layout: false) responder.to_html end end context 'redirect' do let(:page) { build :page, :redirect } it 'should render a redirect' do responder.should_receive(:redirect_to).with(page.redirect_url, status: page.status_code) responder.should_not_receive(:render) responder.to_html end end context 'missing' do let(:page) { build :page, :gone } it 'should render a 410' do expect { responder.to_html }.to raise_error(Landable::Page::GoneError) responder.should_not_receive(:render) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
landable-1.14.0 | spec/responders/page_render_responder_spec.rb |
landable-1.13.2 | spec/responders/page_render_responder_spec.rb |