@Ian, no worries. I stick the call to initEvents in a separate file and
then include it in script tags. The $(document).ready call ensures the DOM
is loaded first, in case the <script src="init_events.js"> tags move up to
the <head> section.
As for $('a.hello_world').click(...) vs "a.hello_world:click", I guess it's
a matter of preference.
I really like applying events like lowpro's Event.addBehavior (
http://www.danwebb.net/2006/9/3/low-pro-unobtrusive-scripting-for-prototype)
and Justin Palmer's CSS event:selectors (
http://alternateidea.com/event-selectors/).
But that's coming from two different libraries, so of course it might not be
jQuery's philosophy =].
- Hugh
On Jan 30, 2008 10:23 AM, Adam Grant <[EMAIL PROTECTED]> wrote:
> RSpec-ers pissed with the long stack trace? From Matt's Rails on the Run (
> http://railsontherun.com/2008/1/30/misc-tips-and-tricks)
>
> (Start Quote)
> "Now, few people complained to me about Rspec failures outputting the full
> stack trace such as:
>
> The Sessions controller should fail since it's a test' FAILED
> expected true, got false
> test_app-git/trunk/vendor/plugins/rspec/lib/spec/expectations.rb:52:in
> `fail_with'
>
> test_app-git/trunk/vendor/plugins/rspec/lib/spec/expectations/handler.rb:21:in
> `handle_matcher'
>
> test_app-git/trunk/vendor/plugins/rspec/lib/spec/expectations/extensions/object.rb:34:in
> `should'
> ./spec/controllers/sessions_controller_spec.rb:25:
>
> test_app-git/trunk/vendor/plugins/rspec/lib/spec/example/example_methods.rb:78:in
> `instance_eval'
>
> test_app-git/trunk/vendor/plugins/rspec/lib/spec/example/example_methods.rb:78:in
> `run_with_description_capturing'
>
> test_app-git/trunk/vendor/plugins/rspec/lib/spec/example/example_methods.rb:19:in
> `execute'
> /opt/local/lib/ruby/1.8/timeout.rb:48:in `timeout'
>
> test_app-git/trunk/vendor/plugins/rspec/lib/spec/example/example_methods.rb:16:in
> `execute'
>
> test_app-git/trunk/vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:288:in
> `execute_examples'
>
> test_app-git/trunk/vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:287:in
> `each'
>
> test_app-git/trunk/vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:287:in
> `execute_examples'
>
> test_app-git/trunk/vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:121:in
> `run'
>
> test_app-git/trunk/vendor/plugins/rspec/lib/spec/runner/example_group_runner.rb:22:in
> `run'
>
> test_app-git/trunk/vendor/plugins/rspec/lib/spec/runner/example_group_runner.rb:21:in
> `each'
>
> test_app-git/trunk/vendor/plugins/rspec/lib/spec/runner/example_group_runner.rb:21:in
> `run'
> test_app-git/trunk/vendor/plugins/rspec/lib/spec/runner/options.rb:89:in
> `run_examples'
>
> test_app-git/trunk/vendor/plugins/rspec/lib/spec/runner/command_line.rb:19:in
> `run'
> script/spec:4:
>
> Finished in 6.035147 seconds
>
> 400 examples, 1 failure
>
>
> We can really easily change that, open you spec.opts file located in your
> spec folder.
>
> it probably looks like that:
> --colour
>
> --format
> progress
> --loadby
> mtime
> --reverse
> --backtrace
>
>
> Get rid of "--backtrace" and your new failure should look like:
>
> )
> 'The Sessions controller The Sessions controller should fail since it's a
> test' FAILED
> expected false, got true
> ./spec/controllers/sessions_controller_spec.rb:25:
> script/spec:4:
>
> Finished in 0.269956 seconds
>
> 15 examples, 1 failure
>
> (End Quote)
>
> Thanks Matt! I've been needing that trick for a while! You da man, man. I
> may actually start using Rspec now!
>
> PS: I just started learning ExtJS, which seems super awesome. So I may try
> to do a talk at some upcoming SD ruby meeting after I get a chance to play
> with it :)
>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby
-~----------~----~----~----~------~----~------~--~---