Why are my RSpec specs running twice?
Posted
by James A. Rosen
on Stack Overflow
See other posts from Stack Overflow
or by James A. Rosen
Published on 2010-06-12T22:21:14Z
Indexed on
2010/06/13
4:32 UTC
Read the original article
Hit count: 307
I have the following RSpec (1.3.0) task defined in my Rakefile
:
require 'spec/rake/spectask'
Spec::Rake::SpecTask.new(:spec) do |spec|
spec.libs << 'lib' << 'spec'
spec.spec_files = FileList['spec/**/*_spec.rb']
end
I have the following in spec/spec_helper.rb
:
require 'rubygems'
require 'spec'
require 'spec/autorun'
require 'rack/test'
require 'webmock/rspec'
include Rack::Test::Methods
include WebMock
require 'omniauth/core'
I have a single spec declared in spec/foo/foo_spec.rb
:
require File.dirname(__FILE__) + '/../spec_helper'
describe Foo do
describe '#bar' do
it 'be bar-like' do
Foo.new.bar.should == 'bar'
end
end
end
When I run rake spec
, the single example runs twice. I can check it by making the example fail, giving me two red "F"s.
One thing I thought was that adding spec
to the SpecTask
's libs
was causing them to be double-defined, but removing that doesn't seem to have any effect.
© Stack Overflow or respective owner