aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/application/generators_test.rb28
-rw-r--r--railties/test/application/initializers/frameworks_test.rb27
-rw-r--r--railties/test/application/middleware_test.rb30
-rw-r--r--railties/test/application/rake_test.rb20
-rw-r--r--railties/test/generators/app_generator_test.rb33
-rw-r--r--railties/test/generators/resource_generator_test.rb6
-rw-r--r--railties/test/generators/scaffold_controller_generator_test.rb37
-rw-r--r--railties/test/generators_test.rb51
8 files changed, 0 insertions, 232 deletions
diff --git a/railties/test/application/generators_test.rb b/railties/test/application/generators_test.rb
index 15a71260c1..bf58bb3f74 100644
--- a/railties/test/application/generators_test.rb
+++ b/railties/test/application/generators_test.rb
@@ -125,33 +125,5 @@ module ApplicationTests
assert_equal expected, c.generators.options
end
end
-
- test "http only disables options from generators" do
- add_to_config <<-RUBY
- config.generators.http_only!
- RUBY
-
- # Initialize the application
- require "#{app_path}/config/environment"
- Rails.application.load_generators
-
- assert !Rails::Generators.options[:rails][:template_engine],
- "http only should have disabled generator options"
- end
-
- test "http only allow overriding generators options" do
- add_to_config <<-RUBY
- config.generators.helper = true
- config.generators.http_only!
- config.generators.template_engine = :my_template
- RUBY
-
- # Initialize the application
- require "#{app_path}/config/environment"
- Rails.application.load_generators
-
- assert_equal :my_template, Rails::Generators.options[:rails][:template_engine]
- assert_equal true, Rails::Generators.options[:rails][:helper]
- end
end
end
diff --git a/railties/test/application/initializers/frameworks_test.rb b/railties/test/application/initializers/frameworks_test.rb
index cb321f0dd4..a08e5b2374 100644
--- a/railties/test/application/initializers/frameworks_test.rb
+++ b/railties/test/application/initializers/frameworks_test.rb
@@ -130,33 +130,6 @@ module ApplicationTests
assert_equal "false", last_response.body
end
- test "action_controller http initializes successfully" do
- app_file "app/controllers/application_controller.rb", <<-RUBY
- class ApplicationController < ActionController::HTTP
- end
- RUBY
-
- app_file "app/controllers/omg_controller.rb", <<-RUBY
- class OmgController < ApplicationController
- def show
- render :json => { :omg => 'omg' }
- end
- end
- RUBY
-
- app_file "config/routes.rb", <<-RUBY
- AppTemplate::Application.routes.draw do
- match "/:controller(/:action)"
- end
- RUBY
-
- require 'rack/test'
- extend Rack::Test::Methods
-
- get '/omg/show'
- assert_equal '{"omg":"omg"}', last_response.body
- end
-
# AD
test "action_dispatch extensions are applied to ActionDispatch" do
add_to_config "config.action_dispatch.tld_length = 2"
diff --git a/railties/test/application/middleware_test.rb b/railties/test/application/middleware_test.rb
index 43f86f40e4..2f62d978e3 100644
--- a/railties/test/application/middleware_test.rb
+++ b/railties/test/application/middleware_test.rb
@@ -52,36 +52,6 @@ module ApplicationTests
], middleware
end
- test "http only middleware stack" do
- add_to_config "config.middleware.http_only!"
- add_to_config "config.force_ssl = true"
- add_to_config "config.action_dispatch.x_sendfile_header = 'X-Sendfile'"
-
- boot!
-
- assert_equal [
- "Rack::SSL",
- "Rack::Sendfile",
- "ActionDispatch::Static",
- "Rack::Lock",
- "ActiveSupport::Cache::Strategy::LocalCache",
- "Rack::Runtime",
- "ActionDispatch::RequestId",
- "Rails::Rack::Logger",
- "ActionDispatch::ShowExceptions",
- "ActionDispatch::DebugExceptions",
- "ActionDispatch::RemoteIp",
- "ActionDispatch::Reloader",
- "ActionDispatch::Callbacks",
- "ActiveRecord::ConnectionAdapters::ConnectionManagement",
- "ActiveRecord::QueryCache",
- "ActionDispatch::ParamsParser",
- "ActionDispatch::Head",
- "Rack::ConditionalGet",
- "Rack::ETag"
- ], middleware
- end
-
test "Rack::Sendfile is not included by default" do
boot!
diff --git a/railties/test/application/rake_test.rb b/railties/test/application/rake_test.rb
index 545020357a..b6cbb10141 100644
--- a/railties/test/application/rake_test.rb
+++ b/railties/test/application/rake_test.rb
@@ -132,26 +132,6 @@ module ApplicationTests
assert_no_match(/Errors running/, output)
end
- def test_http_scaffold_tests_pass_by_default
- add_to_config <<-RUBY
- config.middleware.http_only!
- config.generators.http_only!
- RUBY
-
- app_file "app/controllers/application_controller.rb", <<-RUBY
- class ApplicationController < ActionController::HTTP
- end
- RUBY
-
- output = Dir.chdir(app_path) do
- `rails generate scaffold user username:string password:string;
- bundle exec rake db:migrate db:test:clone test`
- end
-
- assert_match(/6 tests, 12 assertions, 0 failures, 0 errors/, output)
- assert_no_match(/Errors running/, output)
- end
-
def test_rake_dump_structure_should_respect_db_structure_env_variable
Dir.chdir(app_path) do
# ensure we have a schema_migrations table to dump
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index 363155bc55..27960c63e9 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -361,39 +361,6 @@ class AppGeneratorTest < Rails::Generators::TestCase
assert_file "config/application.rb", /config\.active_record\.dependent_restrict_raises = false/
end
- def test_http_generates_config_middleware_and_generator_http_setup
- run_generator [destination_root, "--http"]
- assert_file "config/application.rb", /config\.middleware\.http_only!/,
- /config\.generators\.http_only!/
- end
-
- def test_http_generates_application_controller_with_action_controller_http
- run_generator [destination_root, "--http"]
- assert_file "app/controllers/application_controller.rb",
- /class ApplicationController < ActionController::HTTP/
- end
-
- def test_http_generates_application_controller_with_protect_from_forgery_commented_out_setup
- run_generator [destination_root, "--http"]
- assert_file "app/controllers/application_controller.rb", /^ # protect_from_forgery/
- end
-
- def test_http_does_not_generate_app_views_dir
- run_generator [destination_root, "--http"]
- assert_no_directory "app/views"
- end
-
- def test_http_skip_sprockets_entries_in_gemfile_and_application
- run_generator [destination_root, "--http"]
- assert_file "Gemfile" do |content|
- assert_no_match(/group :assets/, content)
- end
- assert_file "config/application.rb" do |content|
- assert_match(/^# require "sprockets/, content)
- assert_no_match(/config\.assets/, content)
- end
- end
-
def test_pretend_option
output = run_generator [File.join(destination_root, "myapp"), "--pretend"]
assert_no_match(/run bundle install/, output)
diff --git a/railties/test/generators/resource_generator_test.rb b/railties/test/generators/resource_generator_test.rb
index 4ba3ad8c41..73804dae45 100644
--- a/railties/test/generators/resource_generator_test.rb
+++ b/railties/test/generators/resource_generator_test.rb
@@ -86,10 +86,4 @@ class ResourceGeneratorTest < Rails::Generators::TestCase
assert_no_match(/resources :accounts$/, route)
end
end
-
- def test_http_only_does_not_generate_edit_route
- run_generator ["Account", "--http"]
-
- assert_file "config/routes.rb", /resources :accounts, except: :edit$/
- end
end
diff --git a/railties/test/generators/scaffold_controller_generator_test.rb b/railties/test/generators/scaffold_controller_generator_test.rb
index ed54ce43da..1eea50b0d9 100644
--- a/railties/test/generators/scaffold_controller_generator_test.rb
+++ b/railties/test/generators/scaffold_controller_generator_test.rb
@@ -142,41 +142,4 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase
assert_match(/\{ render action: "new" \}/, content)
end
end
-
- def test_http_only_generates_controller_without_respond_to_block_and_html_format
- run_generator ["User", "--http"]
-
- assert_file "app/controllers/users_controller.rb" do |content|
- assert_match(/render json: @user/, content)
- assert_no_match(/respond_to/, content)
- assert_no_match(/format\.html/, content)
- end
- end
-
- def test_http_only_generates_functional_tests_with_json_format_and_http_status_assertions
- run_generator ["User", "--http"]
-
- assert_file "test/functional/users_controller_test.rb" do |content|
- assert_match(/class UsersControllerTest < ActionController::TestCase/, content)
- assert_match(/@request\.accept = "application\/json"/, content)
- assert_match(/test "should get index"/, content)
-
- assert_match(/assert_response 201/, content)
- assert_no_match(/assert_redirected_to/, content)
- end
- end
-
- def test_http_only_does_not_generate_edit_action
- run_generator ["User", "--http"]
-
- assert_file "app/controllers/users_controller.rb" do |content|
- assert_match(/def index/, content)
- assert_no_match(/def edit/, content)
- end
-
- assert_file "test/functional/users_controller_test.rb" do |content|
- assert_match(/test "should get index"/, content)
- assert_no_match(/test "should get edit"/, content)
- end
- end
end
diff --git a/railties/test/generators_test.rb b/railties/test/generators_test.rb
index 9e7ec86fdf..60e7e57a91 100644
--- a/railties/test/generators_test.rb
+++ b/railties/test/generators_test.rb
@@ -213,55 +213,4 @@ class GeneratorsTest < Rails::Generators::TestCase
Rails::Generators.hide_namespace("special:namespace")
assert Rails::Generators.hidden_namespaces.include?("special:namespace")
end
-
- def test_http_only_hides_generators
- generators = %w(assets js css session_migration)
-
- generators.each do |generator|
- assert !Rails::Generators.hidden_namespaces.include?(generator)
- end
-
- with_http_only! do
- generators.each do |generator|
- assert Rails::Generators.hidden_namespaces.include?(generator),
- "http only should hide #{generator} generator"
- end
- end
- end
-
- def test_http_only_enables_http_option
- options = Rails::Generators.options[:rails]
-
- assert !options[:http], "http option should be disabled by default"
-
- with_http_only! do
- assert options[:http], "http only should enable generator http option"
- end
- end
-
- def test_http_only_disables_template_and_helper_and_assets_options
- options = Rails::Generators.options[:rails]
- disable_options = [:assets, :helper, :javascripts, :javascript_engine,
- :stylesheets, :stylesheet_engine, :template_engine]
-
- disable_options.each do |disable_option|
- assert options[disable_option], "without http only should have generator option #{disable_option} enabled"
- end
-
- with_http_only! do
- disable_options.each do |disable_option|
- assert !options[disable_option], "http only should have generator option #{disable_option} disabled"
- end
- end
- end
-
- private
-
- def with_http_only!
- Rails::Generators.http_only!
- yield
- ensure
- Rails::Generators.instance_variable_set(:@hidden_namespaces, nil)
- Rails::Generators.instance_variable_set(:@options, nil)
- end
end