Skip to content

Instantly share code, notes, and snippets.

@rsutphin
Created October 17, 2011 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rsutphin/1292714 to your computer and use it in GitHub Desktop.
Save rsutphin/1292714 to your computer and use it in GitHub Desktop.
RSpec 2.7.0: rcov task does not work
module Foo
def self.number
8
end
end
require 'rspec'
require File.expand_path('../foo', __FILE__)
describe Foo do
describe '.number' do
it 'is 9' do
Foo.number.should == 9
end
end
end
source :rubygems
gem 'rake'
gem 'rspec', '~> 2.7.0'
gem 'rcov'
$ bundle show
Gems included by the bundle:
* bundler (1.1.rc)
* diff-lcs (1.1.3)
* rake (0.9.2)
* rcov (0.9.11)
* rspec (2.7.0)
* rspec-core (2.7.0)
* rspec-expectations (2.7.0)
* rspec-mocks (2.7.0)
$ bundle exec rake spec
/Users/rsutphin/.rvm/rubies/ruby-1.8.7-p352/bin/ruby -S rspec foo_spec.rb
F
Failures:
1) Foo.number is 9
Failure/Error: Foo.number.should == 9
expected: 9
got: 8 (using ==)
# ./foo_spec.rb:8
Finished in 0.07978 seconds
1 example, 1 failure
Failed examples:
rspec ./foo_spec.rb:7 # Foo.number is 9
rake aborted!
ruby /Users/rsutphin/.rvm/rubies/ruby-1.8.7-p352/bin/ruby -S rspec foo_spec.rb failed
Tasks: TOP => spec
(See full trace by running task with --trace)
$ bundle exec rake spec:rcov
/Users/rsutphin/.rvm/rubies/ruby-1.8.7-p352/bin/ruby -S rcov -Ispec:lib foo_spec.rb
require 'rspec/core/rake_task'
desc "Run all specs"
RSpec::Core::RakeTask.new('spec') do |t|
t.pattern = 'foo_spec.rb'
t.verbose = true
end
desc "Run all specs with rcov"
RSpec::Core::RakeTask.new('spec:rcov') do |t|
t.pattern = 'foo_spec.rb'
t.verbose = true
t.rcov = true
end
@rsutphin
Copy link
Author

To run this example:

  • Clone it
  • Run bundle update
  • Run rake spec. One spec should fail.
  • Run rake spec:rcov. No specs are executed, which you can tell because the spec doesn't fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment