Class: RSpec::Core::RakeTask

### Home Classes Methods

### In Files

- lib/rspec/core/rake_task.rb

### Parent

Rake::TaskLib

### Methods

- ::new
- #gemfile=
- #run_task
- #setup_ivars
- #skip_bundler=
- #spec_opts=
- #warning=

### Included Modules

- ::Rake::DSL

### Class/Module Index

Quicksearch

- RSpec
- RSpec::Core
- RSpec::Core::BacktraceCleaner
- RSpec::Core::BacktraceFormatter
- RSpec::Core::CommandLine
- RSpec::Core::Configuration
- RSpec::Core::Configuration::MustBeConfiguredBeforeExampleGroupsError
- RSpec::Core::ConfigurationOptions
- RSpec::Core::ConstMissing
- RSpec::Core::DRbCommandLine
- RSpec::Core::DSL
- RSpec::Core::Deprecation
- RSpec::Core::DrbOptions
- RSpec::Core::Example
- RSpec::Core::Example::NotPendingExampleFixed
- RSpec::Core::Example::Procsy
- RSpec::Core::ExampleGroup
- RSpec::Core::Extensions
- RSpec::Core::Extensions::InstanceEvalWithArgs
- RSpec::Core::Extensions::ModuleEvalWithArgs
- RSpec::Core::Extensions::Ordered
- RSpec::Core::Extensions::Ordered::ExampleGroups
- RSpec::Core::Extensions::Ordered::Examples
- RSpec::Core::FilterManager
- RSpec::Core::FilterManager::BackwardCompatibility
- RSpec::Core::FilterManager::Describable
- RSpec::Core::Formatters
- RSpec::Core::Formatters::BaseFormatter
- RSpec::Core::Formatters::BaseTextFormatter
- RSpec::Core::Formatters::DeprecationFormatter
- RSpec::Core::Formatters::DocumentationFormatter
- RSpec::Core::Formatters::Helpers
- RSpec::Core::Formatters::HtmlFormatter
- RSpec::Core::Formatters::HtmlPrinter
- RSpec::Core::Formatters::JsonFormatter
- RSpec::Core::Formatters::ProgressFormatter
- RSpec::Core::Formatters::SnippetExtractor
- RSpec::Core::Formatters::SnippetExtractor::NullConverter
- RSpec::Core::Formatters::TextMateFormatter
- RSpec::Core::Hooks
- RSpec::Core::Hooks::AfterAllHook
- RSpec::Core::Hooks::AfterHook
- RSpec::Core::Hooks::AroundHook
- RSpec::Core::Hooks::AroundHookCollection
- RSpec::Core::Hooks::BeforeHook
- RSpec::Core::Hooks::GroupHookCollection
- RSpec::Core::Hooks::Hook
- RSpec::Core::Hooks::HookCollection
- RSpec::Core::Hooks::HookCollectionAliases
- RSpec::Core::Hooks::RegistersGlobals
- RSpec::Core::MemoizedHelpers
- RSpec::Core::MemoizedHelpers::BeforeAllMemoizedHash
- RSpec::Core::MemoizedHelpers::ClassMethods
- RSpec::Core::Metadata
- RSpec::Core::Metadata::ExampleMetadataHash
- RSpec::Core::Metadata::GroupMetadataHash
- RSpec::Core::Metadata::MetadataHash
- RSpec::Core::MetadataHashBuilder
- RSpec::Core::MetadataHashBuilder::Common
- RSpec::Core::MetadataHashBuilder::WithConfigWarning
- RSpec::Core::MetadataHashBuilder::WithDeprecationWarning
- RSpec::Core::MockFrameworkAdapter
- RSpec::Core::Parser
- RSpec::Core::Pending
- RSpec::Core::Pending::PendingDeclaredInExample
- RSpec::Core::Pending::PendingExampleFixedError
- RSpec::Core::ProjectInitializer
- RSpec::Core::RakeTask
- RSpec::Core::Reporter
- RSpec::Core::RubyProject
- RSpec::Core::Runner
- RSpec::Core::SharedContext
- RSpec::Core::SharedExampleGroup
- RSpec::Core::SharedExampleGroup::Collection
- RSpec::Core::SharedExampleGroup::Registry
- RSpec::Core::SharedExampleGroup::TopLevelDSL
- RSpec::Core::Time
- RSpec::Core::Version
- RSpec::Core::World
- RSpec::Rake
- RSpec::Runner
- Autotest
- Autotest::Rspec2
- Kernel

No matching classes.

# RSpec::Core::RakeTask

### Attributes

fail_on_error[RW]

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

default:

    true

failure_message[RW]

A message to print to stderr when there are failures.

name[RW]

Name of task.

default:

    :spec

pattern[RW]

Glob pattern to match files.

default:

    'spec/**/*_spec.rb'

rcov[RW]

Use rcov for code coverage?

Due to the many ways `rcov` can run, if this option is enabled, it is required that `require 'rspec/autorun'` appears in `spec_helper`.rb

default:

    false

rcov_opts[RW]

Command line options to pass to rcov.

default:

    nil

rcov_path[RW]

Path to rcov.

default:

    'rcov'

rspec_opts[RW]

Command line options to pass to rspec.

default:

    nil

rspec_path[RW]

Path to rspec

default:

    'rspec'

ruby_opts[RW]

Command line options to pass to ruby.

default:

    nil

verbose[RW]

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

default:

    true

### Public Class Methods

new(*args, &task_block) click to toggle source

    # File lib/rspec/core/rake_task.rb, line 115
    def initialize(*args, &task_block)
      setup_ivars(args)

      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

### Public Instance Methods

gemfile=(*) click to toggle source

@deprecated Has no effect. The rake task now checks ENV instead.

    # File lib/rspec/core/rake_task.rb, line 31
    def gemfile=(*)
      deprecate("RSpec::Core::RakeTask#gemfile=", :replacement => 'ENV["BUNDLE_GEMFILE"]')
    end

run_task(verbose) click to toggle source

    # File lib/rspec/core/rake_task.rb, line 139
    def run_task(verbose)
      command = spec_command

      begin
        puts command if verbose
        success = system(command)
      rescue
        puts failure_message if failure_message
      end
      abort("#{command} failed") if fail_on_error unless success
    end

setup_ivars(args) click to toggle source

    # File lib/rspec/core/rake_task.rb, line 128
    def setup_ivars(args)
      @name = args.shift || :spec
      @rcov_opts, @ruby_opts, @rspec_opts = nil, nil, nil
      @warning, @rcov = false, false
      @verbose, @fail_on_error = true, true

      @rcov_path  = 'rcov'
      @rspec_path = 'rspec'
      @pattern    = './spec{,/*/**}/*_spec.rb'
    end

skip_bundler=(*) click to toggle source

@deprecated Has no effect. The rake task now checks ENV instead.

    # File lib/rspec/core/rake_task.rb, line 25
    def skip_bundler=(*)
      deprecate("RSpec::Core::RakeTask#skip_bundler=")
    end

spec_opts=(opts) click to toggle source

@deprecated Use rspec_opts instead.

Command line options to pass to rspec.

default:

    nil

    # File lib/rspec/core/rake_task.rb, line 110
    def spec_opts=(opts)
      deprecate('RSpec::Core::RakeTask#spec_opts=', :replacement => 'rspec_opts=')
      @rspec_opts = opts
    end

warning=(true_or_false) click to toggle source

@deprecated Use ruby_opts="-w" instead.

When true, requests that the specs be run with the warning flag set. e.g. "ruby -w"

default:

    false

    # File lib/rspec/core/rake_task.rb, line 43
    def warning=(true_or_false)
      deprecate("RSpec::Core::RakeTask#warning=", :replacement => 'ruby_opts="-w"')
      @warning = true_or_false
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.