Skip to content

Instantly share code, notes, and snippets.

@arthurnn
Created July 13, 2015 17:42
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 arthurnn/479e70db1fd75a34eb0b to your computer and use it in GitHub Desktop.
Save arthurnn/479e70db1fd75a34eb0b to your computer and use it in GitHub Desktop.
require 'action_controller/railtie'
class HelloController < ActionController::Metal
def index
self.response_body = "Hello World!"
end
end
class TestApp < Rails::Application
config.root = File.dirname(__FILE__)
config.session_store :cookie_store, key: 'cookie_store_key'
secrets.secret_token = 'secret_token'
secrets.secret_key_base = 'secret_key_base'
Rails.logger = config.logger = Logger.new($stdout)
routes.draw do
get 'index', to: 'hello#index'
end
end
require 'minitest/autorun'
require 'rack/test'
class BugTest < ActionController::TestCase
def setup
@routes = Rails.application.routes
@controller = HelloController.new
end
def test_returns_success
get :index
assert_equal "Hello World!", @response.body
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment