aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/test_info_test.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-04-05 16:31:19 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2013-04-05 16:31:19 -0700
commit7f698da8878b141c5324b2419d73570f507ef08f (patch)
tree44d042b4def5b691aeeea1367ba6d8e263feac30 /railties/test/test_info_test.rb
parent32eff659bc92895546e3d5f90ef76051f0e7b6cd (diff)
downloadrails-7f698da8878b141c5324b2419d73570f507ef08f.tar.gz
rails-7f698da8878b141c5324b2419d73570f507ef08f.tar.bz2
rails-7f698da8878b141c5324b2419d73570f507ef08f.zip
add a class for splitting up rake commands
Diffstat (limited to 'railties/test/test_info_test.rb')
-rw-r--r--railties/test/test_info_test.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/railties/test/test_info_test.rb b/railties/test/test_info_test.rb
new file mode 100644
index 0000000000..2f78dcff1b
--- /dev/null
+++ b/railties/test/test_info_test.rb
@@ -0,0 +1,35 @@
+require 'abstract_unit'
+require 'rails/test_unit/sub_test_task'
+
+module Rails
+ class TestInfoTest < ActiveSupport::TestCase
+ def test_test_files
+ info = new_test_info ['test']
+ assert_predicate info.files, :empty?
+ assert_nil info.opts
+ assert_equal ['test'], info.tasks
+ end
+
+ def test_with_file
+ info = new_test_info ['test', __FILE__]
+ assert_equal [__FILE__], info.files
+ assert_nil info.opts
+ assert_equal ['test'], info.tasks
+ end
+
+ def test_with_opts
+ info = new_test_info ['test', __FILE__, '/foo/']
+ assert_equal [__FILE__], info.files
+ assert_equal '-n /foo/', info.opts
+ assert_equal ['test'], info.tasks
+ end
+
+ def new_test_info(tasks)
+ Class.new(TestTask::TestInfo) {
+ def task_defined?(task)
+ task == "test"
+ end
+ }.new tasks
+ end
+ end
+end