Skip to content

Instantly share code, notes, and snippets.

@manadart
Created August 25, 2012 11:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manadart/3464182 to your computer and use it in GitHub Desktop.
Save manadart/3464182 to your computer and use it in GitHub Desktop.
async_sinatra cannot determine application with Sinatra 1.3.3
require 'sinatra/base'
require 'sinatra/async'
class MyApp < Sinatra::Base
register Sinatra::Async
configure do
set :raise_errors, false
set :show_exceptions, false
enable :logging
end
aget '/' do
body 'Big time!'
end
end
require 'rspec'
require 'test/unit'
require 'eventmachine'
require 'sinatra/async/test'
require_relative '../app'
ENV['RACK_ENV'] = 'test'
RSpec.configure do |config|
config.include Test::Unit::Assertions
config.include Sinatra::Async::Test::Methods
end
describe 'MyApp', :type => :request do
def app
MyApp.new
end
it 'can access the base route.' do
aget '/'
last_response.status.should eq 200
end
end
Failures:
1) MyApp can access the base route.
Failure/Error: aget '/'
RuntimeError:
Cannot determine sinatra application from #<struct Sinatra::ExtendedRack app=#<Rack::Head:0xa0c5490 @app=#<Sinatra::CommonLogger:0xa0c54a4 @app=#<Rack::Logger:0xa0c54e0 @app=#<Rack::Protection::FrameOptions:0xa0c5580 @app=#<Rack::Protection::IPSpoofing:0xa0c55f8 @app=#<Rack::Protection::JsonCsrf:0xa0c574c @app=#<Rack::Protection::PathTraversal:0xa0c57d8 @app=#<Rack::Protection::XSSHeader:0xa0c5878 @app=#<MyApp:0xa0c61c4 @default_layout=:layout, @app=nil, @template_cache=#<Tilt::Cache:0xa0c61b0 @cache={}>>, @options={:reaction=>:drop_session, :logging=>true, :message=>"Forbidden", :encryptor=>Digest::SHA1, :session_key=>"rack.session", :status=>403, :allow_empty_referrer=>true, :xss_mode=>:block, :except=>[:session_hijacking, :remote_token]}>, @options={:reaction=>:drop_session, :logging=>true, :message=>"Forbidden", :encryptor=>Digest::SHA1, :session_key=>"rack.session", :status=>403, :allow_empty_referrer=>true, :except=>[:session_hijacking, :remote_token]}>, @options={:reaction=>:drop_session, :logging=>true, :message=>"Forbidden", :encryptor=>Digest::SHA1, :session_key=>"rack.session", :status=>403, :allow_empty_referrer=>true, :except=>[:session_hijacking, :remote_token]}>, @options={:reaction=>:drop_session, :logging=>true, :message=>"Forbidden", :encryptor=>Digest::SHA1, :session_key=>"rack.session", :status=>403, :allow_empty_referrer=>true, :except=>[:session_hijacking, :remote_token]}>, @options={:reaction=>:drop_session, :logging=>true, :message=>"Forbidden", :encryptor=>Digest::SHA1, :session_key=>"rack.session", :status=>403, :allow_empty_referrer=>true, :xss_mode=>:block, :frame_options=>:sameorigin, :except=>[:session_hijacking, :remote_token]}>, @level=1>, @logger=nil>>>
# ./app_spec.rb:20:in `block (2 levels) in <top (required)>'
Finished in 0.05393 seconds
1 example, 1 failure
@will
Copy link

will commented Nov 28, 2012

Just ran into this. Did you ever find a solution?

@parasquid
Copy link

Same here. Scratching my head over this :(

@manadart
Copy link
Author

FYI if others encounter this:

There's a PR here that's never been merged.

Just get the fix from Soffes' fork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment