mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Add test to assert the right sanitizer vendor is being used
This commit is contained in:
parent
5c057f9255
commit
c6f9cec1be
2 changed files with 42 additions and 1 deletions
2
Gemfile
2
Gemfile
|
@ -10,7 +10,7 @@ gem 'mocha', '~> 0.14', require: false
|
||||||
gem 'rack-cache', '~> 1.2'
|
gem 'rack-cache', '~> 1.2'
|
||||||
gem 'jquery-rails', github: 'rails/jquery-rails', branch: 'master'
|
gem 'jquery-rails', github: 'rails/jquery-rails', branch: 'master'
|
||||||
gem 'coffee-rails', '~> 4.0.0'
|
gem 'coffee-rails', '~> 4.0.0'
|
||||||
gem 'rails-html-sanitizer'
|
gem 'rails-html-sanitizer', github: 'rails/rails-html-sanitizer'
|
||||||
gem 'turbolinks', '~> 2.2.3'
|
gem 'turbolinks', '~> 2.2.3'
|
||||||
|
|
||||||
# require: false so bcrypt is loaded only when has_secure_password is used.
|
# require: false so bcrypt is loaded only when has_secure_password is used.
|
||||||
|
|
41
railties/test/application/default_stack_test.rb
Normal file
41
railties/test/application/default_stack_test.rb
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
require 'isolation/abstract_unit'
|
||||||
|
require 'rack/test'
|
||||||
|
require 'active_support/json'
|
||||||
|
|
||||||
|
module ApplicationTests
|
||||||
|
class DefaultStackTest < ActiveSupport::TestCase
|
||||||
|
include ActiveSupport::Testing::Isolation
|
||||||
|
include Rack::Test::Methods
|
||||||
|
|
||||||
|
def setup
|
||||||
|
build_app(initializers: true)
|
||||||
|
boot_rails
|
||||||
|
end
|
||||||
|
|
||||||
|
def teardown
|
||||||
|
teardown_app
|
||||||
|
end
|
||||||
|
|
||||||
|
test "the sanitizer helper" do
|
||||||
|
controller :foo, <<-RUBY
|
||||||
|
class FooController < ApplicationController
|
||||||
|
def index
|
||||||
|
render text: self.class.helpers.class.sanitizer_vendor
|
||||||
|
end
|
||||||
|
end
|
||||||
|
RUBY
|
||||||
|
|
||||||
|
app_file 'config/routes.rb', <<-RUBY
|
||||||
|
Rails.application.routes.draw do
|
||||||
|
get ':controller(/:action)'
|
||||||
|
end
|
||||||
|
RUBY
|
||||||
|
|
||||||
|
require "#{app_path}/config/environment"
|
||||||
|
|
||||||
|
get "/foo"
|
||||||
|
assert_equal 'Rails::Html::Sanitizer', last_response.body.strip
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue