linemanjs / lineman

Lineman helps you build fat-client JavaScript apps. It produces happiness by building assets, mocking servers, running specs on every file change
MIT License
1.18k stars 83 forks source link

Switching to proxy breaking specs. #287

Closed sturoid closed 10 years ago

sturoid commented 10 years ago

I have an issue where if I switch to a proxy in the application.js file, my specs break. Specifically the specs that request the api. I'm guessing it's because testem needs to know to use the proxy, but really I have no idea. Has anyone else seen this problem? Is there something I'm missing? Thanks.

searls commented 10 years ago

The lineman spec command (anything in the spec/ directory) is not intended to be used to write integration tests, so hitting any API routes isn't supported. It may be possible, but we don't support it. (For example, when running lineman spec-ci, the server isn't even running, so of course the tests wouldn't work). You can use Jasmine's spies to stub any APIs that would create XHRs or you could bring in a dependency like sinon.js to fake out the browser's XHR facilities (in the event you'd like to write more integratedly-styled tests).

If you'd like to write integration tests, I'd recommend writing a separate integration suite with lineman-spec-browser or grunt-jasmine-bundle.

Closing unless I'm reading you wrong.

sturoid commented 10 years ago

Thanks for the quick reply and explanation Justin. That makes sense. Also, Thank you for all the work on lineman. It has been such a great tool.

On Tue, Jul 1, 2014 at 7:50 PM, Justin Searls notifications@github.com wrote:

Closed #287 https://github.com/linemanjs/lineman/issues/287.

— Reply to this email directly or view it on GitHub https://github.com/linemanjs/lineman/issues/287#event-137232713.

searls commented 10 years ago

:heart: :sparkles:

On Tue, Jul 1, 2014 at 9:57 PM, Stuart Clove notifications@github.com wrote:

Thanks for the quick reply and explanation Justin. That makes sense. Also, Thank you for all the work on lineman. It has been such a great tool.

On Tue, Jul 1, 2014 at 7:50 PM, Justin Searls notifications@github.com wrote:

Closed #287 https://github.com/linemanjs/lineman/issues/287.

Reply to this email directly or view it on GitHub https://github.com/linemanjs/lineman/issues/287#event-137232713.

Reply to this email directly or view it on GitHub https://github.com/linemanjs/lineman/issues/287#issuecomment-47729723.