diff options
author | wycats <wycats@gmail.com> | 2010-04-30 11:17:58 -0700 |
---|---|---|
committer | wycats <wycats@gmail.com> | 2010-04-30 11:17:58 -0700 |
commit | 0fe8827bf384cb99ab757236555c7af18793d515 (patch) | |
tree | a7ac2143c78964cad8ee87d9ff8a1c52abf61249 /railties/guides/source/testing.textile | |
parent | 91963e9e33eb5a28297323f1346aeb8b643e9d65 (diff) | |
parent | 6b559474fb7fae0160860fc62752da347af032b2 (diff) | |
download | rails-0fe8827bf384cb99ab757236555c7af18793d515.tar.gz rails-0fe8827bf384cb99ab757236555c7af18793d515.tar.bz2 rails-0fe8827bf384cb99ab757236555c7af18793d515.zip |
Merge branch 'master' of github.com:rails/rails
Diffstat (limited to 'railties/guides/source/testing.textile')
-rw-r--r-- | railties/guides/source/testing.textile | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/railties/guides/source/testing.textile b/railties/guides/source/testing.textile index 206ed6e75c..8d7d73b487 100644 --- a/railties/guides/source/testing.textile +++ b/railties/guides/source/testing.textile @@ -146,14 +146,14 @@ NOTE: For more information on Rails <i>scaffolding</i>, refer to "Getting Starte When you use +rails generate scaffold+, for a resource among other things it creates a test stub in the +test/unit+ folder: -<pre> +<shell> $ rails generate scaffold post title:string body:text ... create app/models/post.rb create test/unit/post_test.rb create test/fixtures/posts.yml ... -</pre> +</shell> The default test stub in +test/unit/post_test.rb+ looks like this: @@ -702,24 +702,24 @@ class UserFlowsTest < ActionController::IntegrationTest private - module CustomDsl - def browses_site - get "/products/all" - assert_response :success - assert assigns(:products) - end + module CustomDsl + def browses_site + get "/products/all" + assert_response :success + assert assigns(:products) end + end - def login(user) - open_session do |sess| - sess.extend(CustomDsl) - u = users(user) - sess.https! - sess.post "/login", :username => u.username, :password => u.password - assert_equal '/welcome', path - sess.https!(false) - end + def login(user) + open_session do |sess| + sess.extend(CustomDsl) + u = users(user) + sess.https! + sess.post "/login", :username => u.username, :password => u.password + assert_equal '/welcome', path + sess.https!(false) end + end end </ruby> @@ -845,9 +845,9 @@ Testing mailer classes requires some specific tools to do a thorough job. h4. Keeping the Postman in Check -Your +ActionMailer+ classes -- like every other part of your Rails application -- should be tested to ensure that it is working as expected. +Your mailer classes -- like every other part of your Rails application -- should be tested to ensure that it is working as expected. -The goals of testing your +ActionMailer+ classes are to ensure that: +The goals of testing your mailer classes are to ensure that: * emails are being processed (created and sent) * the email content is correct (subject, sender, body, etc) |