ActiveSupport::Dependencies and rspec 3

Does anybody have any idea why ActiveSupport:: dependencies would be loading my spec file when I upgraded from RSpec 2.99 to 3.0.beta? Here’s the stack trace of where it does this and down below is the stack trace from when I tried to recreate the problem with a brand new project. Since I was not able to reproduce the problem in a brand new project, I’m a bit stuck. Any advice on how to debug this is greatly appreciated. The only clue I have is that Dependencies is loading the spec file before the rspec file, per the stack traces.

Am I right to suspect that there’s something odd with Dependencies loading the spec file?

BROKEN with production project

/Users/justin/j/blink/bpos/spec/controllers/images_controller_spec.rb:12:in `block in <top (required)>': undefined local variable or method `render_views' for RSpec::ExampleGroups::ImagesController_2:Class (NameError)
	from /Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/gems/rspec-core-3.0.0.beta2/lib/rspec/core/example_group.rb:323:in `module_eval'
	from /Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/gems/rspec-core-3.0.0.beta2/lib/rspec/core/example_group.rb:323:in `subclass'
	from /Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/gems/rspec-core-3.0.0.beta2/lib/rspec/core/example_group.rb:287:in `example_group'
	from /Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/gems/rspec-core-3.0.0.beta2/lib/rspec/core/example_group.rb:169:in `block in alias_example_group_to'
	from /Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/gems/rspec-core-3.0.0.beta2/lib/rspec/core/dsl.rb:40:in `block in expose_example_group_alias'
	from /Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/gems/rspec-core-3.0.0.beta2/lib/rspec/core/dsl.rb:74:in `block (2 levels) in expose_example_group_alias_globally'
	from /Users/justin/j/blink/bpos/spec/controllers/images_controller_spec.rb:6:in `<top (required)>'
	from /Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:223:in `load'
	from /Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:223:in `block in load'
	from /Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:214:in `load_dependency'
	from /Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:223:in `load'
	from /Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/gems/rspec-core-3.0.0.beta2/lib/rspec/core/configuration.rb:932:in `block in load_spec_files'
	from /Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/gems/rspec-core-3.0.0.beta2/lib/rspec/core/configuration.rb:932:in `each'
	from /Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/gems/rspec-core-3.0.0.beta2/lib/rspec/core/configuration.rb:932:in `load_spec_files'
	from /Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/gems/rspec-core-3.0.0.beta2/lib/rspec/core/command_line.rb:21:in `run'
	from /Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/gems/rspec-core-3.0.0.beta2/lib/rspec/core/runner.rb:100:in `run'
	from /Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/gems/rspec-core-3.0.0.beta2/lib/rspec/core/runner.rb:31:in `invoke'
	from /Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/gems/rspec-core-3.0.0.beta2/exe/rspec:4:in `<top (required)>'
	from /Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/bin/rspec:23:in `load'
	from /Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/bin/rspec:23:in `<main>'
	from /Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/bin/ruby_executable_hooks:15:in `eval'
	from /Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/bin/ruby_executable_hooks:15:in `<main>'

Stack trace from where render_views is called on a the brand new project

/Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/gems/rspec-core-3.0.0.beta2/lib/rspec/core/example_group.rb:323:in `module_eval'
/Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/gems/rspec-core-3.0.0.beta2/lib/rspec/core/example_group.rb:323:in `subclass'
/Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/gems/rspec-core-3.0.0.beta2/lib/rspec/core/example_group.rb:287:in `example_group'
/Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/gems/rspec-core-3.0.0.beta2/lib/rspec/core/example_group.rb:169:in `block in alias_example_group_to'
/Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/gems/rspec-core-3.0.0.beta2/lib/rspec/core/dsl.rb:40:in `block in expose_example_group_alias'
/Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/gems/rspec-core-3.0.0.beta2/lib/rspec/core/dsl.rb:74:in `block (2 levels) in expose_example_group_alias_globally'
/Users/justin/j/blink/rspec_test/spec/controllers/users_controller_spec.rb:21:in `<top (required)>'
/Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/gems/rspec-core-3.0.0.beta2/lib/rspec/core/configuration.rb:934:in `load'
/Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/gems/rspec-core-3.0.0.beta2/lib/rspec/core/configuration.rb:934:in `block in load_spec_files'
/Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/gems/rspec-core-3.0.0.beta2/lib/rspec/core/configuration.rb:932:in `each'
/Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/gems/rspec-core-3.0.0.beta2/lib/rspec/core/configuration.rb:932:in `load_spec_files'
/Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/gems/rspec-core-3.0.0.beta2/lib/rspec/core/command_line.rb:21:in `run'
/Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/gems/rspec-core-3.0.0.beta2/lib/rspec/core/runner.rb:100:in `run'
/Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/gems/rspec-core-3.0.0.beta2/lib/rspec/core/runner.rb:31:in `invoke'
/Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/gems/rspec-core-3.0.0.beta2/exe/rspec:4:in `<top (required)>'
/Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/bin/rspec:23:in `load'
/Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/bin/rspec:23:in `<main>'
/Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/bin/ruby_executable_hooks:15:in `eval'
/Users/justin/.rvm/gems/ruby-2.0.0-p353@rails4/bin/ruby_executable_hooks:15:in `<main>'

Might I suggest asking asking the RSpec developers directly?

This sort of weirdness is to be expected when using beta gems. Is there any particular reason you’ve decided to upgrade?

Can you paste your Gemfile or a link to a private Gist?

Here’s the gemfile.

If I change from

  gem "rspec-rails", "~> 2.99.0.beta2"
  #gem 'rspec-rails', '~> 3.0.0.beta'

Full gem file:

source "https://rubygems.org"
ruby "2.0.0"

# http://soupmatt.com/fixing-bundlewithout-on-heroku-cedar
# Hack to make heroku work. Works b/c on heroku, the ENV['HOME'] will be 'app'
                # and this will then return test, which heroku knows to exclude
def hg(g)
  (ENV['HOME'].gsub('/', '') == 'app' ? 'test' : g)
end


group :development, :guard_server do
  gem "annotate" # , " ~> 2.4.1.beta1"
                 # gntp requires that growl be installed
                 # Having issues with Mac and gntp
  gem 'ruby_gntp'
                 #gem 'growl'
                 # Note -- guard with spork is conflicting with rubymine debugger
                 # Rule of thumb is that you can run guard, until you want to go in the debugger.
                 # In that case, quit guard, start server or spec with debugger.
                 # Be sure to start guard as "bundle exec guard"
                 # Before starting guard, run Growl for Linux with command "gol"
                 # or on Macs: http://growl.info/
  gem 'guard-rspec'
  gem 'guard-rails'
  gem 'guard-resque'
  gem 'guard-unicorn'
  gem 'guard-bundler'
  gem 'rb-fsevent'
  # tried guard for resque-scheduler, but did not work as of 11/21/2012
  # run as rake resque:scheduler instead
  #gem 'guard-resque-scheduler'
  gem 'guard-livereload'
  # heroku_san is when we're ready to have a staging server at heroku
  # gem 'heroku_san'

  gem 'better_errors'
  gem 'binding_of_caller'
  gem 'meta_request'

  gem 'pry-doc'
  gem "pry"
  gem 'pry-rails'

  gem 'coffee-rails-source-maps'
  gem 'quiet_assets'
end
gem 'thin', group: [:development, :test, :ci, :guard_server]
gem 'awesome_print'
gem "mobile-fu"
gem 'rails', "~>4"

gem 'draper'
gem 'cancan'
gem 'roadie' # html email
gem 'phone'
gem 'stripe'
gem 'redis'
gem 'resque', :require => "resque/server"
gem 'resque-scheduler', :require => ['resque_scheduler', 'resque_scheduler/server']
gem 'resque_mailer'

# this would remove the resque helpers warning message:
gem 'resque-retry', github: 'teeparham/resque-retry'
# But not doing this in expectation that this will be merged
#gem 'resque-retry'

gem 'haml-rails'

# Time of day support
gem 'tod'

gem 'holidays'

# Easily send vars to javascript
gem 'gon'

# AMQP queue support
gem "bunny"

gem 'devise'
gem 'devise-async'
gem "omniauth-facebook", "~> 1.4.1"

gem 'fb_graph'

gem "to_slug"

gem 'pg'

gem 'rack-cache'
gem 'kgio'
gem "dalli", "~> 2"
gem 'memcachier'


group :production do
  gem 'unicorn'
  gem 'newrelic_rpm'
  gem 'google-analytics-rails'
  gem 'rails_12factor'
  gem 'heroku-deflater'
  gem 'unicorn-worker-killer'
  gem 'resque-heroku', github: 'simple10/resque-heroku'
end


gem 'exception_notification'
#gem 'better_logging' # improves the log format, and adds an optional “Exception” parameter to the warn() and error() methods to print a stack trace automatically
gem "lograge"

gem 'browser_details'
gem 'simple_form'
gem 'handlebars_assets'

# Gems used only for assets and not required
# in production environments by default.
gem 'coffee-rails'
gem 'uglifier'

gem "sprockets", "~> 2"

# http://blog.firmhouse.com/complete-guide-to-serving-your-rails-assets-over-s3-with-asset_sync
gem "asset_sync"

# Temp trying this due to issues at rubygems
gem "breadcrumbs_on_rails" # , :git => "git://github.com/weppos/breadcrumbs_on_rails.git"
# Need to move outside of assets group to enable for development mode
#gem 'sass', require: 'sass'
gem "compass-rails"
gem 'oily_png'

gem "font-awesome-sass-rails"

gem 'sass-rails', '>= 3.2' # sass-rails needs to be higher than 3.2
gem 'bootstrap-sass', '~> 3.0.3.0'

gem 'jquery-rails-cdn'
gem 'jquery-migrate-rails'
gem 'jquery-ui-rails'

gem "datejs-rails"

gem 'sendgrid' # for mailing, see https://github.com/stephenb/sendgrid


gem "daemons"

gem 'gravatar_image_tag'
gem "faker"

gem 'kaminari'

gem 'rails_admin'


# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

gem 'jbuilder'

gem 'aws-sdk'

group :test, hg(:ci) do
  gem 'simplecov', require: false
  gem 'database_cleaner'
  gem 'turn', require: false
  gem "factory_girl_rails"
  gem 'launchy' # this lets us call save_and_open_page to see what's on a page for debugging capybara tests
                #gem 'capybara', :git => 'https://github.com/DouweM/capybara.git', :branch => 'insert-port-into-url'
                #gem "capybara-webkit", :git => 'https://github.com/josephbridgwaterrowe/capybara-webkit.git', :branch => 'patch-1'
                #gem 'capybara-mechanize', :git => 'https://github.com/jeroenvandijk/capybara-mechanize.git'

  gem 'capybara'
  gem 'capybara-screenshot', github: 'parndt/capybara-screenshot', branch: 'fix-rspec-3-0-0-deprecation'
  #gem 'capybara-screenshot'
  gem "show_me_the_cookies"
  gem 'rspec-instafail'

  # gem 'rspec_candy' # enable this for testing float to big decimal
  #gem 'moqueue' # for testing bunny
  gem "shoulda-matchers"
  # http://rubydoc.info/github/thoughtbot/shoulda-matchers/master/frames
  # gem 'timecop' # this will be useful to comparing time zones
  gem "poltergeist"

  # You can grab screenshots of the page at any point by calling page.driver.render('/path/to/file.png')
  # (this works the same way as the PhantomJS render feature, so you can specify other extensions like .pdf, .gif, etc.)
  # By default, only the viewport will be rendered (the part of the page that is in view). To render the entire page,
  # use page.driver.render('/path/to/file.png', :full => true).
  gem 'rspec-retry', github: 'justin808/rspec-retry', branch: 'justin808-rspec-299'
  gem 'resque_spec', github: 'justin808/resque_spec', branch: 'fix-for-resque-heroku'

  gem 'vcr'
  gem 'fakeweb'
  gem 'zeus', "~> 0.13.4.pre2"
end


group :test, hg(:ci), :development do
  # http://railscasts.com/episodes/413-fast-tests
  gem "rspec-rails", "~> 2.99.0.beta2"
  #gem 'rspec-rails', '~> 3.0.0.beta'
  #gem 'rspec', ">= 3.0.0.beta1"
  gem "rspec-its", "~> 1.0.0"
  gem "parallel_tests"
  gem "zeus-parallel_tests"
  gem "heroku_san", "~> 4.3.2"
end