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

Code smell #1493

Merged
merged 2 commits into from
Apr 18, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions lib/rspec/core/rake_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,15 @@ class RakeTask < ::Rake::TaskLib
attr_accessor :rspec_opts

def initialize(*args, &task_block)
setup_ivars(args)

desc "Run RSpec code examples" unless ::Rake.application.last_comment
@name = args.shift || :spec
@ruby_opts = nil
@rspec_opts = nil
@verbose = true
@fail_on_error = true
@rspec_path = 'rspec'
@pattern = './spec{,/*/**}/*_spec.rb'

task name, *args do |_, task_args|
RakeFileUtils.__send__(:verbose, verbose) do
task_block.call(*[self, task_args].slice(0, task_block.arity)) if task_block
run_task verbose
end
end
define(args, &task_block)
end

# @private
Expand All @@ -91,14 +90,15 @@ def run_task(verbose)
private

# @private
def setup_ivars(args)
@name = args.shift || :spec
@ruby_opts = nil
@rspec_opts = nil
@verbose = true
@fail_on_error = true
@rspec_path = 'rspec'
@pattern = './spec{,/*/**}/*_spec.rb'
def define(args, &task_block)
desc "Run RSpec code examples" unless ::Rake.application.last_comment

task name, *args do |_, task_args|
RakeFileUtils.__send__(:verbose, verbose) do
task_block.call(*[self, task_args].slice(0, task_block.arity)) if task_block
run_task verbose
end
end
end

def files_to_run
Expand Down