Class: RSpec::Core::RakeTask
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- RSpec::Core::RakeTask
- Includes:
- ShellEscape, Rake::DSL
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/rake_task.rb
Overview
RSpec rake task
Constant Summary collapse
- DEFAULT_RSPEC_PATH =
Default path to the RSpec executable.
File.('../../../../exe/rspec', __FILE__)
- DEFAULT_PATTERN =
Default pattern for spec files.
'spec/**{,/*/**}/*_spec.rb'
Constants included from ShellEscape
ShellEscape::SHELLS_ALLOWING_UNQUOTED_IDS
Constants included from Rake::FileUtilsExt
Constants included from FileUtils
FileUtils::LN_SUPPORTED, FileUtils::RUBY
Instance Attribute Summary collapse
-
#exclude_pattern ⇒ Object
Files matching this pattern will be excluded.
-
#fail_on_error ⇒ Object
Whether or not to fail Rake when an error occurs (typically when examples fail).
-
#failure_message ⇒ Object
A message to print to stderr when there are failures.
-
#name ⇒ Object
Name of task.
-
#pattern ⇒ Object
Files matching this pattern will be loaded.
-
#rspec_opts ⇒ Object
Command line options to pass to RSpec.
-
#rspec_path ⇒ Object
Path to RSpec.
-
#ruby_opts ⇒ Object
Command line options to pass to ruby.
-
#verbose ⇒ Object
Use verbose output.
-
#with_clean_environment ⇒ Object
Run RSpec with a clean (empty) environment.
Instance Method Summary collapse
-
#initialize(*args, &task_block) ⇒ RakeTask
constructor
A new instance of RakeTask.
- #run_task(verbose) ⇒ Object
Methods included from ShellEscape
conditionally_quote, quote, shell_allows_unquoted_ids?
Methods included from Rake::FileUtilsExt
#nowrite, #rake_check_options, #rake_output_message, #when_writing
Methods included from FileUtils
#ruby, #safe_ln, #sh, #split_all
Methods included from Rake::Cloneable
Constructor Details
#initialize(*args, &task_block) ⇒ RakeTask
Returns a new instance of RakeTask.
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/rake_task.rb', line 77 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 |
Instance Attribute Details
#exclude_pattern ⇒ Object
Files matching this pattern will be excluded. Defaults to ‘nil`.
39 40 41 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/rake_task.rb', line 39 def exclude_pattern @exclude_pattern end |
#fail_on_error ⇒ Object
Whether or not to fail Rake when an error occurs (typically when examples fail). Defaults to ‘true`.
43 44 45 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/rake_task.rb', line 43 def fail_on_error @fail_on_error end |
#failure_message ⇒ Object
A message to print to stderr when there are failures.
46 47 48 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/rake_task.rb', line 46 def @failure_message end |
#name ⇒ Object
Name of task. Defaults to ‘:spec`.
31 32 33 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/rake_task.rb', line 31 def name @name end |
#pattern ⇒ Object
Files matching this pattern will be loaded. Defaults to ‘’spec/**,/<strong>/*</strong>/*_spec.rb’‘.
35 36 37 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/rake_task.rb', line 35 def pattern @pattern end |
#rspec_opts ⇒ Object
Command line options to pass to RSpec. Defaults to ‘nil`.
75 76 77 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/rake_task.rb', line 75 def rspec_opts @rspec_opts end |
#rspec_path ⇒ Object
Path to RSpec. Defaults to the absolute path to the rspec binary from the loaded rspec-core gem.
72 73 74 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/rake_task.rb', line 72 def rspec_path @rspec_path end |
#ruby_opts ⇒ Object
Command line options to pass to ruby. Defaults to ‘nil`.
68 69 70 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/rake_task.rb', line 68 def ruby_opts @ruby_opts end |
#verbose ⇒ Object
Use verbose output. If this is set to true, the task will print the executed spec command to stdout. Defaults to ‘true`.
65 66 67 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/rake_task.rb', line 65 def verbose @verbose end |
#with_clean_environment ⇒ Object
Run RSpec with a clean (empty) environment.
55 56 57 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/rake_task.rb', line 55 def with_clean_environment false end |
Instance Method Details
#run_task(verbose) ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/rake_task.rb', line 90 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 if return unless fail_on_error $stderr.puts "#{command} failed" if verbose exit $?.exitstatus || 1 end |