[rspec-users] Rails 3.2.1 breaks stub ?

Larry info at stupidtuesday.com
Sun Jan 29 08:53:54 EST 2012


Hi David,

The trace is below.

Like I said, the line in the spec that causes the error (at least I
think it does; it works when I comment it out; plus, it fails in all 3
specs where I have a similar line) is:

act.stub(:update_attributes).and_raise(ActiveRecord::StaleObjectError)

The line in the controller that bombs out (about 7 lines down in the
trace) is:

    if @act.update_attributes params[:act]
      flash.now.notice = "Act was updated. (Refresh the list to see
changes in the table.)"
    end

Thanks,
Larry


ArgumentError: wrong number of arguments (0 for 2)

/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/activerecord-3.2.1/
lib/active_record/errors.rb:104:in `initialize'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/rspec-mocks-2.8.0/
lib/rspec/mocks/message_expectation.rb:181:in `exception'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/rspec-mocks-2.8.0/
lib/rspec/mocks/message_expectation.rb:181:in `raise'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/rspec-mocks-2.8.0/
lib/rspec/mocks/message_expectation.rb:181:in `invoke'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/rspec-mocks-2.8.0/
lib/rspec/mocks/proxy.rb:123:in `message_received'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/rspec-mocks-2.8.0/
lib/rspec/mocks/method_double.rb:92:in `update_attributes'
/home/larry/RubyMineProjects/StupidTuesday/app/controllers/act/
acts_controller.rb:49:in `update'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/actionpack-3.2.1/lib/
action_controller/metal/implicit_render.rb:4:in `send_action'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/actionpack-3.2.1/lib/
abstract_controller/base.rb:167:in `process_action'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/actionpack-3.2.1/lib/
action_controller/metal/rendering.rb:10:in `process_action'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/actionpack-3.2.1/lib/
abstract_controller/callbacks.rb:18:in `block in process_action'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/activesupport-3.2.1/
lib/active_support/callbacks.rb:458:in
`_run__4120759382721975549__process_action__1657552574701998049__callbacks'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/activesupport-3.2.1/
lib/active_support/callbacks.rb:405:in `__run_callback'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/activesupport-3.2.1/
lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/activesupport-3.2.1/
lib/active_support/callbacks.rb:81:in `run_callbacks'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/actionpack-3.2.1/lib/
abstract_controller/callbacks.rb:17:in `process_action'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/actionpack-3.2.1/lib/
action_controller/metal/rescue.rb:29:in `process_action'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/actionpack-3.2.1/lib/
action_controller/metal/instrumentation.rb:30:in `block in
process_action'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/activesupport-3.2.1/
lib/active_support/notifications.rb:123:in `block in instrument'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/activesupport-3.2.1/
lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/activesupport-3.2.1/
lib/active_support/notifications.rb:123:in `instrument'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/actionpack-3.2.1/lib/
action_controller/metal/instrumentation.rb:29:in `process_action'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/actionpack-3.2.1/lib/
action_controller/metal/params_wrapper.rb:205:in `process_action'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/activerecord-3.2.1/
lib/active_record/railties/controller_runtime.rb:18:in
`process_action'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/actionpack-3.2.1/lib/
abstract_controller/base.rb:121:in `process'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/actionpack-3.2.1/lib/
abstract_controller/rendering.rb:45:in `process'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/actionpack-3.2.1/lib/
action_controller/metal/testing.rb:17:in `process_with_new_base_test'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/actionpack-3.2.1/lib/
action_controller/test_case.rb:464:in `process'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/actionpack-3.2.1/lib/
action_controller/test_case.rb:49:in `process'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/devise-2.0.0/lib/
devise/test_helpers.rb:19:in `block in process'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/devise-2.0.0/lib/
devise/test_helpers.rb:70:in `catch'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/devise-2.0.0/lib/
devise/test_helpers.rb:70:in `_catch_warden'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/devise-2.0.0/lib/
devise/test_helpers.rb:19:in `process'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/actionpack-3.2.1/lib/
action_controller/test_case.rb:390:in `put'
/home/larry/RubyMineProjects/StupidTuesday/spec/controllers/act/
acts_controller_spec.rb:38:in `block (3 levels) in <top (required)>'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/rspec-core-2.8.0/lib/
rspec/core/example.rb:80:in `instance_eval'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/rspec-core-2.8.0/lib/
rspec/core/example.rb:80:in `block in run'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/rspec-core-2.8.0/lib/
rspec/core/example.rb:173:in `with_around_hooks'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/rspec-core-2.8.0/lib/
rspec/core/example.rb:77:in `run'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/rspec-core-2.8.0/lib/
rspec/core/example_group.rb:355:in `block in run_examples'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/rspec-core-2.8.0/lib/
rspec/core/example_group.rb:351:in `map'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/rspec-core-2.8.0/lib/
rspec/core/example_group.rb:351:in `run_examples'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/rspec-core-2.8.0/lib/
rspec/core/example_group.rb:337:in `run'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/rspec-core-2.8.0/lib/
rspec/core/example_group.rb:338:in `block in run'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/rspec-core-2.8.0/lib/
rspec/core/example_group.rb:338:in `map'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/rspec-core-2.8.0/lib/
rspec/core/example_group.rb:338:in `run'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/rspec-core-2.8.0/lib/
rspec/core/command_line.rb:28:in `block (2 levels) in run'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/rspec-core-2.8.0/lib/
rspec/core/command_line.rb:28:in `map'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/rspec-core-2.8.0/lib/
rspec/core/command_line.rb:28:in `block in run'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/rspec-core-2.8.0/lib/
rspec/core/reporter.rb:34:in `report'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/rspec-core-2.8.0/lib/
rspec/core/command_line.rb:25:in `run'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/rspec-core-2.8.0/lib/
rspec/core/runner.rb:80:in `run_in_process'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/rspec-core-2.8.0/lib/
rspec/core/runner.rb:69:in `run'
/home/larry/.rvm/gems/ruby-1.9.3-p0 at stuptues/gems/rspec-core-2.8.0/lib/
rspec/core/runner.rb:10:in `block in autorun'


More information about the rspec-users mailing list