Sha256: 1fb333785fb0eed2726d54eb5969acf28550967a7d6c8849de174fbee90bd2cc
Contents?: true
Size: 1020 Bytes
Versions: 3
Compression:
Stored size: 1020 Bytes
Contents
require File.dirname(__FILE__) + '/../../../spec_helper' require 'rack/test' require 'useless/doc/ui/godel' require 'useless/doc/core/api' require 'useless/doc/rack/html' describe Useless::Doc::Rack::HTML do include Rack::Test::Methods before(:all) do @ui = Useless::Doc::UI::Godel.new(nil) @subject = Useless::Doc::Core::API.new end def app @app ||= lambda do |env| env['useless.doc.ui'] = @ui env['useless.doc.subject'] = @subject Useless::Doc::Rack::HTML.call(env) end end it 'should transform the subject to HTML via the specified UI' do @ui.should_receive(:html).with(@subject).and_return('html') get 'http://some-api.doc.useless.io/some/resource' last_response.should be_ok last_response.body.should == 'html' end it 'should return a 404 if the UI cannot render the HTML' do @ui.should_receive(:html).with(@subject).and_return(nil) get 'http://some-api.doc.useless.io/some/resource' last_response.should be_not_found end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
useless-doc-0.4.0 | spec/useless/doc/rack/html_spec.rb |
useless-doc-0.3.1 | spec/useless/doc/rack/html_spec.rb |
useless-doc-0.3.0 | spec/useless/doc/rack/html_spec.rb |