Skip to content

Commit 062a93a

Browse files
committed
Refactoring the creation of TestTasks to remove code duplication.
1 parent ca2bc30 commit 062a93a

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

railties/lib/rails/test_unit/testing.rake

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -121,31 +121,17 @@ namespace :test do
121121

122122
Rails::TestTask.new(single: "test:prepare")
123123

124-
Rails::TestTask.new(models: "test:prepare") do |t|
125-
t.pattern = 'test/models/**/*_test.rb'
126-
end
127-
128-
Rails::TestTask.new(helpers: "test:prepare") do |t|
129-
t.pattern = 'test/helpers/**/*_test.rb'
124+
["models", "helpers", "controllers", "mailers", "integration"].each do |name|
125+
Rails::TestTask.new(name => "test:prepare") do |t|
126+
t.pattern = "test/#{name}/**/*_test.rb"
127+
end
130128
end
131129

132130
Rails::TestTask.new(units: "test:prepare") do |t|
133131
t.pattern = 'test/{models,helpers,unit}/**/*_test.rb'
134132
end
135133

136-
Rails::TestTask.new(controllers: "test:prepare") do |t|
137-
t.pattern = 'test/controllers/**/*_test.rb'
138-
end
139-
140-
Rails::TestTask.new(mailers: "test:prepare") do |t|
141-
t.pattern = 'test/mailers/**/*_test.rb'
142-
end
143-
144134
Rails::TestTask.new(functionals: "test:prepare") do |t|
145135
t.pattern = 'test/{controllers,mailers,functional}/**/*_test.rb'
146136
end
147-
148-
Rails::TestTask.new(integration: "test:prepare") do |t|
149-
t.pattern = 'test/integration/**/*_test.rb'
150-
end
151137
end

0 commit comments

Comments
 (0)