--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-co...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Wellllll… make Jasmine optional and I'm a happy camper :)
> On Wed, Aug 31, 2011 at 3:10 PM, Wael Nasreddine
> <wael.na...@gmail.com> wrote:
>> +1 too, jasmine for unit testing and capybara for integration tests
>
> Wellllll… make Jasmine optional and I'm a happy camper :)
From our experience with all rails features, rspec, test-unit, haml,
erb etc.. I don't think anything would be mandatory, but instead
through generators and we choose whatever we want... Anyway Jasmine is
my preference for unit testing and what i said is mere suggestion :)
Wael
When you do that, it would be similar to not adding tests on generators or not providing Coffeescript or SASS support in a default new Rails application.
I doubt Coffeescript would be largely used if not included in Rails by default. I prefer Rspec over Test/Unit but I don't see any problems with Rails shipping the last by default. And there are other test units available too, but Rails chose one anyway... And I agree with that.
The problem is that the message that Rails gives to developers is that Javascript (or Coffeescript) doesn't need to be tested or it would be generated by the generators.
I think that lots of developers would worry more about testing Javascript and organizing their files if Rails guided them how to do that through examples in the generated code.
We don't need to take the best shot now. Anything chosen as default is good as far as we can change the defaults. We would probably have a new book on testing Javascript with Rails showing up soon.
The only dedicated book I know of is the book from my friend at Gitorious AS, Christian Johansen:
http://www.amazon.com/Test-Driven-JavaScript-Development-ebook/dp/B004519O02/ref=tmm_kin_title_0?ie=UTF8&m=AGFP5ZROMRZFO
Did you get my point?
Em 31-08-2011 18:56, Ryan Bigg escreveu:I think due to the large number of testing frameworks out there for JavaScript, we should leave this in the developer's hands and not make it a part of the Rails core.
Hi guys,
While reading the 3.1 release notes in Rails Guides, I've stumbled across this phrase:
"The major change in Rails 3.1 is the Assets Pipeline. It makes CSS and JavaScript first-class code citizens and enables proper organization, including use in plugins and engines."
Then, I started thinking that it might not be really true. I guess, that it is time for Rails to adopt a default testing framework for Javascript (both unit and integration).
There should also exist a Javascript generator that would generate the empty test file too. It would also be interesting if we could generate views with "--include-javascript", which would include a new file, like, for instance, with jQuery:
jQuery(function($){
// place your code here.
})
Is there already something like this in Rails? I don't remember reading anything about Javascript TDD natively with Rails.
It seems like Capybara has became the defacto solution for this kind of test. Maybe it could be the default Javascript test framework (using webkit by default, maybe).
Any thoughts?
Cheers,
Rodrigo.
* Rails ships with Ruby test generators (because testing is good)
* Rails ships with Javascript/Coffeescript generators
* There's no Javascript testing framework in Ruby core, nor Rails.
(testing is only good for Ruby code?)
One of Rails' many opinionated innovations as a framework was that
testing is good, everyone should do it by default, so test code is
included/generated by the framework. I believe it should be just as
opinionated about Javascript testing.
As Rodrigo said, it doesn't matter which framework is used (although
Jasmine is nice and iterates/improves upon several earlier tools). The
important thing is to send the message that Javascript can and should
be tested.
-- Chad
A few relevant links:
http://pivotallabs.com/users/mgehard/blog/articles/1683-using-jasmine-to-test-coffeescript-in-a-rails-3-1-app
http://pivotallabs.com/users/jdean/blog/articles/1778
http://gilesbowkett.blogspot.com/2011/08/tdd-in-javascript-no-excuses.html
It's easily the best test framework for JavaScript. I wrote a wrapper
around it called Evergreen, which has gained a little traction. You
should check it out for inspiration I think, since it does a lot of
things very differently than most other similar libraries. I think
it's far superior to e.g. the jasmine gem.
It doesn't yet work with the asset pipeline, since I've been holding
off for the official Rails 3.1 release. So asset pipeline support will
be there soon.
I'm not really campaigning for this to be included in Rails, honestly
I think I prefer it as a separate library, but if you do go down that
route, at least check out the concepts around which Evergreen is
built. I think it has a much better out-of-the-box experience than
pretty much anything else out there.
https://github.com/jnicklas/evergreen
/Jonas
Sent from my iPhone
+1 to TDD for js, and +1 to Jasmine - I've been test driving js for a
few years now and Jasmine is a nice tool, probably the best I've used.
It's high time folks were encouraged to write real unit tests for js
rather than use Selenium/Sahi/etc.
Best,
Sidu Ponnappa.
http://c42.in
http://blog.sidu.in
I think the appropriate question to ask is "of Rails developers unit testing their javascript, who is *not* using Jasmine"I definitely get the impression that* most people are not unit testing their javascript application code, instead relying on integration tests to catch errors* among those who do, jasmine is the most frequently used.I happen to use Jasmine, but I'm not particuarly wild about it. I'd be interested in what over people use, but I suspect Jasmine is it.Although there are a *lot* of javascript testing libraries, there isn't much consensus among javascripters which one(s) to use. As a result, they all suffer from the lack of support and tooling. Each library seems to be missing key features. Major framework support of one of them (Jasmine or not) would hopefully catapult one to the forefront.+1 for any damn thing.