apache / apache/grails-intellij-plugin

Test succeeds in Grails 2.3.1, but fails in IntelliJ

Open
#146 0 comments 0 reactions 0 assignees View on GitHub
bug imported-from-youtrack
Dominant language
Java
Stars
17
Forks
4
Avg merge
5d 15h
Merged PRs (30d)
4

Description

This my test:
```
void "Test the create action returns the correct model"() {
when: "The create action is executed"
controller.create()

then: "The model is correctly created"
model.erikInstance != null
}
```
With the following implementation:
```
def create() {
respond new Erik(params)
}
```
Fails with the following error:
```
Condition not satisfied:

model.erikInstance != null
| | |
| null false
[erik:nl.oelan.farmacie.declaratie.Erik : (unsaved)]

at nl.oelan.farmacie.declaratie.ErikControllerSpec.Test the create action returns the correct model(ErikControllerSpec.groovy:36)
```
As you can see, the 'respond' keyword, which is newly introduced in 2.3, behaves a bit bit odd in IntelliJ. I've run the same test using Grails command line:

grails test-app :unit nl.oelan.farmacie.declaratie.ErikController

and using that, it works.

---

*Imported from [IDEA-115932](https://youtrack.jetbrains.com/issue/IDEA-115932) · Type: Bug · Votes: 0*
*Comments, attachments, dates and reporter are not part of the export — follow the link above for the full history.*

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the ErikControllerSpec test at ErikControllerSpec.groovy:36 and compare its IntelliJ run with `grails test-app :unit nl.oelan.farmacie.declaratie.ErikController`. Investigate how the `create()` action's `respond new Erik(params)` result is exposed as `model`, and consider the issue done when `model.erikInstance` is non-null in IntelliJ as it is from the command line.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.