include ApplicationHelper in helper object in helper specs
include request spec extensions in files in spec/integration
include controller spec extensions in groups that use :type =>
:controller
same for :model, :view, :helper, :mailer, :request, :routing
Bug fixes
restore global config.render_views so you only need to say it once
support overriding render_views in nested groups
matchers that delegate to Rails’ assertions capture
ActiveSupport::TestCase::Assertion (so they work properly now with
should_not in Ruby 1.8.7 and 1.9.1)
I just upgraded from 2.3.1 and I now get this error on all my specs…
Nothing else changed and the Upgrade.md does not indicate any backward
compatibilities unless I missed something.
(in /home/morris/work/ruby/rails3/wolfmanblog)
/opt/ruby-enterprise-1.8.7-2010.02/bin/ruby -S bundle exec rspec ./
spec/controllers/posts_controller_spec.rb
[sequel] Setting up the “test” environment:
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
actionpack-3.0.3/lib/action_controller/test_case.rb:10: undefined
method setup' for #<Class:0xa24723c> (NoMethodError) from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ activesupport-3.0.3/lib/active_support/concern.rb:52:inclass_eval’
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
activesupport-3.0.3/lib/active_support/concern.rb:52:in append_features' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ actionpack-3.0.3/lib/action_controller/test_case.rb:439:ininclude’
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
actionpack-3.0.3/lib/action_controller/test_case.rb:439
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
activesupport-3.0.3/lib/active_support/concern.rb:52:in class_eval' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ activesupport-3.0.3/lib/active_support/concern.rb:52:inappend_features’
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
activesupport-3.0.3/lib/active_support/concern.rb:48:in include' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ activesupport-3.0.3/lib/active_support/concern.rb:48:insend’
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
activesupport-3.0.3/lib/active_support/concern.rb:48:in append_features' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ activesupport-3.0.3/lib/active_support/concern.rb:48:ineach’
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
activesupport-3.0.3/lib/active_support/concern.rb:48:in append_features' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ rspec-core-2.4.0/lib/rspec/core/configuration.rb:372:ininclude’
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
rspec-core-2.4.0/lib/rspec/core/configuration.rb:372:in send' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ rspec-core-2.4.0/lib/rspec/core/configuration.rb:372:inconfigure_group’
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
rspec-core-2.4.0/lib/rspec/core/configuration.rb:369:in each' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ rspec-core-2.4.0/lib/rspec/core/configuration.rb:369:inconfigure_group’
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
rspec-core-2.4.0/lib/rspec/core/world.rb:35:in configure_group' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ rspec-core-2.4.0/lib/rspec/core/example_group.rb:153:inset_it_up’
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
rspec-core-2.4.0/lib/rspec/core/example_group.rb:130:in subclass' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ rspec-core-2.4.0/lib/rspec/core/example_group.rb:118:indescribe’
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
rspec-core-2.4.0/lib/rspec/core/extensions/object.rb:6:in describe' from /home/morris/work/ruby/rails3/wolfmanblog/spec/ controllers/posts_controller_spec.rb:3 from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ rspec-core-2.4.0/lib/rspec/core/configuration.rb:387:inload’
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
rspec-core-2.4.0/lib/rspec/core/configuration.rb:387:in load_spec_files' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ rspec-core-2.4.0/lib/rspec/core/configuration.rb:387:inmap’
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
rspec-core-2.4.0/lib/rspec/core/configuration.rb:387:in load_spec_files' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ rspec-core-2.4.0/lib/rspec/core/command_line.rb:18:inrun’
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
rspec-core-2.4.0/lib/rspec/core/runner.rb:55:in run_in_process' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ rspec-core-2.4.0/lib/rspec/core/runner.rb:46:inrun’
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
rspec-core-2.4.0/lib/rspec/core/runner.rb:10:in `autorun’
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/bin/
rspec:19
rake aborted!
ruby -S bundle exec rspec ./spec/controllers/posts_controller_spec.rb
failed
Using rake (0.8.7)
Using abstract (1.0.0)
Using activesupport (3.0.3)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.3)
Using erubis (2.6.6)
Using rack (1.2.1)
Using rack-mount (0.6.13)
Using rack-test (0.5.7)
Using tzinfo (0.3.23)
Using actionpack (3.0.3)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.2.12)
Using actionmailer (3.0.3)
Using arel (2.0.6)
Using activerecord (3.0.3)
Using activeresource (3.0.3)
Using bundler (1.0.3)
Using cells (3.4.2)
Using diff-lcs (1.1.2)
Using factory_girl (1.3.2)
Using thor (0.14.6)
Using railties (3.0.3)
Using rails (3.0.3)
Using factory_girl_rails (1.0)
Using haml (3.0.24)
Using nokogiri (1.4.4)
Using pg (0.10.0)
Using rdiscount (1.6.5)
Using rspec-core (2.4.0)
Using rspec-expectations (2.4.0)
Using rspec-mocks (2.4.0)
Using rspec (2.4.0)
Using rspec-rails (2.4.0)
Using rspec-cells (0.0.2)
Using sequel (3.17.0)
Using sequel-rails (0.1.8)
Using stringex (1.2.0)
Using uuidtools (2.1.1)
Using webrat (0.7.2)
and spec_helper.rb looked like…
This file is copied to spec/ when you run 'rails generate
If you prefer to use mocha, flexmock or RR, uncomment the
appropriate line:
config.mock_with :mocha
config.mock_with :flexmock
config.mock_with :rr
config.mock_with :rspec
setup transactional factory for sequel, when running transactional
tests
config.around(:each, :transactional => true) do |example|
Sequel::DATABASES.first.transaction do
example.run
raise Sequel::Error::Rollback
end
end
end
to make factory girl run with sequel
class Sequel::Model
def save!
save(:validate=>false)
end
end
I forgot to mention that I did get a deprecation warning from rspec-
cells (they haven’t updated it yet), but I fixed it by doing what the
deprecation warning said. I don’t think that has anything to do with
the error I am getting though.
The problem is with rspec-cells, but I’m not clear yet on the root
cause. Something to do with the way it’s hooking itself into the
framework is failing.
I’ll follow up if/when I have some new information, but it might be a
day or two.
The problem is with rspec-cells, but I’m not clear yet on the root
cause. Something to do with the way it’s hooking itself into the
framework is failing.
I totally removed rspec-cells from my gems and bundle, but I still get
the same failure, so I’m not convinced it is rspec-cells, it did give
a deprecation error but that is easily fixed.
I forgot to mention that I did get a deprecation warning from rspec-
cells (they haven’t updated it yet), but I fixed it by doing what the
deprecation warning said. I don’t think that has anything to do with
the error I am getting though.
I didn’t realize other libs were using it. Now that I know they are I
may consider reversing the deprecation, though I’m not convinced it’s
really the best API, so I’ll have to give that some thought.
That aside, the commit that made that method obsolete within rspec-rails
was:
If you have some time to investigate, please see if reversing that
commit solves the problem. Should point us in the right direction.
I removed the rspec-cells gem but that did not do anything to help.
So if you were to checkout my project and change the Gemfile to get
rspec 2.4.0 then run…
rspec spec/controllers/posts_controller_spec.rb
you should get this dump…
The around hook is a red herring too.
This is very odd. I’m not sure what it is yet, but it’s something to
do with the load order of modules. I can’t reproduce this in my apps,
but I can in yours with no problem.
Ok I re installed rspec-rails 2.4.0 looks like my request specs run,
and my model specs run but my
controller specs and helper specs do not run, and throw that error.
I have that config.around… in my spec_helper which applies to most
request specs but not to the helper specs or controller specs (which
use mocks), so that is a difference, the around does NOT run when the
helpers or controller specs run, but I don’t see how that would cause
this error.
I removed the rspec-cells gem but that did not do anything to help.
So if you were to checkout my project and change the Gemfile to get
rspec 2.4.0 then run…
rspec spec/controllers/posts_controller_spec.rb
you should get this dump…
[sequel] Setting up the “test” environment:
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
actionpack-3.0.3/lib/action_controller/test_case.rb:10: undefined
method setup' for #<Class:0xa1bda8c> (NoMethodError) from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ activesupport-3.0.3/lib/active_support/concern.rb:52:inclass_eval’
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
activesupport-3.0.3/lib/active_support/concern.rb:52:in append_features' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ actionpack-3.0.3/lib/action_controller/test_case.rb:439:ininclude’
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
actionpack-3.0.3/lib/action_controller/test_case.rb:439
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
activesupport-3.0.3/lib/active_support/concern.rb:52:in class_eval' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ activesupport-3.0.3/lib/active_support/concern.rb:52:inappend_features’
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
activesupport-3.0.3/lib/active_support/concern.rb:48:in include' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ activesupport-3.0.3/lib/active_support/concern.rb:48:insend’
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
activesupport-3.0.3/lib/active_support/concern.rb:48:in append_features' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ activesupport-3.0.3/lib/active_support/concern.rb:48:ineach’
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
activesupport-3.0.3/lib/active_support/concern.rb:48:in append_features' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ rspec-core-2.4.0/lib/rspec/core/configuration.rb:372:ininclude’
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
rspec-core-2.4.0/lib/rspec/core/configuration.rb:372:in send' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ rspec-core-2.4.0/lib/rspec/core/configuration.rb:372:inconfigure_group’
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
rspec-core-2.4.0/lib/rspec/core/configuration.rb:369:in each' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ rspec-core-2.4.0/lib/rspec/core/configuration.rb:369:inconfigure_group’
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
rspec-core-2.4.0/lib/rspec/core/world.rb:35:in configure_group' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ rspec-core-2.4.0/lib/rspec/core/example_group.rb:153:inset_it_up’
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
rspec-core-2.4.0/lib/rspec/core/example_group.rb:130:in subclass' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ rspec-core-2.4.0/lib/rspec/core/example_group.rb:118:indescribe’
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
rspec-core-2.4.0/lib/rspec/core/extensions/object.rb:6:in describe' from /home/morris/work/ruby/rails3/wolfmanblog/spec/ controllers/posts_controller_spec.rb:3 from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ rspec-core-2.4.0/lib/rspec/core/configuration.rb:387:inload’
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
rspec-core-2.4.0/lib/rspec/core/configuration.rb:387:in load_spec_files' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ rspec-core-2.4.0/lib/rspec/core/configuration.rb:387:inmap’
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
rspec-core-2.4.0/lib/rspec/core/configuration.rb:387:in load_spec_files' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ rspec-core-2.4.0/lib/rspec/core/command_line.rb:18:inrun’
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
rspec-core-2.4.0/lib/rspec/core/runner.rb:55:in run_in_process' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ rspec-core-2.4.0/lib/rspec/core/runner.rb:46:inrun’
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
rspec-core-2.4.0/lib/rspec/core/runner.rb:10:in `autorun’
from /opt/ruby-enterprise-1.8.7-2010.02/bin/rspec:19
This is very odd. I’m not sure what it is yet, but it’s something to
do with the load order of modules. I can’t reproduce this in my apps,
but I can in yours with no problem.
Onward …
Found it. Will release a bug fix release of rspec-rails shortly.
I don’t understand why I hadn’t seen it in any of my apps, or in
rspec’s own spec suite, but it boils down to the order in which
RSpec::Rails::RailsExampleGroup and
ActionController::TestCase::Behavior are declared.
I was looking around to see where stuff was required, figured it may
have something to do with the fact I don’t use
require ‘rails/all’
in my application.rb, but break out stuff so I don’t include
activerecord but do include sequel, maybe active record which is
usually loaded first pulls something in that you needed?
Thanks
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.