And apparently everything was ok. But when I do a “rake spec” on the app
folder none of the Rails models are visible. Here is the error:
(in C:/Projects/Rails/Workspace/MPS)
./spec/report_class_spec.rb:4: uninitialized constant ReportClass
(NameError)
I just have this on report_class_spec.rb:
describe ReportClass, ‘#new’ do
end
ReportClass was already created on app/models. When I add the following
line at the top of the file it complains about ActiveRecord
(uninitialized constant)
I removed both plugins and reinstalled them using the CURRENT tag. Then
ran the ‘ruby script/generate rspec’ and finally the ‘rake spec’, but I
get the same error. Here is the full trace:
C:\Projects\Rails\Workspace\MPS>rake spec --trace
C:0:Warning: require_gem is obsolete. Use gem instead.
(in C:/Projects/Rails/Workspace/MPS)
** Invoke spec (first_time)
** Invoke db:test:prepare (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:test:prepare
** Invoke db:test:clone (first_time)
** Invoke db:schema:dump (first_time)
** Invoke environment
** Execute db:schema:dump
** Invoke db:test:purge (first_time)
** Invoke environment
** Execute db:test:purge
** Execute db:test:clone
** Invoke db:schema:load (first_time)
** Invoke environment
** Execute db:schema:load
** Execute spec
./spec/models/report_class_spec.rb:4: uninitialized constant ReportClass
(NameError) from
C:/Projects/Rails/Workspace/MPS/vendor/plugins/rspec/lib/spec/runner/behaviour_runner.r
b:106:in load' from C:/Projects/Rails/Workspace/MPS/vendor/plugins/rspec/lib/spec/runner/behaviour_runner.r b:106:inload_specs’ from
C:/Projects/Rails/Workspace/MPS/vendor/plugins/rspec/lib/spec/runner/behaviour_runner.r
b:105:in each' from C:/Projects/Rails/Workspace/MPS/vendor/plugins/rspec/lib/spec/runner/behaviour_runner.r b:105:inload_specs’ from
C:/Projects/Rails/Workspace/MPS/vendor/plugins/rspec/lib/spec/runner/behaviour_runner.r
b:49:in prepare!' from C:/Projects/Rails/Workspace/MPS/vendor/plugins/rspec/lib/spec/runner/behaviour_runner.r b:19:inrun’ from
C:/Projects/Rails/Workspace/MPS/vendor/plugins/rspec/lib/spec/runner/command_line.rb:17
:in run' from C:/Projects/Rails/Workspace/MPS/vendor/plugins/rspec/lib/spec/runner/option_parser.rb:1 81:inparse_options_file’
… 7 levels…
from
C:/Projects/Rails/Workspace/MPS/vendor/plugins/rspec/lib/spec/runner/option_parser.rb:1
55:in parse' from C:/Projects/Rails/Workspace/MPS/vendor/plugins/rspec/lib/spec/runner/option_parser.rb:8 8:increate_behaviour_runner’ from
C:/Projects/Rails/Workspace/MPS/vendor/plugins/rspec/lib/spec/runner/command_line.rb:14
:in `run’ from
C:/Projects/Rails/Workspace/MPS/vendor/plugins/rspec/bin/spec:3
rake aborted!
Command ruby
-I"C:/Projects/Rails/Workspace/MPS/vendor/plugins/rspec/lib"
“C:/Projects/Rails/Workspace/MPS/vendor/plugins/rspec/bin/spec”
“spec/models/report_class_spec.rb” --options
“C:/Projects/Rails/Workspace/MPS/config/…/spec/spec.opts” failed
I wouldn’t specify the actual version unless you need an earlier release
for some reason.
Actually - that goes against our recommendation. Relying on gems that
may or may not be aligned across versions or machines leads to
unexpected and unhappy results. We strongly recommend you install both
plugins of the same version in each app.
at the very top of my tests fixed the problem. Thanks for your help.
Sorry man - should have seen that from the first post. Though you
might consider pastie next time around - makes things easier to see
separate from the email.