Created
December 18, 2018 09:09
-
-
Save r7kamura/776988f9cf3f2d7667c778b0a9f5efde 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
require 'bundler/inline' | |
gemfile do | |
source 'https://rubygems.org' | |
gem 'rails', '5.1.6' | |
end | |
require 'action_controller/railtie' | |
require 'minitest/autorun' | |
require 'rails/test_help' | |
class TestApp < Rails::Application | |
secrets.secret_key_base = 'secret_key_base' | |
::Rails.logger = ::Logger.new(nil) | |
routes.draw do | |
get '/' => 'test#index' | |
end | |
end | |
class TestController < ActionController::Base | |
include ::Rails.application.routes.url_helpers | |
def index | |
head(200) | |
end | |
end | |
class ControllerParamsTest < ActionController::TestCase | |
def setup | |
super | |
@controller = ::TestController.new | |
end | |
def test_params_with_empty_hash | |
get :index, params: {} | |
assert_equal 200, response.status | |
end | |
def test_params_with_nil | |
get :index, params: nil | |
assert_equal 200, response.status | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expected
Actual