aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2017-07-02 13:50:25 -0700
committerGitHub <noreply@github.com>2017-07-02 13:50:25 -0700
commit92c29d82eb2f323bb1338a039229a66057a7d137 (patch)
tree050eea5a719faa416b64b804617f8755b6500e09 /railties
parentf851e1f705f26d8f92f0fc1b265b20bc389d23cb (diff)
parentf443460670576cd82a806a851b7124479e8325c9 (diff)
downloadrails-92c29d82eb2f323bb1338a039229a66057a7d137.tar.gz
rails-92c29d82eb2f323bb1338a039229a66057a7d137.tar.bz2
rails-92c29d82eb2f323bb1338a039229a66057a7d137.zip
Merge branch 'master' into require_relative_2017
Diffstat (limited to 'railties')
-rw-r--r--railties/CHANGELOG.md4
-rw-r--r--railties/lib/rails/tasks/tmp.rake11
-rw-r--r--railties/railties.gemspec5
-rw-r--r--railties/test/application/configuration_test.rb3
-rw-r--r--railties/test/application/rake/tmp_test.rb43
-rw-r--r--railties/test/application/rake_test.rb7
6 files changed, 61 insertions, 12 deletions
diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md
index b9a530258d..7d94336207 100644
--- a/railties/CHANGELOG.md
+++ b/railties/CHANGELOG.md
@@ -1,3 +1,7 @@
+* Clear screenshot files in `tmp:clear` task.
+
+ *Yuji Yaginuma*
+
* Add `railtie.rb` to the plugin generator
*Tsukuru Tanimichi*
diff --git a/railties/lib/rails/tasks/tmp.rake b/railties/lib/rails/tasks/tmp.rake
index d42a890cb6..3d8ced1bf3 100644
--- a/railties/lib/rails/tasks/tmp.rake
+++ b/railties/lib/rails/tasks/tmp.rake
@@ -1,6 +1,6 @@
namespace :tmp do
- desc "Clear cache and socket files from tmp/ (narrow w/ tmp:cache:clear, tmp:sockets:clear)"
- task clear: ["tmp:cache:clear", "tmp:sockets:clear"]
+ desc "Clear cache, socket and screenshot files from tmp/ (narrow w/ tmp:cache:clear, tmp:sockets:clear, tmp:screenshots:clear)"
+ task clear: ["tmp:cache:clear", "tmp:sockets:clear", "tmp:screenshots:clear"]
tmp_dirs = [ "tmp/cache",
"tmp/sockets",
@@ -32,4 +32,11 @@ namespace :tmp do
rm Dir["tmp/pids/[^.]*"], verbose: false
end
end
+
+ namespace :screenshots do
+ # desc "Clears all files in tmp/screenshots"
+ task :clear do
+ rm Dir["tmp/screenshots/[^.]*"], verbose: false
+ end
+ end
end
diff --git a/railties/railties.gemspec b/railties/railties.gemspec
index 2df303750c..e5587b531a 100644
--- a/railties/railties.gemspec
+++ b/railties/railties.gemspec
@@ -23,6 +23,11 @@ Gem::Specification.new do |s|
s.rdoc_options << "--exclude" << "."
+ s.metadata = {
+ "source_code_uri" => "https://github.com/rails/rails/tree/v#{version}/railties",
+ "changelog_uri" => "https://github.com/rails/rails/blob/v#{version}/railties/CHANGELOG.md"
+ }
+
s.add_dependency "activesupport", version
s.add_dependency "actionpack", version
diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb
index 06767167a9..95a2cc2d31 100644
--- a/railties/test/application/configuration_test.rb
+++ b/railties/test/application/configuration_test.rb
@@ -176,13 +176,11 @@ module ApplicationTests
test "Rails.application responds to all instance methods" do
app "development"
- assert_respond_to Rails.application, :routes_reloader
assert_equal Rails.application.routes_reloader, AppTemplate::Application.routes_reloader
end
test "Rails::Application responds to paths" do
app "development"
- assert_respond_to AppTemplate::Application, :paths
assert_equal ["#{app_path}/app/views"], AppTemplate::Application.paths["app/views"].expanded
end
@@ -1220,7 +1218,6 @@ module ApplicationTests
test "Rails.application#env_config exists and include some existing parameters" do
make_basic_app
- assert_respond_to app, :env_config
assert_equal app.env_config["action_dispatch.parameter_filter"], app.config.filter_parameters
assert_equal app.env_config["action_dispatch.show_exceptions"], app.config.action_dispatch.show_exceptions
assert_equal app.env_config["action_dispatch.logger"], Rails.logger
diff --git a/railties/test/application/rake/tmp_test.rb b/railties/test/application/rake/tmp_test.rb
new file mode 100644
index 0000000000..8423a98f84
--- /dev/null
+++ b/railties/test/application/rake/tmp_test.rb
@@ -0,0 +1,43 @@
+require "isolation/abstract_unit"
+
+module ApplicationTests
+ module RakeTests
+ class TmpTest < ActiveSupport::TestCase
+ include ActiveSupport::Testing::Isolation
+
+ def setup
+ build_app
+ end
+
+ def teardown
+ teardown_app
+ end
+
+ test "tmp:clear clear cache, socket and screenshot files" do
+ Dir.chdir(app_path) do
+ FileUtils.mkdir_p("tmp/cache")
+ FileUtils.touch("tmp/cache/cache_file")
+
+ FileUtils.mkdir_p("tmp/sockets")
+ FileUtils.touch("tmp/sockets/socket_file")
+
+ FileUtils.mkdir_p("tmp/screenshots")
+ FileUtils.touch("tmp/screenshots/fail.png")
+
+ `rails tmp:clear`
+
+ assert_not File.exist?("tmp/cache/cache_file")
+ assert_not File.exist?("tmp/sockets/socket_file")
+ assert_not File.exist?("tmp/screenshots/fail.png")
+ end
+ end
+
+ test "tmp:clear should work if folder missing" do
+ FileUtils.remove_dir("#{app_path}/tmp")
+ errormsg = Dir.chdir(app_path) { `bin/rails tmp:clear` }
+ assert_predicate $?, :success?
+ assert_empty errormsg
+ end
+ end
+ end
+end
diff --git a/railties/test/application/rake_test.rb b/railties/test/application/rake_test.rb
index 1b64a0a1ca..5ae6ea925f 100644
--- a/railties/test/application/rake_test.rb
+++ b/railties/test/application/rake_test.rb
@@ -391,12 +391,5 @@ module ApplicationTests
assert_match(/Hello, World!/, output)
end
-
- def test_tmp_clear_should_work_if_folder_missing
- FileUtils.remove_dir("#{app_path}/tmp")
- errormsg = Dir.chdir(app_path) { `bin/rails tmp:clear` }
- assert_predicate $?, :success?
- assert_empty errormsg
- end
end
end