Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using twirl in integration tests #21

Open
talkol opened this issue May 26, 2014 · 1 comment
Open

Using twirl in integration tests #21

talkol opened this issue May 26, 2014 · 1 comment

Comments

@talkol
Copy link

talkol commented May 26, 2014

I'm trying to use twirl as part of my integration tests.

My integration tests have an HTTP simplicator that mimics a real world service. To implement this simplicator in the tests, I'm using spray-can embedded HTTP server which needs to spit out responses based on twirl templates.

My tests are located at /src/it/scala so naturally I want to place these twirl templates inside /src/it/twirl. This doesn't work since the twirl compiler ignores this directory.

If I place the twirl templates in /src/main/twirl, everything works fine - but I'm trying to avoid this because I don't want these templates to clutter the production package (the templates only come into play in the tests so they should only compile inside when the tests are run).

How can I tell the twirl compiler to look for templates in the new directory?

@jrudolph
Copy link
Member

That's currently not supported. As a workaround you can look at the keys defined in https://github.com/spray/twirl/blob/master/sbt-twirl/src/main/scala/twirl/sbt/TwirlPlugin.scala and CnP and redefine all for the integration scope, i.e. copy all those settings that have in Compile and replace it with in IntegrationTest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants