class RSpec::Core::RakeTask
RSpec
rake task
@see Rakefile
Constants
- DEFAULT_PATTERN
-
Default pattern for spec files.
- DEFAULT_RSPEC_PATH
-
Default path to the
RSpec
executable.
Attributes
Files matching this pattern will be excluded. Defaults to ‘nil`.
Whether or not to fail Rake when an error occurs (typically when examples fail). Defaults to ‘true`.
A message to print to stderr when there are failures.
Name of task. Defaults to ‘:spec`.
Files matching this pattern will be loaded. Defaults to ‘’spec/**{,//*}/*_spec.rb’‘.
Command line options to pass to RSpec
. Defaults to ‘nil`.
Path to RSpec
. Defaults to the absolute path to the rspec binary from the loaded rspec-core gem.
Command line options to pass to ruby. Defaults to ‘nil`.
Use verbose output. If this is set to true, the task will print the executed spec command to stdout. Defaults to ‘true`.
Public Class Methods
# File rspec-core/lib/rspec/core/rake_task.rb, line 79 def initialize(*args, &task_block) @name = args.shift || :spec @ruby_opts = nil @rspec_opts = nil @verbose = true @fail_on_error = true @rspec_path = DEFAULT_RSPEC_PATH @pattern = DEFAULT_PATTERN define(args, &task_block) end
Public Instance Methods
@private
# File rspec-core/lib/rspec/core/rake_task.rb, line 92 def run_task(verbose) command = spec_command puts command if verbose if with_clean_environment return if system({}, command, :unsetenv_others => true) else return if system(command) end puts failure_message if failure_message return unless fail_on_error $stderr.puts "#{command} failed" if verbose exit $?.exitstatus || 1 end
Run RSpec
with a clean (empty) environment is not supported
# File rspec-core/lib/rspec/core/rake_task.rb, line 56 def with_clean_environment false end
Run RSpec
with a clean (empty) environment is not supported :nocov:
# File rspec-core/lib/rspec/core/rake_task.rb, line 51 def with_clean_environment=(_value) raise ArgumentError, "Running in a clean environment is not supported on Ruby versions before 1.9.0" end