Forum: RSpec errors in controller specs when running by rake

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Andrea J. (Guest)
on 2009-03-05 19:36
(Received via mailing list)
Hi,

I'm working on Windows Vista and I've installed the plugins rspec and
rspec-rails V1.1.12.
If I run the controller specs directly by ruby, they are all ok:

-----------------------------------
C:\InstantRails-2.0-win\rails_apps\myapplication>ruby
spec/controllers/planning/pl_plann
ings/pl_plannings_controller_new_spec.rb
...

Finished in 0.587 seconds

3 examples, 0 failures
-----------------------------------
C:\InstantRails-2.0-win\rails_apps\myapplication>ruby
-I"C:/InstantRails-2.0-win/rails_a
pps/myapplication/vendor/plugins/rspec/lib"
"C:/InstantRails-2.0-win/rails_apps/myapplication/ve
ndor/plugins/rspec/bin/spec"
"spec/controllers/planning/pl_plannings/pl_planning
s_controller_new_spec.rb" --options
"C:/InstantRails-2.0-win/rails_apps/myapplication/sp
ec/spec.opts"
...

Finished in 0.158 seconds

3 examples, 0 failures
-------------------------------------------

But when I run "rake spec", I get a lot of errors (and an exception from
rake):

(in C:/InstantRails-2.0-win/rails_apps/myapplication)
** Invoke spec (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
.............................F..FFF........FFF...............FFF..FFFFF....

1)
'Planning::PlPlanningsController GET new should render the new template'
FAILED
expected "new", got "planning/pl_plannings/index"
./spec/controllers/planning/pl_plannings/pl_plannings_controller_new_spec.rb:35:

2)
'Planning::PlPlanningsController GET show should render the show
template' FAILED
expected "show", got "planning/pl_plannings/index"
./spec/controllers/planning/pl_plannings/pl_plannings_controller_show_spec.rb:47:

3)
Spec::Mocks::MockExpectationError in 'Planning::PlPlanningsController
GET show should call the find method of the PlPlanning class'
<PlPlanning(id: integer, title: string, created_at: datetime,
updated_at: datetime) (class)> expected :find with (nil) but received it
with (:all)
./spec/controllers/planning/pl_plannings/pl_plannings_controller_show_spec.rb:41:

4)
'Planning::PlPlanningsController GET show should assign a pl_planning'
FAILED
expected instance_of?(PlPlanning(id: integer, title: string, created_at:
datetime, updated_at: datetime)) to return true, got false
./spec/controllers/planning/pl_plannings/pl_plannings_controller_show_spec.rb:36:

5)
'Planning::PlPlanningsController GET edit should render the edit
template' FAILED
expected "edit", got "planning/pl_plannings/index"
./spec/controllers/planning/pl_plannings/pl_plannings_controller_edit_spec.rb:47:

6)
Spec::Mocks::MockExpectationError in 'Planning::PlPlanningsController
GET edit should call the find method of the PlPlanning class'
<PlPlanning(id: integer, title: string, created_at: datetime,
updated_at: datetime) (class)> expected :find with (nil) but received it
with (:all)
./spec/controllers/planning/pl_plannings/pl_plannings_controller_edit_spec.rb:41:

7)
'Planning::PlPlanningsController GET edit should assign a pl_planning'
FAILED
expected instance_of?(PlPlanning(id: integer, title: string, created_at:
datetime, updated_at: datetime)) to return true, got false
./spec/controllers/planning/pl_plannings/pl_plannings_controller_edit_spec.rb:36:

8)
'Planning::PlPlanningsController GET index_deleted should render the
index_deleted template' FAILED
expected "index_deleted", got "planning/pl_plannings/index"
./spec/controllers/planning/pl_plannings/pl_plannings_controller_index_deleted_spec.rb:47:

9)
Spec::Mocks::MockExpectationError in 'Planning::PlPlanningsController
GET index_deleted should call the find method of the PlPlanning::Deleted
class'
<PlPlanning::Deleted(id: integer, title: string, created_at: datetime,
updated_at: datetime, deleted_at: datetime) (class)> expected :find with
(:all, {:order=>"title"}) once, but received it 0 times
./spec/controllers/planning/pl_plannings/pl_plannings_controller_index_deleted_spec.rb:41:

10)
'Planning::PlPlanningsController GET index_deleted should assign
deleted_pl_plannings' FAILED
expected instance_of?(Array) to return true, got false
./spec/controllers/planning/pl_plannings/pl_plannings_controller_index_deleted_spec.rb:36:

11)
ActiveRecord::RecordNotFound in 'Planning::PlPlanningsController PUT
undestroy should redirect to the PlPlannings list'
Couldn't find PlPlanning without an ID
C:/InstantRails-2.0-win/rails_apps/myapplication/app/controllers/planning/pl_plannings_controller.rb:78:in
`update'
./spec/controllers/planning/pl_plannings/pl_plannings_controller_update_spec.rb:6:in
`do_put'
./spec/controllers/planning/pl_plannings/pl_plannings_controller_undestroy_spec.rb:53:

12)
ActiveRecord::RecordNotFound in 'Planning::PlPlanningsController PUT
undestroy should undestroy the PlPlanning'
Couldn't find PlPlanning without an ID
C:/InstantRails-2.0-win/rails_apps/myapplication/app/controllers/planning/pl_plannings_controller.rb:78:in
`update'
./spec/controllers/planning/pl_plannings/pl_plannings_controller_update_spec.rb:6:in
`do_put'
./spec/controllers/planning/pl_plannings/pl_plannings_controller_undestroy_spec.rb:49:

13)
ActiveRecord::RecordNotFound in 'Planning::PlPlanningsController PUT
undestroy should call the find method of the PlPlanning::Deleted class'
Couldn't find PlPlanning without an ID
C:/InstantRails-2.0-win/rails_apps/myapplication/app/controllers/planning/pl_plannings_controller.rb:78:in
`update'
./spec/controllers/planning/pl_plannings/pl_plannings_controller_update_spec.rb:6:in
`do_put'
./spec/controllers/planning/pl_plannings/pl_plannings_controller_undestroy_spec.rb:44:

14)
ActiveRecord::RecordNotFound in 'Planning::PlPlanningsController PUT
undestroy should assign a pl_planning'
Couldn't find PlPlanning without an ID
C:/InstantRails-2.0-win/rails_apps/myapplication/app/controllers/planning/pl_plannings_controller.rb:78:in
`update'
./spec/controllers/planning/pl_plannings/pl_plannings_controller_update_spec.rb:6:in
`do_put'
./spec/controllers/planning/pl_plannings/pl_plannings_controller_undestroy_spec.rb:37:

15)
ActiveRecord::RecordNotFound in 'Planning::PlPlanningsController PUT
undestroy should be successfully redirected'
Couldn't find PlPlanning without an ID
C:/InstantRails-2.0-win/rails_apps/myapplication/app/controllers/planning/pl_plannings_controller.rb:78:in
`update'
./spec/controllers/planning/pl_plannings/pl_plannings_controller_update_spec.rb:6:in
`do_put'
./spec/controllers/planning/pl_plannings/pl_plannings_controller_undestroy_spec.rb:32:

Finished in 1.417 seconds

75 examples, 15 failures
rake aborted!
Command C:/InstantRails-2.0-win/ruby/bin/ruby
 -I"C:/InstantRails-2.0-win/rails_apps/myapplication/vendor/plugins/rspec/lib"
 "C:/InstantRails-2.0-win/rails_apps/myapplication/vendor/plugins/rspec/bin/spec"
 "spec/controllers/planning/pl_plannings/pl_plannings_controller_create_spec.rb"
 "spec/controllers/planning/pl_plannings/pl_plannings_controller_edit_spec.rb"
 "spec/controllers/planning/pl_plannings/pl_plannings_controller_index_deleted_spec.rb"
 "spec/controllers/planning/pl_plannings/pl_plannings_controller_index_spec.rb"
 "spec/controllers/planning/pl_plannings/pl_plannings_controller_new_spec.rb"
 "spec/controllers/planning/pl_plannings/pl_plannings_controller_show_spec.rb"
 "spec/controllers/planning/pl_plannings/pl_plannings_controller_undestroy_spec.rb"
 "spec/controllers/planning/pl_plannings/pl_plannings_controller_update_spec.rb"
 "spec/helpers/pl_plannings_helper_spec.rb"
"spec/models/planning/pl_planning_spec.rb"
 "spec/views/planning/pl_plannings/edit_rhtml_spec.rb"
 "spec/views/planning/pl_plannings/index_deleted_rhtml_spec.rb"
 "spec/views/planning/pl_plannings/index_rhtml_spec.rb"
 "spec/views/planning/pl_plannings/new_rhtml_spec.rb"
 "spec/views/planning/pl_plannings/show_rhtml_spec.rb"
 "spec/views/planning/pl_plannings/_form_rhtml_spec.rb"
 "spec/views/planning/pl_plannings/_table_rhtml_spec.rb"
 --options
"C:/InstantRails-2.0-win/rails_apps/myapplication/spec/spec.opts" failed


C:/InstantRails-2.0-win/rails_apps/myapplication/vendor/plugins/rspec/lib/spec/rake/spectask.rb:175:in
`define'
C:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1090:in
`verbose'
C:/InstantRails-2.0-win/rails_apps/myapplication/vendor/plugins/rspec/lib/spec/rake/spectask.rb:151:in
`define'
C:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in
`call'
C:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in
`execute'
C:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in
`each'
C:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in
`execute'
C:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:578:in
`invoke_with_call_chain'
C:/InstantRails-2.0-win/ruby/lib/ruby/1.8/monitor.rb:242:in
`synchronize'
C:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:571:in
`invoke_with_call_chain'
C:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:564:in
`invoke'
C:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2019:in
`invoke_task'
C:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in
`top_level'
C:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in
`each'
C:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in
`top_level'
C:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2036:in
`standard_exception_handling'
C:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1991:in
`top_level'
C:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1970:in
`run'
C:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2036:in
`standard_exception_handling'
C:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1967:in
`run'
C:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/bin/rake:31
C:/InstantRails-2.0-win/ruby/bin/rake:19:in `load'
C:/InstantRails-2.0-win/ruby/bin/rake:19


-------------------------------------------------------------------------------

Perhaps do I have to make some configurations ?

Thanks in advance
Andrea





DSL zum Nulltarif + 20 Euro Extraprämie bei Online-Bestellung über die
DSL Freundschaftswerbung!
*http://dsl.web.de/?ac=OM.AD.AD008K15279B7069a*
[http://dsl.web.de/?ac=OM.AD.AD008K15279B7069a]
This topic is locked and can not be replied to.