RSpec on Rails 2.0

I have a project on edge rails that I’m trying to convert from Test:Unit
to rspec. I have the rspec gem version 2338, the rspec and
rsepc_on_rails version 2831 in vendor/plugins, and rails version 8117 in
vendor/rails.

I’ve been able to get a few specs passing, have gotten the specs running
from autotest, and am able to do “rake spec:doc” and get the basic
command line spec printout. I’d like be able to generate the html spec
printout, so I tried “spec spec --format html” but got the “undefined
method `before’ for Spec::Rails::DSL::RailsExample:Class
(NoMethodError)” mentioned in the “Autotest busted with Rspec/Rails
trunk” thread from this forum.

I was wondering if anyone else has been able to get the spec printouts
working with edge rails and if so what versions of
rails/rspec/rspec_on_rails were used.

Thanks for your help,

  • Mark

I can’t get rspec to work with rails edge either, when I do
“rake db:migrate RAILS_ENV=test”

I get:

undefined method failure_message' for classSpec::Matchers::Have’

So I can’t even start working on my project :confused: It works without rspec.

On Nov 8, 2007 7:06 PM, Patrick A. [email protected] wrote:

I can’t get rspec to work with rails edge either, when I do
“rake db:migrate RAILS_ENV=test”

I get:

undefined method failure_message' for class Spec::Matchers::Have’

That was due to a change in edge rails 8115, which broke rspec. It is
now fixed - just update rspec to the current trunk.

Ive just svn up and I still get the same error.

On Nov 8, 2007 7:38 PM, Patrick A. [email protected] wrote:

Ive just svn up and I still get the same error.

I don’t know what to tell you - I just blew away vendor/rails,
vendor/plugins/rspec and vendor/plugins/rspec_on_rails, reinstalled
all three from their respective trunks and all is well.

The problem was being caused by two files in the same location on the
path:

vendor/plugins/rspec/lib/spec/matchers/have.rb
vendor/plugins/rspec_on_rails/lib/spec/matchers/have.rb

The were both being seen as spec/matchers/have.rb.

I moved the one in rspec_on_rails to a different location. Any chance
the old one is still sitting around?

Patrick A. wrote:

Ive just svn up and I still get the same error.


rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users

Did you svn up rspec_on_rails as well?

On Nov 8, 2007 7:58 PM, Patrick A. [email protected] wrote:

I did rm -rf both and now I get this:
superclass mismatch for class TestResponse

Can you provide a tiny bit more context than that? What command are
you using? Stack trace?

I did rm -rf both and now I get this:
superclass mismatch for class TestResponse

sorry:

rake db:migrate RAILS_ENV=test --trace
(in /home/pat/catalogr)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
superclass mismatch for class TestResponse
/home/pat/catalogr/vendor/rails/actionpack/lib/action_controller/test_process.rb:286
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require' /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:inrequire’
/home/pat/catalogr/vendor/rails/activerecord/lib/…/…/activesupport/lib/active_support/dependencies.rb:496:in
require' /home/pat/catalogr/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:342:innew_constants_in’
/home/pat/catalogr/vendor/rails/activerecord/lib/…/…/activesupport/lib/active_support/dependencies.rb:496:in
require' /home/pat/catalogr/vendor/plugins/rspec_on_rails/lib/spec/rails.rb:5 /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:ingem_original_require’
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in require' /home/pat/catalogr/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:496:inrequire’
/home/pat/catalogr/vendor/rails/activerecord/lib/…/…/activesupport/lib/active_support/dependencies.rb:342:in
new_constants_in' /home/pat/catalogr/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:496:inrequire’
/home/pat/catalogr/vendor/rails/activerecord/lib/…/…/activesupport/lib/active_support/dependencies.rb:104:in
require_or_load' /home/pat/catalogr/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:248:inload_missing_constant’
/home/pat/catalogr/vendor/rails/activerecord/lib/…/…/activesupport/lib/active_support/dependencies.rb:453:in
const_missing' /home/pat/catalogr/vendor/plugins/rspec_on_rails/lib/spec/extensions/action_view/base.rb:3 /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:ingem_original_require’
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in require' /home/pat/catalogr/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:496:inrequire’
/home/pat/catalogr/vendor/rails/activerecord/lib/…/…/activesupport/lib/active_support/dependencies.rb:342:in
new_constants_in' /home/pat/catalogr/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:496:inrequire’
/home/pat/catalogr/vendor/plugins/rspec_on_rails/lib/spec/extensions.rb:10
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require' /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:inrequire’
/home/pat/catalogr/vendor/rails/activerecord/lib/…/…/activesupport/lib/active_support/dependencies.rb:496:in
require' /home/pat/catalogr/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:342:innew_constants_in’
/home/pat/catalogr/vendor/rails/activerecord/lib/…/…/activesupport/lib/active_support/dependencies.rb:496:in
require' /home/pat/catalogr/vendor/plugins/rspec/lib/spec.rb:7 /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:ingem_original_require’
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in require' /home/pat/catalogr/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:496:inrequire’
/home/pat/catalogr/vendor/rails/activerecord/lib/…/…/activesupport/lib/active_support/dependencies.rb:342:in
new_constants_in' /home/pat/catalogr/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:496:inrequire’
/home/pat/catalogr/vendor/plugins/rspec/init.rb:2:in evaluate_init_rb' /home/pat/catalogr/config/../vendor/rails/railties/lib/rails/plugin.rb:79:inevaluate_init_rb’
/home/pat/catalogr/vendor/rails/activerecord/lib/…/…/activesupport/lib/active_support/core_ext/kernel/reporting.rb:11:in
silence_warnings' /home/pat/catalogr/config/../vendor/rails/railties/lib/rails/plugin.rb:75:inevaluate_init_rb’
/home/pat/catalogr/config/…/vendor/rails/railties/lib/rails/plugin.rb:39:in
load' /home/pat/catalogr/config/../vendor/rails/railties/lib/rails/plugin/loader.rb:33:inload_plugins’
/home/pat/catalogr/config/…/vendor/rails/railties/lib/rails/plugin/loader.rb:32:in
each' /home/pat/catalogr/config/../vendor/rails/railties/lib/rails/plugin/loader.rb:32:inload_plugins’
/home/pat/catalogr/config/…/vendor/rails/railties/lib/initializer.rb:189:in
load_plugins' /home/pat/catalogr/config/../vendor/rails/railties/lib/initializer.rb:105:inprocess’
/home/pat/catalogr/config/…/vendor/rails/railties/lib/initializer.rb:49:in
send' /home/pat/catalogr/config/../vendor/rails/railties/lib/initializer.rb:49:inrun’
/home/pat/catalogr/config/environment.rb:13
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require' /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:inrequire’
/home/pat/catalogr/vendor/rails/railties/lib/tasks/misc.rake:3
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in call' /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:inexecute’
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in each' /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:inexecute’
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:362:in invoke' /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:355:insynchronize’
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:355:in invoke' /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:369:ininvoke_prerequisites’
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1003:in each' /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1003:insend’
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1003:in each' /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:368:ininvoke_prerequisites’
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:361:in invoke' /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:355:insynchronize’
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:355:in invoke' /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1739:intop_level’
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1739:in each' /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1739:intop_level’
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1761:in
standard_exception_handling' /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1733:intop_level’
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1711:in run' /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1761:instandard_exception_handling’
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1708:in run' /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/bin/rake:7 /usr/bin/rake:16:inload’
/usr/bin/rake:16

On Nov 8, 2007 8:07 PM, Patrick A. [email protected] wrote:

sorry:

rake db:migrate RAILS_ENV=test --trace
(in /home/pat/catalogr)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
superclass mismatch for class TestResponse
/home/pat/catalogr/vendor/rails/actionpack/lib/action_controller/test_process.rb:286

That line reads like this:

class TestResponse < AbstractResponse

So it seems like there’s some other loading problem. Try and blow away
the rspec plugins and run this migration and see if you still have
trouble.

if I nuke the plugin i works:

rake db:migrate RAILS_ENV=test
(in /home/pat/catalogr)
== 2 CreateBrands: migrating

– create_table(:brands)
-> 0.2779s
== 2 CreateBrands: migrated (0.2782s)

On Nov 8, 2007 8:18 PM, Patrick A. [email protected] wrote:

if I nuke the plugin i works:

rake db:migrate RAILS_ENV=test
(in /home/pat/catalogr)
== 2 CreateBrands: migrating ==================================================
– create_table(:brands)
→ 0.2779s
== 2 CreateBrands: migrated (0.2782s) =========================================

That’s hosed!!!

What other plugins do you have installed?

On Nov 8, 2007 8:21 PM, Patrick A. [email protected] wrote:

Nothing its a fresh project with latest rails edge that i started to
learn rspec.

Rails edge or 2.0 preview?

Nothing its a fresh project with latest rails edge that i started to
learn rspec.

Rails edge or 2.0 preview?
edge at revision 8117.

ok works great :slight_smile: maybe because I did the scaffold with an old version
rspec? (the one from this morning), sounds weird though. anyway,
Thanks a lot!

On Nov 8, 2007 8:36 PM, David C. [email protected] wrote:

On Nov 8, 2007 8:21 PM, Patrick A. [email protected] wrote:

Nothing its a fresh project with latest rails edge that i started to
learn rspec.

Rails edge or 2.0 preview?

I just did this:

rails foo
cd foo
rake rails:freeze:edge
ruby script/plugin install svn://rubyforge.org/var/svn/rspec/trunk/rspec
ruby script/plugin install
svn://rubyforge.org/var/svn/rspec/trunk/rspec_on_rails
script/generate rspec
rake db:create:all
script/generate rspec_scaffold Thing name:string
rake db:migrate
rake spec

All ran perfectly well. I really don’t know what’s going on on your
machine.

On Nov 9, 2007 3:40 AM, David C. [email protected] wrote:

rake spec

All ran perfectly well. I really don’t know what’s going on on your machine.

but did you try to run ‘rake db:migrate RAILS_ENV=test’ in your foo
app? doesn’t work here.

On Nov 9, 2007 9:02 AM, Patrick A. [email protected] wrote:

rake db:migrate
rake spec

All ran perfectly well. I really don’t know what’s going on on your machine.

but did you try to run ‘rake db:migrate RAILS_ENV=test’ in your foo
app? doesn’t work here.

Ah - why are you doing that? rake spec takes care of setting up your
test db.

David C. wrote:

On Nov 8, 2007 8:36 PM, David C. [email protected] wrote:

On Nov 8, 2007 8:21 PM, Patrick A. [email protected] wrote:

Nothing its a fresh project with latest rails edge that i started to
learn rspec.

Rails edge or 2.0 preview?

I just did this:

rails foo
cd foo
rake rails:freeze:edge
ruby script/plugin install svn://rubyforge.org/var/svn/rspec/trunk/rspec
ruby script/plugin install
svn://rubyforge.org/var/svn/rspec/trunk/rspec_on_rails
script/generate rspec
rake db:create:all
script/generate rspec_scaffold Thing name:string
rake db:migrate
rake spec

All ran perfectly well. I really don’t know what’s going on on your
machine.

Installing plugin from the url you provided fixed the issue. I had
“undefined method `failure_message’” problem with plugin installed today
from this url:
svn://rubyforge.org/var/svn/rspec/tags/CURRENT/rspec_on_rails