spec/shutterbug/rackapp_spec.rb in shutterbug-0.0.4 vs spec/shutterbug/rackapp_spec.rb in shutterbug-0.0.6

- old
+ new

@@ -4,24 +4,27 @@ actual[0] == 200 || actual[3] == filetype end end describe Shutterbug::Rackapp do - let(:sha) { "542112e" } - let(:size) { 200 } - let(:rackfile){ mock :fackfile, :size => size } - let(:service) { mock :service } - let(:app) { mock :app } + let(:sha) { "542112e" } + let(:size) { 200 } + let(:rackfile){ mock :fackfile, :size => size } + let(:service) { mock :service } + let(:app) { mock :app } + let(:config) { Shutterbug::Configuration.instance } + let(:post_data) do { 'content' => "<div class='foo'>foo!</div>", 'width' => 1000, 'height' => 700, 'css' => "", 'base_url' => "http://localhost:8080/" } end + subject { Shutterbug::Rackapp.new(app) } before(:each) do Shutterbug::Service.stub!(:new => service) end @@ -44,35 +47,35 @@ before(:each) do Rack::Request.stub!(:new).and_return(req) end describe "convert route" do - let(:path) { Shutterbug::Rackapp::CONVERT_PATH } + let(:path) { config.convert_path } let(:image_response) { mock :image_response } it "should route #do_convert" do subject.should_receive(:do_convert, :with => req).and_return image_response subject.call(mock).should == image_response end end describe "get png route" do - let(:path) { "#{Shutterbug::Rackapp::PNG_PATH}/#{sha}" } + let(:path) { config.png_path(sha) } it "should route #do_get_png" do service.should_receive(:get_png_file, :with => sha).and_return rackfile subject.call(mock).should be_happy_response('image/png') end end describe "get html route" do - let(:path) { "#{Shutterbug::Rackapp::HTML_PATH}/#{sha}" } + let(:path) { config.html_path(sha) } it "should route #do_get_html" do service.should_receive(:get_html_file, :with => sha).and_return rackfile subject.call(mock).should be_happy_response('text/html') end end describe "get shutterbug javascipt route" do - let(:path) { "#{Shutterbug::Rackapp::JS_PATH}" } + let(:path) { config.js_path } it "should route #do_get_shutterbug" do service.should_receive(:get_shutterbug_file).and_return rackfile subject.call(mock).should be_happy_response('application/javascript') end end \ No newline at end of file