Sha256: f947e8ea1fd08bf37ef7bbd8b3ed2531802f7d7d4e4dc8b13547deb0b51939c3
Contents?: true
Size: 1.25 KB
Versions: 6
Compression:
Stored size: 1.25 KB
Contents
require File.dirname(__FILE__) + '/../../../spec_helper' require 'rack/test' require 'useless/doc/rack/stylesheet' require 'useless/doc/ui/godel' describe Useless::Doc::Rack::Stylesheet do include Rack::Test::Methods def base_app @base_app ||= lambda do |env| [200, {'Content-Type' => 'text/plain'}, ['Not a stylesheet request.']] end end def app @app ||= lambda do |env| env['useless.doc.ui'] = Useless::Doc::UI::Godel Useless::Doc::Rack::Stylesheet.new(base_app).call(env) end end it 'should raise an error if a UI is not specified' do app = Useless::Doc::Rack::Stylesheet.new(base_app) request = Rack::MockRequest.new(app) lambda { request.get('http://some-api.granmal.com/doc.css') }.should raise_error(RuntimeError, 'No UI specified.') end it 'should proxy requests if the path is not doc.css' do get 'http://some-api.granmal.com/not/doc.css' last_response.body.should == 'Not a stylesheet request.' end it 'should return the UI\'s CSS if the path is doc.css' do Useless::Doc::UI::Godel.should_receive(:css).and_return('some css') get 'http://some-api.granmal.com/doc.css' last_response.body.should == 'some css' last_response['Content-Type'].should == 'text/css' end end
Version data entries
6 entries across 6 versions & 1 rubygems