Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Extract common setup for loading tasks in rake notes tests

  • Loading branch information...
commit dcf7a166f231e58079fdd35a8dee814e1401f3d3 1 parent 0e0fc50
@carlosantoniodasilva carlosantoniodasilva authored
Showing with 14 additions and 29 deletions.
  1. +14 −29 railties/test/application/rake/notes_test.rb
View
43 railties/test/application/rake/notes_test.rb
@@ -29,11 +29,7 @@ def teardown
app_file "app/views/home/index.ruby", "# TODO: note in ruby"
boot_rails
- require 'rake'
- require 'rdoc/task'
- require 'rake/testtask'
-
- Rails.application.load_tasks
+ load_tasks
Dir.chdir(app_path) do
output = `bundle exec rake notes`
@@ -67,12 +63,7 @@ def teardown
app_file "some_other_dir/blah.rb", "# TODO: note in some_other directory"
boot_rails
-
- require 'rake'
- require 'rdoc/task'
- require 'rake/testtask'
-
- Rails.application.load_tasks
+ load_tasks
Dir.chdir(app_path) do
output = `bundle exec rake notes`
@@ -103,12 +94,7 @@ def teardown
app_file "some_other_dir/blah.rb", "# TODO: note in some_other directory"
boot_rails
-
- require 'rake'
- require 'rdoc/task'
- require 'rake/testtask'
-
- Rails.application.load_tasks
+ load_tasks
Dir.chdir(app_path) do
output = `SOURCE_ANNOTATION_DIRECTORIES='some_other_dir' bundle exec rake notes`
@@ -145,12 +131,7 @@ def teardown
EOS
boot_rails
-
- require 'rake'
- require 'rdoc/task'
- require 'rake/testtask'
-
- Rails.application.load_tasks
+ load_tasks
Dir.chdir(app_path) do
output = `bundle exec rake notes_custom`
@@ -175,12 +156,7 @@ def teardown
app_file "app/assets/stylesheets/application.css.sass", "// TODO: note in sass"
boot_rails
-
- require 'rake'
- require 'rdoc/task'
- require 'rake/testtask'
-
- Rails.application.load_tasks
+ load_tasks
Dir.chdir(app_path) do
output = `bundle exec rake notes`
@@ -192,6 +168,15 @@ def teardown
end
private
+
+ def load_tasks
+ require 'rake'
+ require 'rdoc/task'
+ require 'rake/testtask'
+
+ Rails.application.load_tasks
+ end
+
def boot_rails
super
require "#{app_path}/config/environment"
Please sign in to comment.
Something went wrong with that request. Please try again.