Skip to content

Instantly share code, notes, and snippets.

@senny
Last active December 31, 2015 17:19
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 senny/8019086 to your computer and use it in GitHub Desktop.
Save senny/8019086 to your computer and use it in GitHub Desktop.
require 'rails'
require 'action_controller/railtie'
class TestApp < Rails::Application
config.root = File.dirname(__FILE__)
config.session_store :cookie_store, key: 'cookie_store_key'
config.secret_token = 'secret_token'
config.secret_key_base = 'secret_key_base'
config.logger = Logger.new($stdout)
Rails.logger = config.logger
routes.draw do
get '/' => 'test#index'
resources :streams do
end
end
end
class TestController < ActionController::Base
include Rails.application.routes.url_helpers
def index
render text: 'Home'
end
end
class StreamsController < ActionController::Base
include Rails.application.routes.url_helpers
def index
render text: 'Home'
end
end
require 'minitest/autorun'
require 'rack/test'
class BugTest < Minitest::Test
include Rack::Test::Methods
def test_returns_success
get '/streams'
assert last_response.ok?
get '/?author=senny'
assert last_response.ok?
get '/streams/?author=senny'
assert last_response.ok?
end
private
def app
Rails.application
end
end
@senny
Copy link
Author

senny commented Dec 18, 2013

Run options: --seed 10610

# Running:

D, [2013-12-18T09:36:37.882622 #41082] DEBUG -- :
D, [2013-12-18T09:36:37.882715 #41082] DEBUG -- :
I, [2013-12-18T09:36:37.883459 #41082]  INFO -- : Started GET "/streams" for 127.0.0.1 at 2013-12-18 09:36:37 +0100
D, [2013-12-18T09:36:37.892673 #41082] DEBUG -- :
D, [2013-12-18T09:36:37.892750 #41082] DEBUG -- :
I, [2013-12-18T09:36:37.892944 #41082]  INFO -- : Started GET "/?author=senny" for 127.0.0.1 at 2013-12-18 09:36:37 +0100
D, [2013-12-18T09:36:37.895565 #41082] DEBUG -- :
D, [2013-12-18T09:36:37.895627 #41082] DEBUG -- :
I, [2013-12-18T09:36:37.895781 #41082]  INFO -- : Started GET "/streams/?author=senny" for 127.0.0.1 at 2013-12-18 09:36:37 +0100
F, [2013-12-18T09:36:37.896809 #41082] FATAL -- :
ActionController::RoutingError (No route matches [GET] "/streams/"):
  lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  lib/action_dispatch/middleware/request_id.rb:21:in `call'
  lib/action_dispatch/middleware/static.rb:64:in `call'
  test.rb:49:in `test_returns_success'


F

Finished in 0.070030s, 14.2796 runs/s, 42.8388 assertions/s.

  1) Failure:
BugTest#test_returns_success [test.rb:50]:
Failed assertion, no message given.

1 runs, 3 assertions, 1 failures, 0 errors, 0 skips```

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