-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Zeus sometimes runs RSpec twice #180
Comments
I'm having the same issue... Specs run twice when trying to run an individual spec file, but only run once when passing in a directory to the test command. This is with with the 13.1 gem. |
Test frameworks do some really asinine hacks to autorun loaded test files. What version of rspec are you guys using? I'll try to figure this one out early next week. |
I'm using rspec 2.12.1. |
Thanks. I'll play with it on monday. |
I'm using both 2.11 and having the issue exactly the same, twice when running a single spec, but only once when running all the specs. |
Interestingly... I tested this on two projects, both using rspec 2.12.1 and both using zeus 0.13.1. In one project the specs run twice, and all fail the second time (it's like rspec's rails helpers aren't loaded during the second run). In the second project, everything works fine. I'm at a loss for what could be causing the issue. |
I have same problem too. zeus 0.13.1, rspec 2.12.0 |
It's running once for me when running against a directory, but twice when run against a single spec file. On zeus 0.13.1, rspec 2.12.2. |
Removing Including my require 'simplecov'
SimpleCov.start 'rails' do
add_filter '/test/'
add_filter '/config/'
add_filter '/vendor/'
add_filter '/spec/'
add_group 'Controllers', 'app/controllers'
add_group 'Models', 'app/models'
add_group 'Helpers', 'app/helpers'
add_group 'Decorators', 'app/decorators'
add_group 'Libraries', 'lib'
use_merging true
end
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
# require 'rspec/autorun'
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
RSpec.configure do |config|
config.fixture_path = "#{::Rails.root}/spec/fixtures"
config.use_transactional_fixtures = true
config.infer_base_class_for_anonymous_controllers = false
config.order = "random"
end |
I have to confirm this, but it only helps running the whole spec file. If I try to run a specific line, I will get an error |
In summary: Without (zeus master, rspec 2.12.0) fwiw, when rspec runs twice, the second time my specs are failing due to database leftovers. @burke any ideas on how to fix all this? |
Interestingly, in the one project I have where Zeus (0.13.1) works perfectly with rspec (runs directories / single file, single file with line number), I am including "rspec/autorun" in my spec_helper. In the project where I am experiencing problems with specs running twice, removing 'rspec/autorun' allows me to correctly run individual files and individual files with line numbers, but directories run no tests. |
@Soliah 's fix works for me. I removed |
+1 for @Soliah Mine worked as expected for both directories and files. Removing |
While removing the |
Removing |
Confirm that removing rspec/autorun solves the issue. |
+1 about removing |
As of 0.13.2, removing rspec/autorun solved this problem in all my projects! |
Is there any hope for getting this fixed? :( I'd love to help, but not really sure how. |
I believe it is fixed in Without rspec/autorun ( |
Btw, |
document the Spork wiki page to close #180
Removing |
[Zeus](https://github.com/burke/zeus) is a great gem that preloads your Rails app so you can run commands and tests quickly. However, it doesn't play well with the default "spec_helper.rb" that gets generated when you install Rspec. The solution is to remove "require 'rspec/autorun'" from "spec_helper.rb", which is what this commit does. This change does not affect those who do not have Zeus installed. Running "rspec" from the command line will continue to work. Reference and more info: burke/zeus#180 http://railscasts.com/episodes/412-fast-rails-commands http://robots.thoughtbot.com/post/40193452558/improving-rails-boot-time-with-zeus
I'm not sure if this is a duplicate of #175, but I'm experiencing the same behavior in some of my apps that use RSpec.
However it doesn't happen in all of them, so I'm not sure how to give exact steps to reproduce this.
The text was updated successfully, but these errors were encountered: