Parent

Included Modules

Class Index [+]

Quicksearch

RSpec::Core::RakeTask

Attributes

name[RW]

Name of task.

default:

  :spec
pattern[RW]

Glob pattern to match files.

default:

  'spec/**/*_spec.rb'
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.

verbose[RW]

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

default:

  true
rcov[RW]

Use rcov for code coverage?

default:

  false
rcov_path[RW]

Path to rcov.

default:

  'rcov'
rcov_opts[RW]

Command line options to pass to rcov.

default:

  nil
ruby_opts[RW]

Command line options to pass to ruby.

default:

  nil
rspec_path[RW]

Path to rspec

default:

  'rspec'
rspec_opts[RW]

Command line options to pass to rspec.

default:

  nil

Public Class Methods

new(*args) click to toggle source
     # File lib/rspec/core/rake_task.rb, line 112
112:       def initialize(*args)
113:         @name = args.shift || :spec
114:         @pattern, @rcov_path, @rcov_opts, @ruby_opts, @rspec_opts = nil, nil, nil, nil, nil
115:         @warning, @rcov = false, false
116:         @verbose, @fail_on_error = true, true
117: 
118:         yield self if block_given?
119: 
120:         @rcov_path  ||= 'rcov'
121:         @rspec_path ||= 'rspec'
122:         @pattern    ||= './spec{,/*/**}/*_spec.rb'
123: 
124:         desc("Run RSpec code examples") unless ::Rake.application.last_comment
125: 
126:         task name do
127:           RakeFileUtils.send(:verbose, verbose) do
128:             if files_to_run.empty?
129:               puts "No examples matching #{pattern} could be found"
130:             else
131:               begin
132:                 puts spec_command if verbose
133:                 success = system(spec_command)
134:               rescue
135:                 puts failure_message if failure_message
136:               end
137:               raise("#{spec_command} failed") if fail_on_error unless success
138:             end
139:           end
140:         end
141:       end

Public Instance Methods

gemfile=(*) click to toggle source

@deprecated Has no effect. The rake task now checks ENV[‘BUNDLE_GEMFILE’] instead.

    # File lib/rspec/core/rake_task.rb, line 31
31:       def gemfile=(*)
32:         RSpec.deprecate("RSpec::Core::RakeTask#gemfile=", 'ENV["BUNDLE_GEMFILE"]')
33:       end
skip_bundler=(*) click to toggle source

@deprecated Has no effect. The rake task now checks ENV[‘BUNDLE_GEMFILE’] instead.

    # File lib/rspec/core/rake_task.rb, line 25
25:       def skip_bundler=(*)
26:         RSpec.deprecate("RSpec::Core::RakeTask#skip_bundler=")
27:       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 107
107:       def spec_opts=(opts)
108:         RSpec.deprecate('RSpec::Core::RakeTask#spec_opts=', 'rspec_opts=')
109:         @rspec_opts = opts
110:       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
43:       def warning=(true_or_false)
44:         RSpec.deprecate("RSpec::Core::RakeTask#warning=", 'ruby_opts="-w"')
45:         @warning = true_or_false
46:       end

Private Instance Methods

blank() click to toggle source
     # File lib/rspec/core/rake_task.rb, line 174
174:       def blank
175:         lambda {|s| s.nil? || s == ""}
176:       end
files_to_run() click to toggle source
     # File lib/rspec/core/rake_task.rb, line 145
145:       def files_to_run
146:         if ENV['SPEC']
147:           FileList[ ENV['SPEC'] ]
148:         else
149:           FileList[ pattern ].map { |f| f.gsub(/"/, '\"').gsub(/'/, "\\\\'") }
150:         end
151:       end
runner() click to toggle source
     # File lib/rspec/core/rake_task.rb, line 170
170:       def runner
171:         rcov ? rcov_path : rspec_path
172:       end
spec_command() click to toggle source
     # File lib/rspec/core/rake_task.rb, line 153
153:       def spec_command
154:         @spec_command ||= begin
155:                             cmd_parts = []
156:                             cmd_parts << RUBY
157:                             cmd_parts << ruby_opts
158:                             cmd_parts << "-w" if @warning
159:                             cmd_parts << "-S" << runner
160:                             cmd_parts << "-Ispec:lib" << rcov_opts if rcov
161:                             cmd_parts << files_to_run
162:                             cmd_parts << "--" if rcov && rspec_opts
163:                             cmd_parts << rspec_opts
164:                             cmd_parts.flatten.reject(&blank).join(" ")
165:                           end
166:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.