Closed ingolfured closed 9 years ago
Answered on stack overflow. Something like cucumber or capybara+rspec works better for these sorts of things.
so, secretly, you can do this by making an ajax request to your endpoint and inserting that into the fixture element, but this is not advisable.
Sorry for late reply. Thanks for this mate! Didnt really understand what was going on. I think Ill just stick with Capybara for feature tests.
Best, Ingo
On Wed, Mar 11, 2015 at 4:45 PM, Jeremy Jackson notifications@github.com wrote:
so, secretly, you can do this by making an ajax request to your endpoint and inserting that into the fixture element, but this is not advisable.
— Reply to this email directly or view it on GitHub https://github.com/modeset/teaspoon/issues/331#issuecomment-78303244.
Yup, no worries.. teaspoon is primarily for unit testing javascript -- with some integration level things by the nature of what javascript usually does and how that intersects with what we typically consider integration tests. It's advisable to do unit tests for javascript, in a scenario that you can run against various browsers potentially (using selenium-webdriver you can accomplish this).
Anyway, javascript unit specs are blazingly fast in comparison to capybara/cucumber/etc and allow you to cover more cases without having to have a unique integration feature for each one, and is just another layer for you to utilize for good coverage and good speed.
I'm trying to write a Javascript spec for my Rails 3.2 application using Teaspoon (the Jasmine version). I'm trying to write a spec that does something like this
However, require('webpage') doesn't run (Error: Module name "system" has not been loaded yet for context) even though the Requirejs gem has been installed and can be accessed from the Chrome console.
My question is, can I easily get require('webpage') to run using Rails or should I be using something else? Is it maybe easier to just use Capybara since so far I've been using
without any problems. I would however prefer using pure Javascript since in this case it's more convenient. What do you guys think? Thanks!
(Copied my question from stackoverflow.com (http://stackoverflow.com/questions/28968231/visit-pages-using-phantomjs-directly-when-writing-specs-with-teaspoon-jasmine)