Skip to content

Commit 0b33193

Browse files
committed
Pass options to the test runner for test:{all,system,generators}
1 parent 8a91f72 commit 0b33193

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

railties/lib/rails/commands/test/test_command.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,24 +37,24 @@ def perform(*)
3737

3838
Rails::TestUnit::Runner::TEST_FOLDERS.each do |name|
3939
define_method(name) do |*|
40-
self.args.prepend("test/#{name}")
40+
args.prepend("test/#{name}")
4141
perform
4242
end
4343
end
4444

4545
desc "test:all", "Runs all tests, including system tests", hide: true
46-
def all
47-
self.args = ["test/**/*_test.rb"]
46+
def all(*)
47+
args.prepend("test/**/*_test.rb")
4848
perform
4949
end
5050

51-
def system
52-
self.args = ["test/system"]
51+
def system(*)
52+
args.prepend("test/system")
5353
perform
5454
end
5555

56-
def generators
57-
self.args = ["test/lib/generators"]
56+
def generators(*)
57+
args.prepend("test/lib/generators")
5858
perform
5959
end
6060
end

railties/test/application/test_runner_test.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,21 @@ def test_run_units
9898
end
9999
end
100100

101+
def test_run_all_takes_options
102+
create_test_file :system, "foo"
103+
assert_match "FooTest", rails("test:all", "--verbose")
104+
end
105+
106+
def test_run_system_takes_options
107+
create_test_file :system, "foo"
108+
assert_match "FooTest", rails("test:system", "--verbose")
109+
end
110+
111+
def test_run_generators_takes_options
112+
create_test_file "lib/generators", "foo"
113+
assert_match "FooTest", rails("test:generators", "--verbose")
114+
end
115+
101116
def test_run_channels
102117
create_test_file :channels, "foo_channel"
103118
create_test_file :channels, "bar_channel"

0 commit comments

Comments
 (0)