Created
June 15, 2020 19:29
-
-
Save Edouard-chin/8425a6e57a3e0746e5431cd1543ff8ce to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require "bundler/inline" | |
gemfile(true) do | |
source "https://rubygems.org" | |
git_source(:github) { |repo| "https://github.com/#{repo}.git" } | |
gem "rails", github: 'rails/rails' | |
end | |
require "rack/test" | |
require "action_controller/railtie" | |
class TestApp < Rails::Application | |
config.root = __dir__ | |
config.hosts << "example.org" | |
config.session_store :cookie_store, key: "cookie_store_key" | |
secrets.secret_key_base = "secret_key_base" | |
config.logger = Logger.new($stdout) | |
Rails.logger = config.logger | |
routes.draw do | |
get "/" => "test#index" | |
post "/" => "test#create" | |
end | |
end | |
class TestController < ActionController::Base | |
include Rails.application.routes.url_helpers | |
def create | |
params[:domain][:host] | |
head(:ok) | |
end | |
end | |
require "minitest/autorun" | |
require "action_controller/test_case" | |
class BugTest < ActionController::TestCase | |
tests TestController | |
setup do | |
@routes = Rails.application.routes | |
end | |
def test_returns_success | |
post(:create, params: { domain: { host: 'hello' } }) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment