[rspec-users] update_attributes fails in rake spec but not in script/spec???

16 views
Skip to first unread message

Patrick J. Collins

unread,
Apr 30, 2010, 2:14:02 PM4/30/10
to rspec...@rubyforge.org
Hi,

So I just wrote a spec, and tested it by running script/spec
models/result_list_spec.rb

I get:
-----------------------------
.....

Finished in 28.558841 seconds

5 examples, 0 failures

-----------------------------
So then I did: rake spec

and I get a bunch of errors on that same file "wrong number of arguments (0 for 3)"

I then threw a debugger into the code to try to see where it was failing, and
it was failing when I was doing self.update_attributes in the model...

I tried assigning this myself in the debugger console:

(rdb:1) self.update_attribute(:job_item_count, 4)
ArgumentError Exception: wrong number of arguments (0 for 3)

(rdb:1) self
#<ResultList id: 1, table_id: nil, newsletter_id: 3, type: nil, job_start:
"2010-04-30 10:25:17", job_finish: "2010-04-30 10:25:17", job_item_count: 0,
job_action_count: -5, job_error: nil, attachment_file_name: nil,
attachment_content_type: nil, attachment_file_size: nil, attachment_updated_at:
nil, created_at: "2010-04-30 18:01:41", updated_at: "2010-04-30 18:01:41">

... ????????????

Can anyone please explain to me why this is behaving this way?



Patrick J. Collins
http://collinatorstudios.com

_______________________________________________
rspec-users mailing list
rspec...@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

--
You received this message because you are subscribed to the Google Groups "rspec" group.
To post to this group, send email to rs...@googlegroups.com.
To unsubscribe from this group, send email to rspec+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rspec?hl=en.

Patrick J. Collins

unread,
May 1, 2010, 3:29:42 AM5/1/10
to rspec-users
Well, after some investigating, I discovered than another one of my spec files
was causing this behavior. When removing this other spec file, the one that
was failing via rake spec no longer failed.. Totally bizarre.

This is the spec that fails:
http://gist.github.com/386129

And this is the spec that when I delete, the other one that failed now passes:
http://gist.github.com/386125

This is so weird, I would really love it if someone could shed some light on
this.

David Chelimsky

unread,
May 1, 2010, 7:36:33 AM5/1/10
to rspec-users
On May 1, 2010, at 2:29 AM, Patrick J. Collins wrote:

Well, after some investigating, I discovered than another one of my spec files
was causing this behavior.  When removing this other spec file, the one that
was failing via rake spec no longer failed..  Totally bizarre.

This is the spec that fails:
http://gist.github.com/386129

And this is the spec that when I delete, the other one that failed now passes:
http://gist.github.com/386125

This is so weird, I would really love it if someone could shed some light on
this.

Hey Patrick,

This is just a guess, but on line 3 of http://gist.github.com/386125, ActionView::Helpers is being mixed in to the main object, which means it's methods are made accessible to every single object in the system. It's very likely that it is overriding methods that are deeper down the stack. Try moving that include statement inside the ExampleGroup (i.e. inside the describe block).

If that doesn't work, please run the specs with the -b flag, which produces a full backtrace, and then gist the output for us.

HTH,
David

Patrick J. Collins

unread,
May 1, 2010, 8:09:54 AM5/1/10
to rspec-users
> ActionView::Helpers is being mixed in to the main object, which means it's
> methods are made accessible to every single object in the system. It's very
> likely that it is overriding methods

Hi David,

Ahh.. Thank you very much, that was indeed the problem. rake spec now passes
all test.
Reply all
Reply to author
Forward
0 new messages