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 <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.



On 31/08/2011, at 23:06, Rodrigo Rosenfeld Rosas <[email protected] <mailto:[email protected]>> wrote:

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 makesCSSand 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.

--
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.

Reply via email to