Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit a1518a3

Browse files
committed
Merge pull request #1493 from postmodern/code_smell
Code smell
2 parents 7f3ace2 + 32258ca commit a1518a3

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

lib/rspec/core/rake_task.rb

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,15 @@ class RakeTask < ::Rake::TaskLib
6060
attr_accessor :rspec_opts
6161

6262
def initialize(*args, &task_block)
63-
setup_ivars(args)
64-
65-
desc "Run RSpec code examples" unless ::Rake.application.last_comment
63+
@name = args.shift || :spec
64+
@ruby_opts = nil
65+
@rspec_opts = nil
66+
@verbose = true
67+
@fail_on_error = true
68+
@rspec_path = 'rspec'
69+
@pattern = './spec{,/*/**}/*_spec.rb'
6670

67-
task name, *args do |_, task_args|
68-
RakeFileUtils.__send__(:verbose, verbose) do
69-
task_block.call(*[self, task_args].slice(0, task_block.arity)) if task_block
70-
run_task verbose
71-
end
72-
end
71+
define(args, &task_block)
7372
end
7473

7574
# @private
@@ -91,14 +90,15 @@ def run_task(verbose)
9190
private
9291

9392
# @private
94-
def setup_ivars(args)
95-
@name = args.shift || :spec
96-
@ruby_opts = nil
97-
@rspec_opts = nil
98-
@verbose = true
99-
@fail_on_error = true
100-
@rspec_path = 'rspec'
101-
@pattern = './spec{,/*/**}/*_spec.rb'
93+
def define(args, &task_block)
94+
desc "Run RSpec code examples" unless ::Rake.application.last_comment
95+
96+
task name, *args do |_, task_args|
97+
RakeFileUtils.__send__(:verbose, verbose) do
98+
task_block.call(*[self, task_args].slice(0, task_block.arity)) if task_block
99+
run_task verbose
100+
end
101+
end
102102
end
103103

104104
def files_to_run

0 commit comments

Comments
 (0)