Wednesday, May 13, 2009

My RailsSpace Journey - Day 11

  1. Starting Chapter 11 (Searching and Browsing)
  2. Checked website and it appears okay.
  3. Created and filled-in views/community/_search_form.rhtml file and ran "rake" and all tests passed. (11.1/p.328)
  4. Created and filled-in views/community/search.rhtml file and ran "rake" and all tests passed. (11.1/p.328)
  5. Brought up Figure 11.1 (web page) and it worked. (F11.1/p.330)
  6. Installed ferret gem (0.11.5 - x86-mswin32) downloading it and installing it with "--local". (p.330)
  7. Ran this to install plugin (p.331): ruby script/plugin install svn://projects.jkraemer.net/acts_as_ferret/tags/stable/acts_as_ferret
  8. Tried to run "rake', but it was broken with this error msg: no such file to load -- ferret_ext (p.332)
  9. Updated models/spec.rb and ran "rake", but still broken. (11.4/p.332)
  10. Updated models/faq.rb and ran "rake", but still broken. (11.5/p.332)
  11. So I did this:
    problem solved, for those poor Windows users like me:
    1) gem install ferret -v=0.11.5 --platform mswin32
    2) gem install acts_as_ferret
    3) add "require 'acts_as_ferret'" in config/environment.rb
    4) from C:\ruby\lib\ruby\gems\1.8\gems\ferret-0.11.5-x86-mswin32\ext
    copy/paste ferret_ext.so to
    C:\ruby\lib\ruby\gems\1.8\gems\ferret-0.11.5-x86-mswin32\lib
  12. Tried step 11 and DID NOT WORK for me.

Monday, May 11, 2009

My RailsSpace Journey - Day 10

  1. Starting Chapter 10 (Community).
  2. Checked website and it appears okay.
  3. Created Community controller with 3 views (index, browse, search). Had to rename the "html.erb" to "rhtml" suffixes on the views. (p.303-304)
  4. Updated views/layouts/application.rhtml file and ran "rake" and all tests passed (18,110,0,0) (26,132,,0,0) (1,2,0,0). (10.1/p.304)
  5. Created lib/tasks/sample_data.rake file. (10.2/p.306)
  6. Ran this: $ rake db:sample_data:load (p.307) and got this:
    (in C:/cygwin/home/jasnow/SPACE-RAILSSPACE/railsspace)
    Loaded data from users.yml
    Loaded data from specs.yml
    Loaded data from faqs.yml
  7. Checked config/routes.rb in Listing 10.3 with current version. Looked OK, so no change. (10.3/p.309)
  8. Updated community_controller.rb file and ran "rake" and all tests passed. (10.4/p.312)
  9. Updated views/community/index.rhtml file and ran "rake" and all tests passed. (10.5/p.313)
  10. Updated public/stylesheets/site.css file and ran "rake" and all tests passed. (10.6/p.315)
  11. Brought up Figure 10.2 (web page) and it worked. WOW!!! (F10.2/p.316)
  12. Updated views/community/index.rhtml file and ran "rake" and all tests passed. (10.7/p.316)
  13. Created and filled in views/community/_user_table.rhtml file and ran "rake" and all tests passed. (10.8/p.316)
  14. Checked config/routes.rb in Listing 10.9 with current version. Looked OK, so no change. (10.9/p.317)
  15. Updated models/user.rb file and ran "rake" and all tests passed. (10.10/p.317)
  16. Updated models/spec.rb file and ran "rake" and all tests passed. (10.11/p.318)
    17. Updated public/stylesheets/site.css file and ran "rake" and all tests passed. (10.12/p.318)
  17. Brought up Figure 10.3 (web page) (also Figure 10.1) and it worked for "S" (Snow"). WOW!!! (F10.3, F10.1/p.318,308)
  18. Updated helpers/application_helper.rb file and ran "rake" and all tests passed. (10.13/p.320)
  19. Changed one line (map.connect '', :controller => 'site', :action => 'index', :id => nil) in config/routes.rb file, RESTARTED SERVER, and ran "rake" and all tests passed. (10.14/p.320)
  20. Brought up Figure 10.4 (web page)) and it worked for "S" (Snow"). (F10.4/p.320)
  21. SKIPPING SECTION 10.4.1 (Adding pagination) because I had problems with plugin. (10.15,10.16, 10.17,10.18/p.321-323)
  22. Solution: http://blog.railsspace.com/past/2008/1/31/railsspace_will_paginate/
  23. Created and filled in views/community/_result_summary.rhtml file and ran "rake" and all tests passed. (10.19/p.323)
  24. Updated views/community/index.rhtml file and ran "rake" and all tests passed. (10.20/p.325)
  25. End of Chapter 10 (no pagination), so pushed the code to github.com/jasnow/railsspace. (p.325)




Sunday, May 10, 2009

My RailsSpace Journey - Day 9

  1. Starting Chapter 10 (Community).
  2. Created Community controller with 3 views (index, browse, search). Had to rename the "html.erb" to "rhtml" suffix on the views. (p.303-304)
  3. Updated views/layouts/application.rhtml file and ran "rake" and all tests passed (18,110,0,0) (26,132,,0,0) (1,2,0,0). (10.1/p.304)
  4. Created new directory, lib/tasks/sample/data. (p.305)
  5. Created lib/tasks/sample_data.rake file. (10.2/p.306)
  6. Ran this: $ rake db:sample_data:load (p.307) and got this:
    (in C:/cygwin/home/jasnow/SPACE-RAILSSPACE/railsspace)
    Loaded data from users.yml
    Loaded data from specs.yml
    Loaded data from faqs.yml
  7. Checked config/routes.rb in Listing 10.3 with current version. Looked OK, so no change. (10.3/p.309)
  8. Updated community_controller.rb file and ran "rake" and all tests passed. (10.4/p.312)
  9. Updated views/community/index.rhtml file and ran "rake" and all tests passed. (10.5/p.313)
  10. Updated public/stylesheets/site.css file and ran "rake" and all tests passed. (10.6/p.315)
  11. Brought up Figure 10.2 (web page) and it worked. WOW!!! (F10.2/p.316)
  12. Updated views/community/index.rhtml file and ran "rake" and all tests passed. (10.7/p.316)
  13. Created and filled in views/community/_user_table.rhtml file and ran "rake" and all tests passed. (10.8/p.316)
  14. Checked config/routes.rb in Listing 10.9 with current version. Looked OK, so no change. (10.9/p.317)
  15. Updated models/user.rb file and ran "rake" and all tests passed. (10.10/p.317)
  16. Updated models/spec.rb file and ran "rake" and all tests passed. (10.11/p.318)
  17. Updated public/stylesheets/site.css file and ran "rake" and all tests passed. (10.12/p.318)
  18. Brought up Figure 10.3 (web page) (also Figure 10.1) and it worked for "S" (Snow"). WOW!!! (F10.3, F10.1/p.318,308)
  19. Updated helpers/application_helper.rb file and ran "rake" and all tests passed. (10.13/p.320)
  20. Changed one line ( map.connect '', :controller => 'site', :action => 'index', :id => nil) in config/routes.rb file and ran "rake" and all tests passed. (10.14/p.320)
  21. Brought up Figure 10.4 (web page)) and it worked for "S" (Snow"). (F10.4/p.320)
  22. Updated community_controller.rb file TWICE and ran "rake" both times and all tests passed. (10.15,10.16/p.322)
  23. Updated helpers/application_helper.rb file and ran "rake" and all tests passed. (10.17/p.322)
  24. Updated views/community/_user_table.rhtml file and ran "rake" and all tests passed. (10.18/p.323)
  25. Created and filled in views/community/_result_summary.rhtml file and ran "rake" and all tests passed. (10.19/p.323)
  26. Updated views/community/index.rhtml file and ran "rake" and all tests passed. (10.20/p.325)
  27. Ran "http://localhost:3000/community/index/S" and got this error:
    undefined method `paginate' for #
  28. So I googled for an answer and got this. Ran this: ./script/plugin install svn://errtheblog.com/svn/plugins/classic_pagination
  29. Had problems with solution so went bad to hopefuly good Listing 10.15 for community_controller.rb. (p.322)
  30. Reversed Listing 10.17 for helpers/application_helper.rb. (p.322)
  31. ROLLED BACKED sections 10.4.1 (Adding pagination) and 10.4.2 (A results summary) (last 2 sections in chapter 10). (p.321-325) Summary: 10.16 => 10.4; 10.17 => 10.13; 10.18 => 10.8; 10.20 => 10.7.
  32. RESTORED END OF CHAPTER 9 FILES AND WEB PAGE WORKS AGAIN.
  33. START CHAPTER 10 again tomorrow.

Saturday, May 9, 2009

My RailsSpace Journey - Day 8 - Chapter 9

  1. Starting Chapter 9 (Personal Profiles).
  2. Created Profile controller with 2 actions (index, show). (p.257)
  3. Edited the config/routes.rb file. (9.1/p.257-258)
  4. Edited the profile_controller. (9.2/p.258)
  5. Edited two views: show.rhtml, index.rhtml (9.3,9.4/p.259)
  6. Created and edited Spec model (migration). Then do the migration/Done. (9.5/p.260-262)
  7. Edited models/spec.rb. (9.6/p.262)
  8. Edited config/environment.rb (9.7/p.263)
  9. Tried to run user_controller_tests and it is broken.
  10. Edited models/user.rb. (9.8/p.265)
  11. Edited models/spec.rb. (9.9/p.265)
  12. Repeated step 2 (new Profile controller) Ran "rake"/Worked.
  13. SKIPPED STEP 3 (routes.rb). DID NOT CHANGE config/routes.rb. ######
  14. Repeated step 4 (profile_controller). Ran "rake"/Worked.
  15. Repeated step 5 (2 views). Ran "rake"/Worked.
  16. Repeated step 6 (new Spec model). Skipped the migration because I did it before. Also had to delete the Migration I just created, but did not want to use because rake would not run until migration was done. Ran 'rake"/Worked. Got extra test.
  17. Repeated step 7 (edited spec model). Ran "rake"/Worked.
  18. SKIPPED STEP 8 (environment.rb). DID NOT CHANGE config/ environment.rb.
  19. Could not continue safety with chapter 9 so I stopped for lunch and study group.
  20. Later I went back and read the whole chapter and marked it up.
  21. Brought up the project. Walked successfully thru the top level windows and ran "rake" (all the tests). All tests (11,54,0,0) (19,94,0,0) (1,2,0,0) ran cleanly.
  22. So starting Chapter 9 again.
  23. step 2: Profile controller is already created, so skipped. (p.257)
  24. step 4: profile_controller has already be edited, so skipped. (9.2/p.258)
  25. step 5: Two views has already be edited, so skipped. (9.3,9.4/p.259)
  26. step 6: Spec model already been created/migrated, so skipped. (9.5/p.260-261)
  27. step 7; Spec.rb already been edited, so skipped. (9.6/p.262)
  28. step 3: YES, I edited the new lines into config/routes.rb file and commented out the old lines. Then ran "rake" and all tests passed. (9.1/p.257)
  29. Brought up Figure 9.1 (web page) and it worked. WOW!!! (F9.1/p.254)
  30. step 8+9: YES, I edited (added one line: DB_STRING_MAX_LENGTH = 255) to end of config/environment.rb file. THE TRICK WAS NOT DOING THIS STEP AS A CUT-AND-PASTE. Restarted web server and then ran "rake" (step 9) and all tests passed. (9.7/p.263)
  31. Brought up Figure 9.2 (bad user) (web page) and it worked. WOW!!! (F9.2/p.259-260)
  32. step 10: Repeated edit on models/user.rb and then ran "rake" and all tests passed. (9.8/p.265)
  33. step 11: Repeated edit on models/spec.rb and then ran "rake" and all tests passed. (9.9/p.265)
  34. Created new Spec controller with 2 views (index, edit) and then ran "rake" and all tests passed. (p.266)
  35. Edited application.rb controller and then ran "rake" and all tests passed. NOTE: Got one new test and one new assertion. (9.10/p.266-267)
  36. Filled out new spec_controller.rb file and then ran "rake" and all tests passed. (9.11/p.267)
  37. Edit helpers/applcation_helper.rb file and then ran "rake" and all tests passed. (9.12/p.269)
  38. Edited (added one line: HTML_TEXT_FIELD_SIZE = 15) to end of config/environment.rb file. Restarted web server and then ran "rake" and all tests passed. (9.13/p.269-270)
  39. Filled out new view/spec/edit.rhtml file and then ran "rake" and all tests passed. (9.14/p.270-271)
  40. Brought up Figure 9.3(web page) and it worked ONCE I LOGGED IN. WOW!!! (F9.3/p.271)
  41. Tried Figure 9.4(web page) and it worked sort of (less params). (F9.4/p.272)
  42. Edited application.rb controller and then ran "rake" and all tests passed. (9.15/p.272-273)
  43. Edited spec_controller.rb file and then ran "rake" and all tests passed. (9.16/p.273)
  44. Edited spec_controller_test.rb file and then ran "rake" and all tests but 5 assertions passed. Also got 5 new tests, s9 (11,54,0,0) (24,94,0,5)(1,2,0). (9.17/p.273-274)
  45. Edited test/test_helper.rb file and ran "rake" and got same results as step 44. (9.18/p.275)
  46. Filled out test/fixtures/specs.yml file and then ran "rake" and all tests passed with some new numbers (11,54,0,0) (24,127,0,0)(1,2,0). (9.19/p.275) FIXED
  47. Filled out new test/unit/spec_test.rb and then ran "rake" and all tests passed with some new numbers (17,83,0,0) (24,127,0,0)(1,2,0). (9.20/p.276)
  48. Edited user_controller.rb and then ran "rake" and all tests passed with 3 new assertions (17,83,0,0) (24,130,0,0)(1,2,0). (9.21/p.277)
  49. Edited models/spec.rb file and then ran "rake" and all tests passed (9.22/p.277)
  50. Edited views/layouts/application.rhtml file and some middle tests failed (24,89,8,0) (9.23/p.278)
  51. Repeated previous step because I mis-cut-pasted it and ran rake and all tests passed. (9.23/p.278)
  52. Created and filled in brand new public/stylesheets/profile.css file and ran rake and all tests passed (same numbers). (9.24/p.278)
  53. Created and filled in brand new (I THINK) views/user/index.rhtml file and ran rake and all tests passed (same numbers). (9.25/p.279)
  54. Edited views/user/index.rhtml file and ran rake and all tests passed (same numbers). (9.26/p.281)
  55. Created and filled in views/spec/_field_row.rhtml partial file and all tests passed (same numbers). (9.27/p.281)
  56. I renamed views/user/index.html.erb to hid_index.html.erb and refreshed hub page and got Figure 9.5(web page) and also Figure 9.6 (web page) with the "Empty right column, for now" (F9.5/p.280) so somewhere a long the way index.html.erb went away. Then ran "rake" and all tests passed (same numbers). (9.27, F9.5, F9.6/p.281-282)
  57. Edited (changed one word: s/map.connect/map.profile/) in config/routes.rb file. Restarted web server and then ran "rake" and all tests passed. (9.28/p.283)
  58. Filled in app/helpers/profile_helper.rb file, restarted web server and then ran "rake" and all tests passed. (9.28/p.283)
  59. Edited app/helpers/profile_helper.rb file and then ran "rake" and all tests passed. (9.29/p.284)
  60. Edited user_controller.rb file and then ran "rake" and all tests passed. (9.29.5/SEE ERATA/see bottom of p.284)
  61. Edited views/user/index.rthml file and then ran "rake" and some middle tests failed (24,125,0,2). (9.30/p.285-286)
  62. Edited public/stylesheets/profile.css file and then ran "rake" and some middle tests failed (24,125,0,2). (9.31/p.286)
  63. Created and filled in lib/string.rb file and ran "rake" and got same results as previous step. (9.32/p.287)
  64. Edited app/helpers/application_helper.rb file and ran "rake" and all tests passed. (9.33/p.287) FIXED
  65. Brought up Figure 9.7 (web page) and it worked. WOW!!! (F9.7/p.289)
  66. Created new Faq model. (p.288)
  67. Filled in migration script (....create faqs.rb) and ran "rake" and all tests passed. Got one new test and one new assertion. (9.34/p.289)
  68. Filled in new Faq model and ran "rake" and got same results as previous step. (9.35/p.290)
  69. Edited (added one line: DB_TEXT_MAX_LENGTH = 40000) to end of config/environment.rb file. Restarted web server and then ran "rake" and all tests passed. (9.36/p.290)
  70. Created new Faq controller with 2 views (index, edit). (p.292)
  71. Filled in new faq_controller.rb file and ran "rake" and all tests passed. Got one new middle test and one new middle assertion. (9.35/p.290)
  72. Edited (added one line: map.hub 'user', :controller => 'user', :action => 'index') in config/routes.rb file. Restarted web server and then ran "rake" and all tests passed as previous step. (9.39/p.292)
  73. Filled in new faq_controller.rb file and ran "rake" and all tests passed. (9.40/p.293)
  74. Filled in new views/faq/edit.rhtml file and ran "rake" and all tests passed. (9.41/p.293)
  75. Created and filled in views/faq/_answer_text_area.rhtml file and ran "rake" and all tests passed. (9.42/p.294)
  76. Updated public/stylesheets/profile.css and ran "rake" and all tests passed. (9.43/p.294)
  77. Updated user_controller.rb file and ran "rake" and all tests passed. (9.44/p.295)
  78. Updated user_controller.rb file again and ran "rake" and all tests passed. (9.45/p.296)
  79. Filled in new views/user/index.rhtml file and ran "rake" and all tests passed except 2 assertions. (9.46/p.296)
  80. Created and filled in views/faq/_sidebar_box.rhtml file and all tests passed. (9.47/p.297) FIXED
  81. Filled test/fixtures/faqs.yml file. (9.48/p.298)
  82. Filled in test/unit/faq.rb file and ran "rake" and all tests (18,110,0,0) (25,131,0,0) (1,2,0,0) passed. (9.49/p.299)
  83. Update profile_controller.rb file and ran "rake" and all tests passed. (9.50/p.300)
  84. Update helpers/profile_helper.rb file and ran "rake" and all tests passed. (9.51/p.300)
  85. Filled in views/profile/show.rhtml file and ran "rake" and all tests passed. (9.52/p.301)
  86. End of Chapter 10 so I pushed it to github.com.

My RailsSpace Journey - Day 8

  1. LOST ALL OF CHAPTER 7 BLOG ENTRIES. ALL CLEAN AND IN GITHUB.
  2. Starting Chapter 8. (p.225)
  3. Ran "ruby test/functional/user_controller_test.rb" (14,82,0,0) (8.1/p.226)
  4. Ran "ruby test/functional/user_controller_test.rb" (14,82,0,0) (8.2/p.226)
  5. Ran "ruby test/functional/user_controller_test.rb" (14,82,0,0) (8.3/p.226-227)
  6. Ran "ruby test/functional/user_controller_test.rb" (14,82,0,0) (8.4/p.227-228)
  7. Ran "ruby test/functional/user_controller_test.rb" (14,82,0,0) (8.5/p.229)
  8. Ran "ruby test/functional/user_controller_test.rb" (14,82,0,0) (8.6/p.230)
  9. Ran "ruby test/functional/user_controller_test.rb" (14,82,0,0) (8.7/p.231)
  10. Ran "ruby test/functional/user_controller_test.rb" (14,82,0,0) (8.8/p.232)
  11. Ran "ruby test/functional/user_controller_test.rb" (14,82,0,0) (8.9/p.233)
  12. Walked through the login and edit window and they appear solid. (8.10/p.234)
  13. Ran "ruby test/functional/user_controller_test.rb" (14,82,0,0) (8.11/p.236)
  14. Ran "ruby test/functional/user_controller_test.rb" (14,82,0,0) (8.12/p.236)
  15. Ran "ruby test/functional/user_controller_test.rb" (14,82,0,0) (8.13/p.237)
  16. Ran "ruby test/functional/user_controller_test.rb" (14,82,0,0) (8.14/p.239)
  17. Ran "ruby test/functional/user_controller_test.rb" (14,82,0,0) (8.15/p.240)
  18. BREAK STUFF - i think.
  19. Ran "ruby test/functional/user_controller_test.rb" (13,71,1,0) (8.16/p.240-241)
  20. Ran "ruby test/functional/user_controller_test.rb" (13,71,1,0) (8.17/p.241)
  21. Ran "ruby test/functional/user_controller_test.rb" (13,67,0,1) (8.18/p.242-243)
  22. Ran "ruby test/functional/user_controller_test.rb" (14,80,0,0) (8.19/p.242-243) FIXED
  23. Ran "ruby test/unit/user_test.rb" (12,53,0,0) (8.20/p.243)
  24. Ran "ruby test/unit/user_test.rb" (12,53,0,0) (8.21/p.244)
  25. Ran "ruby test/unit/user_test.rb" (12,53,0,0) (8.22/p.245)
  26. BREAK STUFF AGAIN.
  27. Created thre new (8.23: _email_field_row,rhtml, 8.24: _screen_name_field_row.rhtml, 8.27,8.29: _password_field_row.rhtml) partials and modified three (8.25,8.30: login.rhtml, 8.26,8.28: edit.rhtml, 8.31: register.rhtml) old partials. (8.28/p.246-249)
  28. Ran "ruby test/functional/user_controller_test.rb" (14,81,0,0) (8.19/p.242-243) FIXED
  29. Ran this; $ rake (p.252) - End of Chapter 8.
    (in C:/cygwin/home/jasnow/SPACE-RAILSSPACE/railsspace)
    C:/DeepDive/InstantRails-2.0-win/ruby/bin/ruby.exe -I"lib;test" "C:/cygdrive/c/deep
    dive/InstantRails-2.0-win/ruby/gems/rake-0.8.5/lib/rake/rake_test_loader.rb" "test/
    unit/user_test.rb"
    Loaded suite C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.5/lib/r
    ake/rake_test_loader
    Started ..........
    Finished in 0.372 seconds.
    10 tests, 53 assertions, 0 failures, 0 errors
    C:/DeepDive/InstantRails-2.0-win/ruby/bin/ruby.exe -I"lib;test" "C:/cygdrive/c/deep
    dive/InstantRails-2.0-win/ruby/gems/rake-0.8.5/lib/rake/rake_test_loader.rb" "test/
    functional/site_controller_test.rb" "test/functional/user_controller_test.rb"
    Loaded suite C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.5/lib/r
    ake/rake_test_loader
    Started ..................
    Finished in 0.594 seconds.
    18 tests, 93 assertions, 0 failures, 0 errors
    C:/DeepDive/InstantRails-2.0-win/ruby/bin/ruby.exe -I"lib;test" "C:/cygdrive/c/deep
    dive/InstantRails-2.0-win/ruby/gems/rake-0.8.5/lib/rake/rake_test_loader.rb" "test/
    integration/remember_me_test.rb"
    Loaded suite C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.5/lib/r
    ake/rake_test_loader
    Started
    1
    42
    1
    .
    Finished in 0.354 seconds.
    1 tests, 2 assertions, 0 failures, 0 errors
  30. End of Chapter 8, so pushed the code to github.com/jasnow/railsspace. (p.252)
  31. #########################################
  32. Moving Chapter 9 stuff to separate blog entry. Bye.

Friday, May 8, 2009

My RailsSpace Journey - Day 7

  1. RailsSpace Journey: As I stated yesterday, I messed up the source code/project so after some consideration, I have decided to start over.
  2. NOTE THAT ALL PAGE NUMBERS ARE FROM RailsSpace Book unless otherwise.
  3. Created a new project, railsspace, inside netbeans. Also deleted railsspace_development and railsspace_test database. (p.16)
  4. Started up server and it worked http://localhost:300/ (p.18)
  5. Created a controller with 3 actions (index, about, help). (p.21)
  6. Fixed routes.rb and deleted public/index.html (p.25-26). Had to rebuild railsspace_development and railsspace_test database, so I did it and web page worked.
  7. End of Chapter 2, so pushed the code to github.com/jasnow/railsspace. (p.41)
  8. git init, git add . , git commit -m "comment" ; git remote add origin git@github.com:jasnow/railsspace.git ; git push origin master
  9. End of Chapter 3, so pushed the code to github.com/jasnow/railsspace. (p.64)
  10. Created user controller with 2 actons (index, register) (p.66)
  11. End of Chapter 4, so pushed the code to github.com/jasnow/railsspace. (p.95)
  12. Ran "rake db:test:prepare" (p.99)
  13. Ran "ruby test/functional/site_controller_test.rb" (1,1,0,0) (p.99)
  14. Ran "ruby test/functional/site_controller_test.rb" (3,7,1,0) (p.101-102)
  15. Ran "ruby test/functional/site_controller_test.rb" (3,9,0,0) (p.102-103)
  16. Ran "rake test:functionals" (4,10,0,0) (p.104)
  17. Ran "ruby test/functional/user_controller_test.rb" (1,3,0,0) (p.104)
  18. Ran "ruby test/functional/user_controller_test.rb" (1,8,0,0) (p.106)
  19. Ran "ruby test/functional/user_controller_test.rb" (2,12,0,0) (p.107)
  20. Ran "ruby test/functional/user_controller_test.rb" (3,210,0) (p.108-109)
  21. Ran "rake test:functionals" (6,30,0,0) (p.110)
  22. Ran "ruby test/unit/user_test.rb" (1,1,0,0) (p.112-113)
  23. Ran "rake test:units" (1,1,0,0) (p.113)
  24. Ran "ruby test/unit/user_test.rb" (2,2,0,0) (p.113)
  25. Ran "ruby test/unit/user_test.rb" (2,5,0,0) (p.114)
  26. Ran "ruby test/unit/user_test.rb" (3,8,0,0) (p.116)
  27. Ran "ruby test/unit/user_test.rb" (5,14,0,0) (p.117)
  28. Ran "ruby test/unit/user_test.rb" (7,20,0,0) (p.120)
  29. Ran "ruby test/unit/user_test.rb" (8,22,0,0) (p.121)
  30. Ran "ruby test/unit/user_test.rb" (9,29,0,0) (p.122)
  31. Ran "ruby test/unit/user_test.rb" (10,47,0,0) (p.123)
  32. Ran "ruby test/unit/user_test.rb" (12,53,0,0) (p.124-125)
  33. Ran "ruby test/unit/user_test.rb" (12,53,0,0) (p.125)
  34. Ran "$rake" (p.128) and got this; C:/DeepDive/InstantRails-2.0-win/ruby/bin/ruby.exe -I"lib;test" "C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.5/lib/rake/rake_test_loader.rb" "test/unit/user_test.rb"
    (in C:/cygwin/home/jasnow/SPACE-RAILSSPACE/railsspace)
    Loaded suite C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.5/lib/rake/rake_test_loader
    Started
    ............
    Finished in 0.407 seconds.
    12 tests, 53 assertions, 0 failures, 0 errors
    C:/DeepDive/InstantRails-2.0-win/ruby/bin/ruby.exe -I"lib;test" "C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.5/lib/rake/rake_test_loader.rb" "test/functional/site_controller_test.rb" "test/functional/user_controller_test.rb"
    Loaded suite C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.5/lib/rake/rake_test_loader
    Started
    ......
    Finished in 0.443 seconds.
    6 tests, 30 assertions, 0 failures, 0 errors
    C:/DeepDive/InstantRails-2.0-win/ruby/bin/ruby.exe -I"lib;test" "C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.5/lib/rake/rake_test_loader.rb"
  35. Then ran this: $ rake stats (p.129)
    (in C:/cygwin/home/jasnow/SPACE-RAILSSPACE/railsspace)
    +----------------------+-------+-------+---------+---------+-----+-------+
    | Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
    +----------------------+-------+-------+---------+---------+-----+-------+
    | Controllers | 47 | 30 | 3 | 5 | 1 | 4 |
    | Helpers | 11 | 10 | 0 | 1 | 0 | 8 |
    | Models | 29 | 23 | 1 | 0 | 0 | 0 |
    | Libraries | 0 | 0 | 0 | 0 | 0 | 0 |
    | Integration tests | 0 | 0 | 0 | 0 | 0 | 0 |
    | Functional tests | 129 | 104 | 4 | 10 | 2 | 8 |
    | Unit tests | 163 | 113 | 1 | 13 | 13 | 6 |
    +----------------------+-------+-------+---------+---------+-----+-------+
    | Total | 379 | 280 | 9 | 29 | 3 | 7 |
    +----------------------+-------+-------+---------+---------+-----+-------+
    Code LOC: 63 Test LOC: 217 Code to Test Ratio: 1:3.4
  36. End of Chapter 5, so pushed the code to github.com/jasnow/railsspace. (p.129)
  37. Ran "rake db:sessions:create" (p.133)
  38. Edited environment.rb. (p.133)
  39. Ran "ruby test/functional/user_controller_test.rb" (3,23,0,0) (p.135)
  40. Ran "ruby test/functional/user_controller_test.rb" (3,23,0,0) (p.143)
  41. Ran "ruby test/functional/user_controller_test.rb" (4,30,0,0) (p.143-144)
  42. Ran "ruby test/functional/user_controller_test.rb" (5,34,0,0) (p.144)
  43. Ran "ruby test/functional/user_controller_test.rb" (7,42,0,0) (p.145)
  44. Ran "rake test:recent" (7,42,0,0) (p.146)
  45. Ran "ruby test/functional/site_controller_test.rb" (4,12,0,0) (p.149)
  46. Ran "ruby test/functional/user_controller_test.rb" (8,47,0,0) (p.149)
  47. Ran "ruby test/functional/user_controller_test.rb" (9,50,0,0) (p.150)
  48. Ran "ruby test/functional/user_controller_test.rb" (9,50,0,0) (p.150)
  49. Ran "ruby test/functional/user_controller_test.rb" (9,50,0,0) (p.151)
  50. Ran "ruby test/functional/user_controller_test.rb" (BROKEN TEST RUN ) (p.152)
  51. Ran "ruby test/functional/user_controller_test.rb" (9,50,0,0) (p.154)
  52. Ran "ruby test/functional/user_controller_test.rb" (10,53,0,0) (p.155)
  53. Ran "ruby test/functional/user_controller_test.rb" (11,55,0,0) (p.155)
  54. Ran "ruby test/functional/user_controller_test.rb" (11,55,0,0) (p.159)
  55. Ran "ruby test/functional/user_controller_test.rb" (11,55,0,0) (p.160-161)
  56. Ran "ruby test/functional/user_controller_test.rb" (11,55,0,0) (p.162)
  57. Ran "ruby test/functional/user_controller_test.rb" (12,61,0,0) (p.162-163)
  58. Ran "ruby test/functional/user_controller_test.rb" (13,66,0,0) (p.163)
  59. Ran "ruby test/functional/user_controller_test.rb" (13,66,0,0) (p.166)
  60. Ran "ruby test/functional/user_controller_test.rb" (13,66,0,0) (p.167)
  61. Ran "ruby test/functional/user_controller_test.rb" (13,67,1,0) (p.167)
  62. Ran "ruby test/functional/user_controller_test.rb" (13,67,1,0) (p.168-169)
  63. Ran "ruby test/functional/user_controller_test.rb" (13,67,1,0) (p.169)
  64. Ran "ruby test/functional/user_controller_test.rb" (13,67,1,0) (p.170)
  65. Ran "ruby test/functional/user_controller_test.rb" (13,67,1,0) (p.170)
  66. Ran "ruby test/functional/user_controller_test.rb" (13,68,0,0) FINALLY FIXED. (p.170)
  67. Ran "ruby test/functional/user_controller_test.rb" (13,68,0,0) (p.172)
  68. Ran "ruby test/functional/user_controller_test.rb" (13,68,0,0) (p.173)
  69. Ran "ruby test/functional/user_controller_test.rb" (13,68,0,0) (p.173)
  70. Ran "ruby test/functional/user_controller_test.rb" (13,68,0,0) (p.174)
  71. Ran "ruby test/functional/user_controller_test.rb" (13,68,0,0) (p.174-175)
  72. Ran "ruby test/functional/user_controller_test.rb" (13,68,1,0) (p.175)
  73. Ran "ruby test/functional/user_controller_test.rb" (13,68,0,0) (p.176) FIXED
  74. Ran "ruby test/functional/user_controller_test.rb" (13,68,0,0) (p.176-177)
  75. Ran "ruby test/functional/user_controller_test.rb" (13,68,0,0) (p.177)
  76. Ran "ruby test/functional/user_controller_test.rb" (13,68,0,0) (p.177)
  77. Ran "ruby test/functional/user_controller_test.rb" (13,68,0,0) (p.178-179)
  78. Then ran this: $ rake
    (in C:/cygwin/home/jasnow/SPACE-RAILSSPACE/railsspace)
    C:/DeepDive/InstantRails-2.0-win/ruby/bin/ruby.exe -I"lib;test" "C:/cygdrive/c/deep
    dive/InstantRails-2.0-win/ruby/gems/rake-0.8.5/lib/rake/rake_test_loader.rb" "test/
    unit/user_test.rb"
    Loaded suite C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.5/lib/r
    ake/rake_test_loader
    Started
    ............
    Finished in 0.413 seconds.
    12 tests, 53 assertions, 0 failures, 0 errors
    C:/DeepDive/InstantRails-2.0-win/ruby/bin/ruby.exe -I"lib;test" "C:/cygdrive/c/deep
    dive/InstantRails-2.0-win/ruby/gems/rake-0.8.5/lib/rake/rake_test_loader.rb" "test/
    functional/site_controller_test.rb" "test/functional/user_controller_test.rb"
    Loaded suite C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.5/lib/r
    ake/rake_test_loader
    Started
    .................
    Finished in 0.523 seconds.
    17 tests, 80 assertions, 0 failures, 0 errors
    C:/DeepDive/InstantRails-2.0-win/ruby/bin/ruby.exe -I"lib;test" "C:/cygdrive/c/deep
    dive/InstantRails-2.0-win/ruby/gems/rake-0.8.5/lib/rake/rake_test_loader.rb"
  79. End of Chapter 6, so pushed the code to github.com/jasnow/railsspace. (p.180)

Thursday, May 7, 2009

My RailsSpace Journey - Day 6

  1. Test suites are broken/must repair and put into git.
  2. So I rolled it back to end of Chapter 7 (I hope). Looks like my environment/configuration is hosed.

Wednesday, May 6, 2009

My RailsSpace Journey - Day 5

  1. RailsSpace Book: Chapter 7 (Advanced Login)
  2. Then updated app/views/user/login.rhtml as specified in Listing 7.1 (p.182).
  3. Listing 7.2 (repeat)
  4. NOT GOING TO REPEAT step 2 style statements going forward.
  5. Ran all the test: $ rake
    (in C:/cygwin/home/jasnow/RAILSPASSION/rails_space)
    C:/DeepDive/InstantRails-2.0-win/ruby/bin/ruby -I"C:/cygwin/home/jasnow/RAILSPASSION/rails_space/lib" -I"C:/cygwin/home/jasnow/RAILSPASSION/rails_space/test" "C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.4/lib/rake/rake_test_loader.rb" "test/unit/user_test.rb"
    Loaded suite C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.4/lib/r
    ake/rake_test_loader
    Started ............
    Finished in 0.339 seconds.
    12 tests, 53 assertions, 0 failures, 0 errors
    C:/DeepDive/InstantRails-2.0-win/ruby/bin/ruby -I"C:/cygwin/home/jasnow/RAILSPASSION/rails_space/lib" -I"C:/cygwin/home/jasnow/RAILSPASSION/rails_space/test" "C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.4/lib/rake/rake_test_loader.rb" "test/functional/site_controller_test.rb" "test/functional/user_controller_test.rb"
    Loaded suite C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.4/lib/r
    ake/rake_test_loader
    Started ..............
    Finished in 0.574 seconds.
    14 tests, 82 assertions, 0 failures, 0 errors
    C:/DeepDive/InstantRails-2.0-win/ruby/bin/ruby -I"C:/cygwin/home/jasnow/RAILSPASSION/rails_space/lib" -I"C:/cygwin/home/jasnow/RAILSPASSION/rails_space/test" "C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.4/lib/rake/rake_test_loader.rb" "test/integration/remember_me_test.rb"
    Loaded suite C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.4/lib/r
    ake/rake_test_loader
    Started
    1
    42
    1
    .
    Finished in 0.344 seconds.
    1 tests, 2 assertions, 0 failures, 0 errors
  6. $ rake stats
    (in C:/cygwin/home/jasnow/RAILSPASSION/rails_space)
    +----------------------+-------+-------+---------+---------+-----+-------+
    | Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
    +----------------------+-------+-------+---------+---------+-----+-------+
    | Controllers | 113 | 89 | 3 | 12 | 4 | 5 |
    | Helpers | 17 | 13 | 0 | 2 | 0 | 4 |
    | Models | 76 | 55 | 1 | 7 | 7 | 5 |
    | Libraries | 0 | 0 | 0 | 0 | 0 | 0 |
    | Integration tests | 28 | 20 | 1 | 2 | 2 | 8 |
    | Functional tests 526 | 396 | 4 | 38 | 9 | 8 |
    | Unit tests | 163 | 113 | 1 | 13 | 13 | 6 |
    +----------------------+-------+-------+---------+---------+-----+-------+
    | Total | 923 | 686 | 10 | 74 | 7 | 7 |
    +----------------------+-------+-------+---------+---------+-----+-------+
    Code LOC: 157 Test LOC: 529 Code to Test Ratio: 1:3.4
  7. End of Chapter 7.
  8. Starting Chapter 8 (Updating user information)
  9. At the end of chapter 8, Ran all the tests: $ rake 2>&1 |tee o_r252b
    C:/DeepDive/InstantRails-2.0-win/ruby/bin/ruby -I"C:/cygwin/home/jasnow/RAILSPASSION/rails_space/lib" -I"C:/cygwin/home/jasnow/RAILSPASSION/rails_space/test" "C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.4/lib/rake/rake_test_loader.rb" "test/unit/user_test.rb"
    (in C:/cygwin/home/jasnow/RAILSPASSION/rails_space)
    Loaded suite C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.4/lib/r
    ake/rake_test_loader
    Started ..........
    Finished in 0.345 seconds.
    10 tests, 53 assertions, 0 failures, 0 errors
    C:/DeepDive/InstantRails-2.0-win/ruby/bin/ruby -I"C:/cygwin/home/jasnow/RAILSPASSION/rails_space/lib" -I"C:/cygwin/home/jasnow/RAILSPASSION/rails_space/test" "C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.4/lib/rake/rake_test_loader.rb" "test/functional/site_controller_test.rb" "test/functional/user_controller_test.rb"
    Loaded suite C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.4/lib/r
    ake/rake_test_loader
    Started ..................
    Finished in 0.517 seconds.
    18 tests, 93 assertions, 0 failures, 0 errors
    C:/DeepDive/InstantRails-2.0-win/ruby/bin/ruby -I"C:/cygwin/home/jasnow/RAILSPASSION/rails_space/lib" -I"C:/cygwin/home/jasnow/RAILSPASSION/rails_space/test" "C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.4/lib/rake/rake_test_loader.rb" "test/integration/remember_me_test.rb"
    Loaded suite C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.4/lib/r
    ake/rake_test_loader
    Started
    1
    42
    1
    .
    Finished in 0.316 seconds.
    1 tests, 2 assertions, 0 failures, 0 errors
  10. End of Chapter 8.
  11. Starting Chapter 9.
  12. Commented out config.action_controller.allow_forgery_protection line in config/environment/test.rb and "RAILS_GEM_VERSION = '1.2.3' unless defined? RAILS_GEM_VERSION" in configuration/environment.rb file.
  13. Test suites are broken/must repair and put into git.

Tuesday, May 5, 2009

My RailsSpace Journey - Day 4 (Continued)

  1. RailsSpace Book: Starting Chapter 6.
  2. Ran this: rake db:sessions:create and got this: (p.133)
    (in C:/cygwin/home/jasnow/RAILSPASSION/rails_space)
    exists db/migrate
    create db/migrate/20090505190833_create_sessions.rb
  3. Uncommented one line in config/environment.rb file (p.133)
  4. Ran this: $ rake db:migrate and got this: (p.133)
    (in C:/cygwin/home/jasnow/RAILSPASSION/rails_space)
    == 20090505190833 CreateSessions: migrating ===================================
    -- create_table(:sessions)
    -> 0.1760s
    -- add_index(:sessions, :session_id)
    -> 0.1570s
    -- add_index(:sessions, :updated_at)
    -> 0.1740s
    == 20090505190833 CreateSessions: migrated (0.5090s) ==========================
  5. Then updated app/controllers/user_controller.rb as specified in Listing 6.1. (p.134)
  6. Then updated test/functional/user_controller_test.rb as specified in Listing 6.2. (p.135) Got this: 3 tests, 23 assertions, 0 failures, 0 errors
  7. Then updated app/views/layouts/application.rhtml as specified on Listing 6.3 . (p.135)
  8. Then updated app/views/layouts/application.rhtml as specified on Listing 6.4 . (p.137)
  9. Then updated public/stylesheets/site.cs as specified on Listing 6.5. (p.138)
  10. Then updated app/views/layouts/application.rhtml as specified on Listing 6.6 . (p.139-140)
  11. Then created app/views/user/login.rthml as specified on Listing 6.7 . (p.140)
  12. Then updated app/controllers/user_controller.rb as specified in Listing 6.8. (p.141)
  13. Tried to run it but got "ActionController::InvalidAuthenticityToken in User#register" so I checked the Errata for Chapter 6 and fixed app/controllers/application.rb. (#3). Used foobar/bazquux and logined in successfully.
  14. Then updated test/functional/user_controller_test.rb as specified on Listing 6.9. (p.143) Got this: 3 tests, 23 assertions, 0 failures, 0 errors
  15. Then updated test/functional/user_controller_test.rb as specified on Listing 6.10. (p.143-144) Got this: 4 tests, 30 assertions, 0 failures, 0 errors
  16. Then updated test/functional/user_controller_test.rb as specified on Listing 6.11. (p.144) Got this: 5 tests, 39 assertions, 0 failures, 0 errors
  17. Then updated app/controllers/user_controller.rb as specified in Listing 6.12. (p.145) Then ran the tests and they worked.
  18. Then updated app/controllers/user_controller.rb as specified in Listing 6.13. (p.146) Then ran the tests and they worked.
  19. Then updated app/views/layouts/application.rhtml as specified in Listing 6.14. (p.146-147) Then ran the tests and they worked.
  20. Then updated test/functional/user_controller_test.rb as specified on Listing 6.15. (p.148) Got this: 1 tests, 5 assertions, 0 failures, 0 errors
  21. Then updated test/functional/site_controller_test.rb as specified on Listing 6.16. (p.148) Got this: 4 tests, 12 assertions, 0 failures, 0 errors
  22. Then updated test/functional/user_controller_test.rb as specified on Listing 6.17. (p.149) Got this: 8 tests, 47 assertions, 0 failures, 0 errors
  23. Then updated test/functional/user_controller_test.rb as specified on Listing 6.18. (p.150) Got this: 9 tests, 50 assertions, 0 failures, 0 errors
  24. Then updated app/controllers/user_controller.rb as specified in Listing 6.19. (p.150).
  25. Then updated app/controllers/user_controller.rb as specified in Listing 6.20. (p.151).
  26. Then updated app/controllers/user_controller.rb as specified in Listing 6.21. (p.152).
  27. Then updated test/functional/user_controller_test.rb as specified on Listing 6.22. (p.154) Got this: 9 tests, 50 assertions, 0 failures, 0 errors
  28. Then updated test/functional/user_controller_test.rb as specified on Listing 6.23. (p.154) Got this: 10 tests, 53 assertions, 0 failures, 0 errors
  29. Then updated test/functional/user_controller_test.rb as specified on Listing 6.24. (p.154) Got this: 11 tests, 55 assertions, 0 failures, 0 errors
  30. Then updated app/views/layouts/application.rhtml as specified in Listing 6.25. (p.156)
  31. Then updated app/controllers/user_controller.rb as specified in Listing 6.26. (p.159).
  32. Then updated app/controllers/user_controller.rb as specified in Listing 6.27. (p.160).
  33. Then updated app/controllers/user_controller.rb as specified in Listing 6.28. (p.162).
  34. Then updated test/functional/user_controller_test.rb as specified on Listing 6.29. (p.162) Got this: 12 tests, 61 assertions, 0 failures, 0 errors
  35. Then updated test/functional/user_controller_test.rb as specified on Listing 6.30. (p.163) Got this: 12 tests, 61 assertions, 0 failures, 0 errors
  36. START REFACTORING. (p.163)
  37. Then updated app/helpers/application_helper.rb as specified on Listing 6.31. (p.165)
  38. Then updated test/functional/user_controller_test.rb as specified on Listing 6.32. (p.165) Got this: 12 tests, 61 assertions, 0 failures, 0 errors (NO CHANGE/GOOD)
  39. Skipped 6.33. No Change.
  40. Then updated app/controllers/user_controller.rb as specified in Listing 6.34. (p.166). Got this: 12 tests, 61 assertions, 0 failures, 0 errors (NO CHANGE/GOOD)
  41. Then updated app/views/layouts/application.rhtml as specified on Listing 6.35 . (p.167)
  42. Then updated app/views/layouts/application.rhtml as specified on Listing 6.36 . (p.167)
  43. Ran the test suites and user worked and site did not. Got this for site: $ ruby test/fu*/s*
    Loaded suite test/functional/site_controller_test
    Started
    .........F...
    Finished in 0.458 seconds.
    1) Failure:
    test_register_friendly_url_forwarding(UserControllerTest)
    [test/functional/site_controller_test.rb:224:in `test_register_friendly_url_fo
    warding'
    C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/activesupport-2.1.0/lib
    active_support/testing/setup_and_teardown.rb:33:in `__send__'
    C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/activesupport-2.1.0/lib
    active_support/testing/setup_and_teardown.rb:33:in `run']:
    expected but was
    <"/user">.
  44. Then updated test/functional/user_controller_test.rb as specified on Listing 6.37. (p.167) Got this: 13 tests, 67 assertions, 1 failures, 0 errors (1 FAILURE)
  45. Then updated app/controllers/user_controller.rb as specified in Listing 6.38. (p.168). Got this: 13 tests, 67 assertions, 1 failures, 0 errors (1 FAILURE)
  46. Then updated app/controllers/user_controller.rb as specified in Listing 6.39. (p.169).
  47. Then updated app/models/user.rb as specified in Listing 6.40. (p.170). Ran user tests and got this: 13 tests, 67 assertions, 1 failures, 0 errors (1 FAILURE)
  48. Then updated app/models/user.rb as specified in Listing 6.40. (p.170). Ran user tests and got this: 13 tests, 67 assertions, 1 failures, 0 errors (1 FAILURE)
  49. Then updated app/controllers/user_controller.rb as specified in Listing 6.42. (p.171). Ran user tests and got this: 13 tests, 68 assertions, 0 failures, 0 errors (BACK TO GOOD)
  50. Then updated app/models/user.rb as specified in Listing 6.43. (p.172). Ran user tests and got this: 13 tests, 68 assertions, 0 failures, 0 errors
  51. Then updated app/controllers/user_controller.rb as specified in Listing 6.44. (p.173). Ran user tests and got this: 13 tests, 68 assertions, 0 failures, 0 errors
  52. Then updated app/controllers/user_controller.rb as specified in Listing 6.45. (p.173). Ran user tests and got this: 13 tests, 68 assertions, 0 failures, 0 errors
  53. Then updated app/models/user.rb as specified in Listing 6.46. (p.174). Ran user tests and got this: 13 tests, 68 assertions, 0 failures, 0 errors
  54. Then updated app/controllers/user_controller.rb as specified in Listing 6.47, 6.47.5. (p.174).
  55. Then updated test/functional/user_controller_test.rb as specified on Listing 6.48. (p.175) Got this: 13 tests, 68 assertions, 0 failures, 0 errors
  56. Then updated app/controllers/user_controller.rb as specified in Listing 6.49. (p.176). Got this: 13 tests, 68 assertions, 0 failures, 0 errors
  57. Then updated app/controllers/user_controller.rb as specified in Listing 6.50. (p.176-177). Got this: 13 tests, 68 assertions, 0 failures, 0 errors
  58. Then updated app/controllers/user_controller.rb as specified in Listing 6.51. (p.177). Got this: 13 tests, 68 assertions, 0 failures, 0 errors
  59. Then updated app/controllers/user_controller.rb as specified in Listing 6.52. (p.177). Got this: 13 tests, 68 assertions, 0 failures, 0 errors
  60. Finally I did this: $ rake
    (in C:/cygwin/home/jasnow/RAILSPASSION/rails_space)
    C:/DeepDive/InstantRails-2.0-win/ruby/bin/ruby -I"C:/cygwin/home/jasnow/RAILSPASSION/rails_space/lib" -I"C:/cygwin/home/jasnow/RAILSPASSION/rails_space/test" "C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.4/lib/rake/rake_test_loader.rb" "test/unit/user_test.rb"
    Loaded suite C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.4/lib/r
    ake/rake_test_loader
    Started
    ............
    Finished in 0.342 seconds.
    12 tests, 53 assertions, 0 failures, 0 errors
    C:/DeepDive/InstantRails-2.0-win/ruby/bin/ruby -I"C:/cygwin/home/jasnow/RAILSPASSIO
    N/rails_space/lib" -I"C:/cygwin/home/jasnow/RAILSPASSION/rails_space/test" "C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.4/lib/rake/rake_test_loader.rb" "test/functional/site_controller_test.rb" "test/functional/user_controller_test.rb"
    Loaded suite C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.4/lib/r
    ake/rake_test_loader
    Started
    .............
    Finished in 0.442 seconds.
    13 tests, 68 assertions, 0 failures, 0 errors
    C:/DeepDive/InstantRails-2.0-win/ruby/bin/ruby -I"C:/cygwin/home/jasnow/RAILSPASSION/rails_space/lib" -I"C:/cygwin/home/jasnow/RAILSPASSION/rails_space/test" "C:/cygd
    rive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.4/lib/rake/rake_test_loader
    .rb"
  61. Unclear why I have [13, 68, 0, 0] instead of [17, 78, 0, 0] on page 179.
  62. End of Chapter 6.

Monday, May 4, 2009

My RailsSpace Journey - Day 3 and 4

  1. Abbreviation used throughout: asop ("as specified on page")
  2. RailsSpace: Start of Chapter 5 (Getting started with Testing) (p.97)
  3. Run 'db:test:prepare" using Netbeans. asop 99.
  4. Watched Chapter 5 screencast.
  5. Downloaded Listing 5.2 and ran "ruby test/functional/site_controller_test.rb". (p.100) First had to install older version of gem (2.1.0).
  6. Note the top project directory is $HOME/RAILSPASSION/rails_space.
  7. Successfully repeated step 3 "rake db:test:prepare" after deleting existing database and starting the database inside netbeans.
  8. Day 5 starts.
  9. Repeated step 3 "rake db:test:preapre" outside netbeans (worked after starting database). (p.99)
  10. Tried step 5 again and got same error message: "ActiveRecord::StatementInvalid: Mysql::Error: #42S22Unknown column 'name' in 'field list': INSERT INTO `users` (`name`, `updated_at`, `id`, `created_at` VALUES" (FIXED LATER)
  11. Continued on by replacing Listing 5.2 with 5.3 for test/functional/site_controller_test.rb. (p.101)
  12. Then by replacing Listing 5.3 with 5.4 for test/functional/site_controller_test.rb. (p.103)
  13. Tried step 10 again and got same error message. (FIXED LATER)
  14. Then replaced default user_controller_test.rb with Listing 5.5 and ran the test ("ruby user_controller_test.rb") and it worked. (p.g104-105)
  15. Then replaced default user_controller_test.rb with Listing 5.6 and ran the test ("ruby user_controller_test.rb") and it worked. (p.g106)
  16. Then replaced default user_controller_test.rb with Listing 5.7 and ran the test ("ruby user_controller_test.rb") and it worked. (p.107)
  17. Then replaced default user_controller_test.rb with Listing 5.8 and ran the test ("ruby user_controller_test.rb") and it worked. (p.109-110)
  18. Then replaced default test/unit/user_test.rb with Listing 5.9 and ran the test ("ruby user_test.rb") and it worked. (p.111)
  19. Then replace Listing 5.10 with Listing 5.11 and ran the test and it worked.
  20. So I tried "rake test:units" and got this: (in C:/cygwin/home/jasnow/RAILSPASSION/rails_space)
    C:/DeepDive/InstantRails-2.0-win/ruby/bin/ruby -I"C:/cygwin/home/jasnow/RAILSPASSION/rails_space/lib" -I"C:/cygwin/home/jasnow/RAILSPASSION/rails_space/test" "C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.4/lib/rake/rake_test_loader
    .rb" "test/unit/user_test.rb"
    Loaded suite C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.4/lib/r
    ake/rake_test_loader
    Started
    .
    Finished in 0.233 seconds.
    1 tests, 1 assertions, 0 failures, 0 errors
  21. So I felt brave and ran and got this: $ rake test:functionals
    (in C:/cygwin/home/jasnow/RAILSPASSION/rails_space)
    C:/DeepDive/InstantRails-2.0-win/ruby/bin/ruby -I"C:/cygwin/home/jasnow/RAILSPASSION/rails_space/lib" -I"C:/cygwin/home/jasnow/RAILSPASSION/rails_space/test" "C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.4/lib/rake/rake_test_loader.rb" "test/functional/site_controller_test.rb" "test/functional/user_controller_test.rb"
    Loaded suite C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.4/lib/r
    ake/rake_test_loader
    Started
    ......
    Finished in 0.321 seconds.
    6 tests, 30 assertions, 0 failures, 0 errors
  22. Then replaced default test/unit/user_test.rb with Listing 5.12 and ran the test ("ruby user_test.rb") and it worked. (p.113)
  23. Then replaced default test/unit/user_test.rb with Listing 5.13 and ran the test ("ruby user_test.rb") and it worked. (p.114)
  24. Then replaced default test/unit/user_test.rb with Listing 5.15 and ran the test ("ruby user_test.rb") and it worked. (p.116)
  25. Then replaced default test/unit/user_test.rb with Listing 5.17 and ran the test ("ruby user_test.rb") and it worked. (p.117) Got this: Loaded suite test/unit/user_test
    Started
    .....
    Finished in 0.269 seconds.
    5 tests, 14 assertions, 0 failures, 0 errors
  26. Then replaced default test/unit/user_test.rb with Listing 5.19 and ran the test ("ruby user_test.rb") and it worked. (p.120) Got this: 7 tests, 20 assertions, 0 failures, 0 errors
  27. Then replaced default test/unit/user_test.rb with Listing 5.21 and ran the test ("ruby user_test.rb") and it worked. (p.121-122) Got this: 8 tests, 22 assertions, 0 failures, 0 errors
  28. Then replaced default test/unit/user_test.rb with Listing 5.23 and ran the test ("ruby user_test.rb") and it worked. (p.122) Got this: 9 tests, 29 assertions, 0 failures, 0 errors
  29. Then replaced default test/unit/user_test.rb with Listing 5.24 and ran the test ("ruby user_test.rb") and it worked. (p.123-124) Got this: 10 tests, 47 assertions, 0 failures, 0 errors
  30. Then replaced default test/unit/user_test.rb with Listing 5.26 (Listing 5.27 is the same) and ran the test ("ruby user_test.rb") and it worked. (p.124-125) Got this: 12 tests, 53 assertions, 0 failures, 0 errors
  31. Ran this: $ rake test:units (pg. 128)
    (in C:/cygwin/home/jasnow/RAILSPASSION/rails_space)
    C:/DeepDive/InstantRails-2.0-win/ruby/bin/ruby -I"C:/cygwin/home/jasnow/RAILSPASSION/rails_space/lib" -I"C:/cygwin/home/jasnow/RAILSPASSION/rails_space/test" "C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.4/lib/rake/rake_test_loader.rb" "test/unit/user_test.rb"
    Loaded suite C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.4/lib/r
    ake/rake_test_loader
    Started
    ............
    Finished in 0.334 seconds.
    12 tests, 53 assertions, 0 failures, 0 errors
  32. Then ran this: $ rake (p.128-129)
    (in C:/cygwin/home/jasnow/RAILSPASSION/rails_space)
    C:/DeepDive/InstantRails-2.0-win/ruby/bin/ruby -I"C:/cygwin/home/jasnow/RAILSPASSION/rails_space/lib" -I"C:/cygwin/home/jasnow/RAILSPASSION/rails_space/test" "C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.4/lib/rake/rake_test_loader.rb" "test/unit/user_test.rb"
    Loaded suite C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.4/lib/r
    ake/rake_test_loader
    Started
    ............
    Finished in 0.341 seconds.
    12 tests, 53 assertions, 0 failures, 0 errors
    C:/DeepDive/InstantRails-2.0-win/ruby/bin/ruby -I"C:/cygwin/home/jasnow/RAILSPASSION/rails_space/lib" -I"C:/cygwin/home/jasnow/RAILSPASSION/rails_space/test" "C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.4/lib/rake/rake_test_loader.rb" "test/functional/site_controller_test.rb" "test/functional/user_controller_test.rb"
    Loaded suite C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.4/lib/r
    ake/rake_test_loader
    Started
    ......
    Finished in 0.388 seconds.
    6 tests, 30 assertions, 0 failures, 0 errors
    C:/DeepDive/InstantRails-2.0-win/ruby/bin/ruby -I"C:/cygwin/home/jasnow/RAILSPASSION/rails_space/lib" -I"C:/cygwin/home/jasnow/RAILSPASSION/rails_space/test" "C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/gems/rake-0.8.4/lib/rake/rake_test_loader.rb"
  33. Then ran this: $ rake stats (p.129)
    (in C:/cygwin/home/jasnow/RAILSPASSION/rails_space)
    +----------------------+-------+-------+---------+---------+-----+-------+
    | Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
    +----------------------+-------+-------+---------+---------+-----+-------+
    | Controllers | 47 | 30 | 3 | 5 | 1 | 4 |
    | Helpers | 12 | 10 | 0 | 1 | 0 | 8 |
    | Models | 32 | 23 | 1 | 0 | 0 | 0 |
    | Libraries | 0 | 0 | 0 | 0 | 0 | 0 |
    | Integration tests | 0 | 0 | 0 | 0 | 0 | 0 |
    | Functional tests | 129 | 104 | 4 | 10 | 2 | 8 |
    | Unit tests | 163 | 113 | 1 | 13 | 13 | 6 |
    +----------------------+-------+-------+---------+---------+-----+-------+
    | Total | 383 | 280 | 9 | 29 | 3 | 7 |
    +----------------------+-------+-------+---------+---------+-----+-------+
    Code LOC: 63 Test LOC: 217 Code to Test Ratio: 1:3.4
  34. Done with Chapter 5.





Sunday, May 3, 2009

My RailsSpace Journey - Day 2

  1. May 2nd: Read the first 33 pages of RailsSpace.
  2. Book URL on page 5.
  3. NOTE THAT ALL PAGE NUMBERS ARE FROM RailsSpace Book unless otherwise.
  4. Ran "rails.bat ralis_space" on my Vista/PC and it created the project under my RAILSPASSION directory. (pg.16)
  5. Ran "cd rails_space ; ruby script/server" and got this. (pg.18) : => Booting Mongrel
    => Rails 2.3.2 application starting on http://0.0.0.0:3000
    => Call with -d to detach
    => Ctrl-C to shutdown server
  6. I checked "localhost:3000" and got default screen as seen on page 19.
  7. Then I did this: $ ruby script/generate controller site index about help and got this: (p.21)
    exists app/controllers/
    exists app/helpers/
    create app/views/site
    exists test/functional/
    create test/unit/helpers/
    create app/controllers/site_controller.rb
    create test/functional/site_controller_test.rb
    create app/helpers/site_helper.rb
    create test/unit/helpers/site_helper_test.rb
    create app/views/site/index.html.erb
    create app/views/site/about.html.erb
    create app/views/site/help.html.erb
  8. Then I did this: "gem rdoc --all" - Got a few, then errored out. (p.24)
  9. Edited routes.rb as specificed on page 26. Deleted Public/index.html and edited views/site/index.rhtml as specificed on page 26. Then refreshed web page and got the screen as shown on top of page 27.
  10. Then i edited aobut.rhtml and help.rhtml as specified on page 28. Then created site.rhtml as specified on page 29.
  11. Then I edited/shortened index.rhtml on bottom of page 29. Refresh web page and saw that it worked. Also shorten about.rhtml and help.rhtml web pages on specified on page 30.
  12. Set up Netbeans for RailsSpace and moved 1st 11 steps of data under Netbeans directiory. After a few bumps, it worked as seen (the web page) on bottom of page 33.
  13. Then I modified (removed extra curly braces/paras) site.rhtml as specificed on page 36 and refreshed web page. It worked.
  14. Then changed all "link_to" to "link_to_unless_current" as specified on page 37.
  15. Downloaded the RailsSpace files zip file from publisher and used "site.css" as specified on page 40. Restarted webserver and check all 3 web pages. They worked as seen on page 41.
  16. End of Chapter 2
  17. HAD TO REBUILD THE PROJECT/REPEAT CHAPTER 2 INSIDE NETBEANS to get NETBEANS to BUILD DATA
  18. Used netbeans to create:db (pg.43-45).
  19. Used netbeans to generate model for User (p.47).
  20. Then add 3 columns (screen_name, email, password) to migration file (p.48).
  21. Used netbeans to run db:migrate. (p.49)
  22. Enter one user using netbean's console. (p.52-53)
  23. Then added 5 validations to user model. (p.54)
  24. Then added constants to user model as specified on page 55-56.
  25. Then added validate method as specified on page 57.
  26. Then added "if" statemend as specified on top of page 58.
  27. Then added "full-strength" validations as specified on page 59.
  28. I skipped page 62 where it wanted me to add create_at and update_at since netbeans or rails already added them. (p.62)
  29. Finished Chapter 3.
  30. Chapter 4: Generated another controller, "user", with index and register views. (p.66)
  31. Then edited user_controller.rb as specified at bottom of page 67.
  32. Then copied site.rhtml into brand new application.rhtml view. (p.68)
  33. Then undid step 30. (smile) (p.g68).
  34. Then edited register.rhtml to add CSS. (p.68-69)
  35. Then edited site.css file as specified on page 69.
  36. WEB PAGE DISPLAY IS BROKEN (p.66,68,71,76) (get: Routing Error ;
    No route matches "/user" with {:method=>:get}) UNCLEAR IF I SHOULD BE ABLE TO DISPLAY WEB PAGE.\
  37. Fix step 36 by restarting the server.
  38. Then edited user.rb model as specified on bottom of page 73.
  39. Then edited register.rb as specified on page 74.
  40. Then added debug lines to application.rhtml and site.css as on page 75-76.
  41. Then add processing code to user_controller as on page 78.
  42. Then edited register.rb as specified on page 84.
  43. Then edited site.css file as specified on page 85.
  44. Then edited applicaton.rhtml as specified on page 86.
  45. Then edited site.css file as specified on page 87.
  46. Then edited application.rhtml as specified on bottom of page 87.
  47. Then edited user_controller.rb as specified on page 88.
  48. Then edited index.rhtml view and user_controller.rb controller as specified on page 89.
  49. Then edited application.rhtml layout as specified on page 90-91.
  50. Then edited application.rhtml layout as specified on page 91.
  51. Then edited the application_helper.rb file as specified on page 92 and page 93.
  52. Then edited the application.rhtml layout file as specified on page 93.
  53. Finally for chapter 4, I dropped the tables and recreated the tables as specified on page 95 and then entered one user as specified on page 95. AND IT WORKED.
  54. End of Chapter 4. Testing next.