Grails

Cannot Use "mockFor" more than once in a test

Details

  • Type: Sub-task Sub-task
  • Status: Closed Closed
  • Priority: Blocker Blocker
  • Resolution: Fixed
  • Affects Version/s: 1.0.4
  • Fix Version/s: 1.1-beta2
  • Component/s: Testing
  • Labels:
    None
  • Environment:
    testing plugin 0.3, HEAD as of November 19th. Running on Grails 1.0.4
  • Testcase included:
    yes

Description

If you try to use mockFor on the same class in two different tests, the second one fails.

Activity

Hide
Mike Hugo added a comment -
Show
Mike Hugo added a comment - User list thread is here: http://www.nabble.com/Testing-Plugin-td20590673.html#a20591673
Hide
Peter Ledbrook added a comment -

I can't reproduce this with the current Grails 1.1, so I'll have to try again once I merge the current changes back to the plugin. It may be that a change in Groovy/Grails fixed this, in which case updating the plugin won't help.

Show
Peter Ledbrook added a comment - I can't reproduce this with the current Grails 1.1, so I'll have to try again once I merge the current changes back to the plugin. It may be that a change in Groovy/Grails fixed this, in which case updating the plugin won't help.
Hide
Peter Ledbrook added a comment -

It is still broken on Grails 1.0.x, but I have no idea how to fix it at the moment. It certainly looks like it will take quite an investment of time to track the problem down

Show
Peter Ledbrook added a comment - It is still broken on Grails 1.0.x, but I have no idea how to fix it at the moment. It certainly looks like it will take quite an investment of time to track the problem down
Hide
Robert Fischer added a comment -

My recommendation is to set the Fix Version to 1.1, mark it as resolved, and drop a test that mocks twice into the test suite for Grails so that you don't break whatever magically fixes this. I suspect it's some kind of weird consequence of Groovy's updated metaclass implementation.

The Testing plugin then will just have this as a known limitation in 1.0.4. That's reasonable, even if annoying. I'm not sure there's a lot of value in burning time on this with 1.1 being right around the bend.

Show
Robert Fischer added a comment - My recommendation is to set the Fix Version to 1.1, mark it as resolved, and drop a test that mocks twice into the test suite for Grails so that you don't break whatever magically fixes this. I suspect it's some kind of weird consequence of Groovy's updated metaclass implementation. The Testing plugin then will just have this as a known limitation in 1.0.4. That's reasonable, even if annoying. I'm not sure there's a lot of value in burning time on this with 1.1 being right around the bend.
Hide
Peter Ledbrook added a comment -

My only worry is that the current code is broken somehow and a side-effect of a change in 1.6 is to hide the problem in this case. I'll add the test to the test-suite and see how the joint builds go.

Show
Peter Ledbrook added a comment - My only worry is that the current code is broken somehow and a side-effect of a change in 1.6 is to hide the problem in this case. I'll add the test to the test-suite and see how the joint builds go.
Hide
Peter Ledbrook added a comment -

OK, the joint builds are still working so I'm assuming this has been fixed by Groovy 1.6.

Show
Peter Ledbrook added a comment - OK, the joint builds are still working so I'm assuming this has been fixed by Groovy 1.6.
Hide
Graeme Rocher added a comment -

Bulk closing bunch of resolved issues

Show
Graeme Rocher added a comment - Bulk closing bunch of resolved issues

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: