Tuesday July 01, 2008
Replacing the original auto-play movie with the youtube version (as mentioned in the comments):
Currently planned to be released on Jul 11!
Technorati: apple
iphone
Posted by Arun Gupta in Finance | Comments[1]
|
|
|
|
| TOTD# 36: Writing First Test for a Rails Application
I've created a Rails "Hello World" app numerous
times. But I decided to write a simple using the testing
framework provided by Rails. This blog explains my experience of
writing such a test.
| ~/samples/jruby/test
>~/testbed/jruby-1.1.2/bin/jruby
-S rails helloworld
create create app/controllers create app/helpers create app/models create app/views/layouts create config/environments create config/initializers . . . create log/production.log create log/development.log create log/test.log |
| ~/samples/jruby/test/helloworld >~/testbed/jruby-1.1.2/bin/jruby script/generate controller home index |
| JRuby
limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL /Users/arungupta/testbed/jruby-1.1.2/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:278:in `load_missing_constant': uninitialized constant ActiveRecord (NameError) from /Users/arungupta/testbed/jruby-1.1.2/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:467:in `const_missing' from /Users/arungupta/testbed/jruby-1.1.2/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:479:in `const_missing' from /Users/arungupta/samples/jruby/test/helloworld/config/initializers/new_rails_defaults.rb:5:in `/Users/arungupta/samples/jruby/test/helloworld/config/initializers/new_rails_defaults.rb' from /Users/arungupta/samples/jruby/test/helloworld/config/initializers/new_rails_defaults.rb:502:in `load' from /Users/arungupta/testbed/jruby-1.1.2/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:502:in `load' from /Users/arungupta/testbed/jruby-1.1.2/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in `new_constants_in' from /Users/arungupta/testbed/jruby-1.1.2/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:502:in `load' from /Users/arungupta/testbed/jruby-1.1.2/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/initializer.rb:475:in `load_application_initializers' ... 8 levels... from /Users/arungupta/testbed/jruby-1.1.2/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/commands/generate.rb:27:in `require' from /Users/arungupta/testbed/jruby-1.1.2/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require' from script/generate:3 |
| if defined?(ActiveRecord) # Include Active Record class name as root for JSON serialized output. ActiveRecord::Base.include_root_in_json = true # Store the full class name (including module namespace) in STI type column. ActiveRecord::Base.store_full_sti_class = true end |
| ~/samples/jruby/test/helloworld
>~/testbed/jruby-1.1.2/bin/jruby
script/generate controller home index JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL exists app/controllers/ exists app/helpers/ create app/views/home exists test/functional/ create app/controllers/home_controller.rb create test/functional/home_controller_test.rb create app/helpers/home_helper.rb create app/views/home/index.html.erb |
| ~/workspaces/glassfish-scripting/rails/v3/src/test/rails
>~/testbed/jruby-1.1.2/bin/jruby
-S glassfish_rails helloworld Jun 27, 2008 2:46:18 PM com.sun.enterprise.glassfish.bootstrap.ASMain main INFO: Launching GlassFish on HK2 platform Jun 27, 2008 2:46:18 PM com.sun.enterprise.glassfish.bootstrap.ASMainHK2 findDerbyClient INFO: Cannot find javadb client jar file, jdbc driver not available Jun 27, 2008 2:46:18 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start INFO: Listening on port 3000 Jun 27, 2008 2:46:18 PM com.sun.enterprise.v3.services.impl.GrizzlyEmbeddedHttpConfigurator configureSSL WARNING: pewebcontainer.all_ssl_protocols_disabled Jun 27, 2008 2:46:18 PM com.sun.enterprise.v3.services.impl.GrizzlyEmbeddedHttpConfigurator configureSSL WARNING: pewebcontainer.all_ssl_ciphers_disabled Jun 27, 2008 2:46:19 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start INFO: Listening on port 3131 Jun 27, 2008 2:46:19 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start INFO: Listening on port 3838 Jun 27, 2008 2:46:19 PM com.sun.enterprise.v3.admin.adapter.AdminConsoleAdapter setContextRoot INFO: Admin Console Adapter: context root: /admin Jun 27, 2008 2:46:19 PM com.sun.grizzly.jruby.RailsAdapter startRubyRuntimePool INFO: Starting Rails instances Jun 27, 2008 2:46:24 PM SEVERE: JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL Jun 27, 2008 2:46:24 PM com.sun.grizzly.jruby.RubyObjectPool$1 run INFO: JRuby and Rails instance instantiation took : 5169ms Jun 27, 2008 2:46:24 PM org.glassfish.scripting.rails.RailsDeployer load INFO: Loading application helloworld at / Jun 27, 2008 2:46:24 PM com.sun.enterprise.v3.server.AppServerStartup run INFO: Glassfish v3 started in 6419 ms Jun 27, 2008 2:46:28 PM com.sun.grizzly.jruby.RailsAdapter$Logger log INFO: |
| require 'home_controller' class HomeControllerTest < ActionController::TestCase def test_index get :index assert_response :success end end |
| ~/workspaces/glassfish-scripting/rails/v3/src/test/rails/helloworld
>~/testbed/jruby-1.1.2/bin/jruby
-S rake test (in /Users/arungupta/workspaces/glassfish-scripting/rails/v3/src/test/rails/helloworld) /Users/arungupta/testbed/jruby-1.1.2/bin/jruby -Ilib:test "/Users/arungupta/testbed/jruby-1.1.2/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake/rake_test_loader.rb" /Users/arungupta/testbed/jruby-1.1.2/bin/jruby -Ilib:test "/Users/arungupta/testbed/jruby-1.1.2/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake/rake_test_loader.rb" "test/functional/home_controller_test.rb" JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL Loaded suite /Users/arungupta/testbed/jruby-1.1.2/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake/rake_test_loader Started . Finished in 0.308 seconds. 1 tests, 1 assertions, 0 failures, 0 errors /Users/arungupta/testbed/jruby-1.1.2/bin/jruby -Ilib:test "/Users/arungupta/testbed/jruby-1.1.2/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake/rake_test_loader.rb" |
Please leave suggestions on other TOTD (Tip Of The Day) that you'd like to see. A complete archive is available here.
Technorati: rubyonrails jruby ruby glassfish totdPosted by Arun Gupta in web2.0 | Comments[0]
|
|
|
|
|
Today's Page Hits: 3466
Total # blog entries: 1002