I checked first and found no conversation that matched my problem so
here it is:
I’m trying to get rspec going on ruby 1.9.1 / rails 2.3.0 - here’s my
current gem list:
*** LOCAL GEMS ***
actionmailer (2.3.0)
actionpack (2.3.0)
activerecord (2.3.0)
activeresource (2.3.0)
activesupport (2.3.0)
columnize (0.3.0)
cucumber (0.1.16)
daemons (1.0.10)
diff-lcs (1.1.2)
eventmachine (0.12.4)
git (1.0.5)
hoe (1.9.0)
mocha (0.9.5)
mysql (2.8.1)
pg (0.7.9.2009.02.26)
polyglot (0.2.5)
rack (0.9.1)
rails (2.3.0)
rake (0.8.3)
rspec (1.1.99.10)
rspec-rails (1.1.99.10)
rubyforge (1.0.3)
rubyist-aasm (2.0.5)
sqlite3-ruby (1.2.4)
term-ansicolor (1.0.3)
thin (1.0.0)
treetop (1.2.4)
As you can see, I followed David’s instructions re rspec and rspec-
rails for rails 2.3.0. Just by way of test, I did the following:
- rails spec230test
- cd spec230test
- script/generate rspec
- script/generate rspec_model User name:string email:string
- rake db:migrate
- rake spec:models --trace
and here’s what I get for results:
rake spec:models --trace
(in /Users/rick/spec230test)
** Invoke spec:models (first_time)
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:abort_if_pending_migrations
** Execute db:test:prepare
** Invoke db:test:load (first_time)
** Invoke db:test:purge (first_time)
** Invoke environment
** Execute db:test:purge
** Execute db:test:load
** Invoke db:schema:load (first_time)
** Invoke environment
** Execute db:schema:load
** Execute spec:models
/opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.0/lib/
active_support/test_case.rb:6: warning: already initialized constant
Mocha
/opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.0/lib/
active_support/dependencies.rb:440:in rescue in load_missing_constant': uninitialized constant Mocha::Standalone (NameError) from /opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.0/lib/ active_support/dependencies.rb:436:in
load_missing_constant’
from /opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.0/lib/
active_support/dependencies.rb:80:in const_missing_with_dependencies' from /opt/local/lib/ruby/gems/1.9.1/gems/mocha-0.9.5/lib/mocha.rb: 30:in
class:TestCase’
from /opt/local/lib/ruby/gems/1.9.1/gems/mocha-0.9.5/lib/mocha.rb:
29:in <class:Unit>' from /opt/local/lib/ruby/gems/1.9.1/gems/mocha-0.9.5/lib/mocha.rb: 28:in
module:MiniTest’
from /opt/local/lib/ruby/gems/1.9.1/gems/mocha-0.9.5/lib/mocha.rb:
27:in <top (required)>' from /opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.0/lib/ active_support/dependencies.rb:158:in
require’
from /opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.0/lib/
active_support/dependencies.rb:158:in require' from /opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.0/lib/ active_support/test_case.rb:3:in
<top (required)>’
from /opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.0/lib/
active_support/dependencies.rb:158:in require' from /opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.0/lib/ active_support/dependencies.rb:158:in
require’
from /opt/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.0/lib/
action_controller/integration.rb:3:in <top (required)>' from /opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.0/lib/ active_support/dependencies.rb:158:in
require’
from /opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.0/lib/
active_support/dependencies.rb:158:in require' from /opt/local/lib/ruby/gems/1.9.1/gems/rspec-rails-1.1.99.10/lib/ spec/rails.rb:11:in
<top (required)>’
from /opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.0/lib/
active_support/dependencies.rb:158:in require' from /opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.0/lib/ active_support/dependencies.rb:158:in
require’
from /Users/rick/spec230test/spec/spec_helper.rb:6:in `<top (required)
’
from /opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.0/lib/
active_support/dependencies.rb:158:inrequire' from /opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.0/lib/ active_support/dependencies.rb:158:in
require’
from /Users/rick/spec230test/spec/models/user_spec.rb:1:in<top (required)>' from /opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.0/lib/ active_support/dependencies.rb:147:in
load_without_new_constant_marking’
from /opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.0/lib/
active_support/dependencies.rb:147:inload_with_new_constant_marking' from /opt/local/lib/ruby/gems/1.9.1/gems/rspec-1.1.99.10/lib/spec/ runner/example_group_runner.rb:15:in
block in load_files’
from /opt/local/lib/ruby/gems/1.9.1/gems/rspec-1.1.99.10/lib/spec/
runner/example_group_runner.rb:14:ineach' from /opt/local/lib/ruby/gems/1.9.1/gems/rspec-1.1.99.10/lib/spec/ runner/example_group_runner.rb:14:in
load_files’
from /opt/local/lib/ruby/gems/1.9.1/gems/rspec-1.1.99.10/lib/spec/
runner/options.rb:87:inrun_examples' from /opt/local/lib/ruby/gems/1.9.1/gems/rspec-1.1.99.10/lib/spec/ runner.rb:61:in
run’
from /opt/local/lib/ruby/gems/1.9.1/gems/rspec-1.1.99.10/lib/spec/
runner.rb:44:inblock in autorun' /opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.0/lib/ active_support/dependencies.rb:158:in
require’: no such file to load
– test/unit/testcase (MissingSourceFile)
from /opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.0/lib/
active_support/dependencies.rb:158:inrequire' from /opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.0/lib/ active_support/test_case.rb:10:in
<top (required)>’
from /opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.0/lib/
active_support/dependencies.rb:158:inrequire' from /opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.0/lib/ active_support/dependencies.rb:158:in
require’
from /opt/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.0/lib/
action_controller/integration.rb:3:in<top (required)>' from /opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.0/lib/ active_support/dependencies.rb:158:in
require’
from /opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.0/lib/
active_support/dependencies.rb:158:inrequire' from /opt/local/lib/ruby/gems/1.9.1/gems/rspec-rails-1.1.99.10/lib/ spec/rails.rb:11:in
<top (required)>’
from /opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.0/lib/
active_support/dependencies.rb:158:inrequire' from /opt/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.0/lib/ active_support/dependencies.rb:158:in
require’
from /Users/rick/spec230test/spec/spec_helper.rb:6:in<top (required) ' from /Users/rick/spec230test/spec/models/user_spec.rb:1:in
require’
from /Users/rick/spec230test/spec/models/user_spec.rb:1:in<top (required)>' from /opt/local/lib/ruby/gems/1.9.1/gems/rspec-1.1.99.10/lib/spec/ runner/example_group_runner.rb:15:in
load’
from /opt/local/lib/ruby/gems/1.9.1/gems/rspec-1.1.99.10/lib/spec/
runner/example_group_runner.rb:15:inblock in load_files' from /opt/local/lib/ruby/gems/1.9.1/gems/rspec-1.1.99.10/lib/spec/ runner/example_group_runner.rb:14:in
each’
from /opt/local/lib/ruby/gems/1.9.1/gems/rspec-1.1.99.10/lib/spec/
runner/example_group_runner.rb:14:inload_files' from /opt/local/lib/ruby/gems/1.9.1/gems/rspec-1.1.99.10/lib/spec/ runner/options.rb:87:in
run_examples’
from /opt/local/lib/ruby/gems/1.9.1/gems/rspec-1.1.99.10/lib/spec/
runner/command_line.rb:9:inrun' from /opt/local/lib/ruby/gems/1.9.1/gems/rspec-1.1.99.10/bin/spec: 4:in
’
rake aborted!
Command /opt/local/bin/ruby -I"/opt/local/lib/ruby/gems/1.9.1/gems/
rspec-1.1.99.10/lib" “/opt/local/lib/ruby/gems/1.9.1/gems/
rspec-1.1.99.10/bin/spec” “spec/models/user_spec.rb” --options “/Users/
rick/spec230test/spec/spec.opts” failed
/opt/local/lib/ruby/gems/1.9.1/gems/rspec-1.1.99.10/lib/spec/rake/
spectask.rb:174:inblock (2 levels) in define' /opt/local/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:1090:in
verbose’
/opt/local/lib/ruby/gems/1.9.1/gems/rspec-1.1.99.10/lib/spec/rake/
spectask.rb:150:inblock in define' /opt/local/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:617:in
call’
/opt/local/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:617:in
block in execute' /opt/local/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:612:in
each’
/opt/local/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:612:in
execute' /opt/local/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:578:in
block in invoke_with_call_chain’
/opt/local/lib/ruby/1.9.1/monitor.rb:190:inmon_synchronize' /opt/local/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:571:in
invoke_with_call_chain’
/opt/local/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:564:in
invoke' /opt/local/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:2019:in
invoke_task’
/opt/local/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:1997:in
block (2 levels) in top_level' /opt/local/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:1997:in
each’
/opt/local/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:1997:in
block in top_level' /opt/local/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:2036:in
standard_exception_handling’
/opt/local/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:1991:in
top_level' /opt/local/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:1970:in
block in run’
/opt/local/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:2036:in
standard_exception_handling' /opt/local/lib/ruby/gems/1.9.1/gems/rake-0.8.3/lib/rake.rb:1967:in
run’
/opt/local/lib/ruby/gems/1.9.1/gems/rake-0.8.3/bin/rake:31:in<top (required)>' /opt/local/bin/rake:19:in
load’
/opt/local/bin/rake:19:in `’
Compilation exited abnormally with code 1 at Wed Mar 4 11:07:37
Just by way of sanity check, in a directory that contained both
user_spec.rb and user.rb from above, I ran “spec user_spec.rb” and got
the same result.
Any thoughts on what I should try next? BTW, the same sequence of
steps run in a Ruby1.8.7/Rails2.2.2 environment works fine of course.
thanks in advance,
Rick