Class: RSpec::Core::RakeTask

Inherits:
Rake::TaskLib
  • Object
show all
Includes:
Rake::DSL
Defined in:
lib/rspec/core/rake_task.rb

Overview

RSpec rake task

See Also:

Constant Summary

DEFAULT_RSPEC_PATH =

Default path to the RSpec executable.

File.expand_path('../../../../exe/rspec', __FILE__)
DEFAULT_PATTERN =

Default pattern for spec files.

'spec/**{,/*/**}/*_spec.rb'

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (RakeTask) initialize(*args, &task_block)

Returns a new instance of RakeTask

53
54
55
56
57
58
59
60
61
62
63
# File 'lib/rspec/core/rake_task.rb', line 53
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

- (void) exclude_pattern

Files matching this pattern will be excluded. Defaults to nil.

30
31
32
# File 'lib/rspec/core/rake_task.rb', line 30
def exclude_pattern
  @exclude_pattern
end

- (void) fail_on_error

Whether or not to fail Rake when an error occurs (typically when examples fail). Defaults to true.

34
35
36
# File 'lib/rspec/core/rake_task.rb', line 34
def fail_on_error
  @fail_on_error
end

- (void) failure_message

A message to print to stderr when there are failures.

37
38
39
# File 'lib/rspec/core/rake_task.rb', line 37
def failure_message
  @failure_message
end

- (void) name

Name of task. Defaults to :spec.

22
23
24
# File 'lib/rspec/core/rake_task.rb', line 22
def name
  @name
end

- (void) pattern

Files matching this pattern will be loaded. Defaults to 'spec/**{,/*/**}/*_spec.rb'.

26
27
28
# File 'lib/rspec/core/rake_task.rb', line 26
def pattern
  @pattern
end

- (void) rspec_opts

Command line options to pass to RSpec. Defaults to nil.

51
52
53
# File 'lib/rspec/core/rake_task.rb', line 51
def rspec_opts
  @rspec_opts
end

- (void) rspec_path

Path to RSpec. Defaults to the absolute path to the rspec binary from the loaded rspec-core gem.

48
49
50
# File 'lib/rspec/core/rake_task.rb', line 48
def rspec_path
  @rspec_path
end

- (void) ruby_opts

Command line options to pass to ruby. Defaults to nil.

44
45
46
# File 'lib/rspec/core/rake_task.rb', line 44
def ruby_opts
  @ruby_opts
end

- (void) verbose

Use verbose output. If this is set to true, the task will print the executed spec command to stdout. Defaults to true.

41
42
43
# File 'lib/rspec/core/rake_task.rb', line 41
def verbose
  @verbose
end