aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/generators/app_base.rb2
-rw-r--r--railties/lib/rails/generators/rails/app/templates/Gemfile4
-rw-r--r--railties/lib/rails/generators/test_unit/job/templates/unit_test.rb.erb3
-rw-r--r--railties/test/abstract_unit.rb4
-rw-r--r--railties/test/application/default_stack_test.rb41
-rw-r--r--railties/test/application/rake/dbs_test.rb26
6 files changed, 76 insertions, 4 deletions
diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb
index b3a67266f7..841d39dad6 100644
--- a/railties/lib/rails/generators/app_base.rb
+++ b/railties/lib/rails/generators/app_base.rb
@@ -281,7 +281,7 @@ module Rails
[]
else
gems = [coffee_gemfile_entry, javascript_runtime_gemfile_entry]
- gems << GemfileEntry.version("#{options[:javascript]}-rails", nil,
+ gems << GemfileEntry.github("#{options[:javascript]}-rails", "rails/#{options[:javascript]}-rails",
"Use #{options[:javascript]} as the JavaScript library")
gems << GemfileEntry.version("turbolinks", nil,
diff --git a/railties/lib/rails/generators/rails/app/templates/Gemfile b/railties/lib/rails/generators/rails/app/templates/Gemfile
index 72143301a6..7b1a6aa854 100644
--- a/railties/lib/rails/generators/rails/app/templates/Gemfile
+++ b/railties/lib/rails/generators/rails/app/templates/Gemfile
@@ -33,8 +33,8 @@ group :development, :test do
gem 'byebug'
<%- end -%>
- # Access an IRB console on exceptions page and /console in development
- gem 'web-console', '~> 2.0.0.beta2'
+ # Access an IRB console on exception pages or by using <%%= console %> in views
+ gem 'web-console', github: 'rails/web-console', branch: 'master'
<%- if spring_install? %>
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
diff --git a/railties/lib/rails/generators/test_unit/job/templates/unit_test.rb.erb b/railties/lib/rails/generators/test_unit/job/templates/unit_test.rb.erb
index 6200218313..feb250e89a 100644
--- a/railties/lib/rails/generators/test_unit/job/templates/unit_test.rb.erb
+++ b/railties/lib/rails/generators/test_unit/job/templates/unit_test.rb.erb
@@ -1,7 +1,8 @@
require 'test_helper'
<% module_namespacing do -%>
-class <%= class_name %>JobTest < ActiveSupport::TestCase
+class <%= class_name %>JobTest < ActiveJob::TestCase
+
# test "the truth" do
# assert true
# end
diff --git a/railties/test/abstract_unit.rb b/railties/test/abstract_unit.rb
index b6533a5fb2..d8800eaa0f 100644
--- a/railties/test/abstract_unit.rb
+++ b/railties/test/abstract_unit.rb
@@ -28,6 +28,10 @@ def jruby_skip(message = '')
end
class ActiveSupport::TestCase
+ # FIXME: we have tests that depend on run order, we should fix that and
+ # remove this method call.
+ self.my_tests_are_order_dependent!
+
private
unless defined?(:capture)
diff --git a/railties/test/application/default_stack_test.rb b/railties/test/application/default_stack_test.rb
new file mode 100644
index 0000000000..4778cdd74c
--- /dev/null
+++ b/railties/test/application/default_stack_test.rb
@@ -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
diff --git a/railties/test/application/rake/dbs_test.rb b/railties/test/application/rake/dbs_test.rb
index 15414db00f..c727e0e46d 100644
--- a/railties/test/application/rake/dbs_test.rb
+++ b/railties/test/application/rake/dbs_test.rb
@@ -173,6 +173,32 @@ module ApplicationTests
"your test schema automatically, see the release notes for details.\n", output
end
end
+
+ test 'db:setup loads schema and seeds database' do
+ begin
+ @old_env = ENV["RAILS_ENV"]
+ ENV.delete "RAILS_ENV"
+
+ app_file 'db/schema.rb', <<-RUBY
+ ActiveRecord::Schema.define(version: "1") do
+ create_table :users do |t|
+ t.string :name
+ end
+ end
+ RUBY
+
+ app_file 'db/seeds.rb', <<-RUBY
+ puts ActiveRecord::Base.connection_config[:database]
+ RUBY
+
+ Dir.chdir(app_path) do
+ database_path = `bundle exec rake db:setup`
+ assert_equal "development.sqlite3", File.basename(database_path.strip)
+ end
+ ensure
+ ENV["RAILS_ENV"] = @old_env
+ end
+ end
end
end
end