From fb955f1eaf6b1fdbb321ec55f40f4a4806d62fd8 Mon Sep 17 00:00:00 2001 From: ZENATI YASSINE Date: Sat, 19 Apr 2014 18:05:18 +0200 Subject: [PATCH 01/12] [ci skip] Added example for email_field_tag method --- .../lib/action_view/helpers/form_tag_helper.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/actionview/lib/action_view/helpers/form_tag_helper.rb b/actionview/lib/action_view/helpers/form_tag_helper.rb index 66c9e2068264e..47d4c04b0971d 100644 --- a/actionview/lib/action_view/helpers/form_tag_helper.rb +++ b/actionview/lib/action_view/helpers/form_tag_helper.rb @@ -698,6 +698,19 @@ def url_field_tag(name, value = nil, options = {}) # # ==== Options # * Accepts the same options as text_field_tag. + # + # ==== Examples + # email_field_tag 'name' + # # => + # + # email_field_tag 'email', 'email@example.com' + # # => + # + # email_field_tag 'email', nil, class: 'special_input' + # # => + # + # email_field_tag 'email', 'email@example.com', class: 'special_input', disabled: true + # # => def email_field_tag(name, value = nil, options = {}) text_field_tag(name, value, options.stringify_keys.update("type" => "email")) end From 320d436141e197e1c254563f77feff00610d15cf Mon Sep 17 00:00:00 2001 From: ZENATI YASSINE Date: Sat, 19 Apr 2014 18:09:07 +0200 Subject: [PATCH 02/12] [ci skip] Added example for date_field_tag method --- .../lib/action_view/helpers/form_tag_helper.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/actionview/lib/action_view/helpers/form_tag_helper.rb b/actionview/lib/action_view/helpers/form_tag_helper.rb index 47d4c04b0971d..3104d424dc194 100644 --- a/actionview/lib/action_view/helpers/form_tag_helper.rb +++ b/actionview/lib/action_view/helpers/form_tag_helper.rb @@ -614,6 +614,19 @@ def telephone_field_tag(name, value = nil, options = {}) # # ==== Options # * Accepts the same options as text_field_tag. + # + # ==== Examples + # date_field_tag 'name' + # # => + # + # date_field_tag 'date', '01/01/2014' + # # => + # + # date_field_tag 'date', nil, class: 'special_input' + # # => + # + # date_field_tag 'date', '01/01/2014', class: 'special_input', disabled: true + # # => def date_field_tag(name, value = nil, options = {}) text_field_tag(name, value, options.stringify_keys.update("type" => "date")) end From 6d71384afb7a91429637c0267056ac7a9ccb7983 Mon Sep 17 00:00:00 2001 From: ZENATI YASSINE Date: Sat, 19 Apr 2014 18:18:03 +0200 Subject: [PATCH 03/12] [ci skip] Added example for number_field_tag method --- .../action_view/helpers/form_tag_helper.rb | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/actionview/lib/action_view/helpers/form_tag_helper.rb b/actionview/lib/action_view/helpers/form_tag_helper.rb index 3104d424dc194..8f10eb46ada01 100644 --- a/actionview/lib/action_view/helpers/form_tag_helper.rb +++ b/actionview/lib/action_view/helpers/form_tag_helper.rb @@ -735,12 +735,40 @@ def email_field_tag(name, value = nil, options = {}) # * :max - The maximum acceptable value. # * :in - A range specifying the :min and # :max values. + # * :within - Same as :in. # * :step - The acceptable value granularity. # * Otherwise accepts the same options as text_field_tag. # # ==== Examples + # number_field_tag 'quantity' + # # => + # + # number_field_tag 'quantity', '1' + # # => + # + # number_field_tag 'quantity', nil, class: 'special_input' + # # => + # + # number_field_tag 'quantity', nil, min: 1 + # # => + # + # number_field_tag 'quantity', nil, max: 9 + # # => + # # number_field_tag 'quantity', nil, in: 1...10 # # => + # + # number_field_tag 'quantity', nil, within: 1...10 + # # => + # + # number_field_tag 'quantity', nil, min: 1, max: 10 + # # => + # + # number_field_tag 'quantity', nil, min: 1, max: 10, step: 2 + # # => + # + # number_field_tag 'quantity', '1', class: 'special_input', disabled: true + # # => def number_field_tag(name, value = nil, options = {}) options = options.stringify_keys options["type"] ||= "number" From 0fd301aaf7e0f028fe8ea1c4b896191489d1fc0a Mon Sep 17 00:00:00 2001 From: Gaurish Sharma Date: Sun, 20 Apr 2014 01:39:52 +0530 Subject: [PATCH 04/12] Remove reference to outdated section [ci skip] --- guides/source/contributing_to_ruby_on_rails.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/source/contributing_to_ruby_on_rails.md b/guides/source/contributing_to_ruby_on_rails.md index 90c83a5e054e9..da1f305e6cf94 100644 --- a/guides/source/contributing_to_ruby_on_rails.md +++ b/guides/source/contributing_to_ruby_on_rails.md @@ -154,7 +154,7 @@ The easiest and recommended way to get a development environment ready to hack i #### The Hard Way -In case you can't use the Rails development box, see section above, check [this other guide](development_dependencies_install.html). +In case you can't use the Rails development box, see [this other guide](development_dependencies_install.html). ### Clone the Rails Repository ### From 9b1c077c91f09b64b8105f31fdf5240cd12c2e16 Mon Sep 17 00:00:00 2001 From: Gaurish Sharma Date: Sun, 20 Apr 2014 03:23:01 +0530 Subject: [PATCH 05/12] update doc, assert_template also accepts false [ci skip] --- actionpack/lib/action_controller/test_case.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index caaebc537a0bf..b904dedccd828 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -170,7 +170,7 @@ def assert_template(options = {}, message = nil) "Expected no partials to be rendered" end else - raise ArgumentError, "assert_template only accepts a String, Symbol, Hash, Regexp, or nil" + raise ArgumentError, "assert_template only accepts a String, Symbol, Hash, Regexp, nil or false" end end end From 2aef9fddf8b4487a05638ea3341dfd65ceb229ef Mon Sep 17 00:00:00 2001 From: Gaurish Sharma Date: Sun, 20 Apr 2014 23:54:39 +0530 Subject: [PATCH 06/12] Document ActionController::TestCase::Behavior::ClassMethods.process [ci skip] --- actionpack/lib/action_controller/test_case.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index b904dedccd828..a79c139b4d8c4 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -550,6 +550,18 @@ def paramify_values(hash_or_array_or_value) end end + # Simulate a HTTP request to action with the given parameters and set/volley the response. + # + # - +action+: The controller action to call. + # - +http_method+: http method, defaults to +GET+ + # - +session+: A hash of parameters to store in the session. This may be +nil+. + # - +flash+: A hash of parameters to store in the flash. This may be +nil+. + # + # You can also simulate GET, POST, PATCH, PUT, DELETE, and HEAD requests with + # +post+, +patch+, +put+, +delete+, and +head+. + # + # Note that the request method is not verified. The different methods are + # available to make the tests more expressive. def process(action, http_method = 'GET', *args) check_required_ivars From 28bd442034e0974d0a4d664076dafb8e9555816d Mon Sep 17 00:00:00 2001 From: Gaurish Sharma Date: Mon, 21 Apr 2014 18:09:22 +0530 Subject: [PATCH 07/12] Running AR tests on postgres, mysql & sqlite [ci skip] --- guides/source/contributing_to_ruby_on_rails.md | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/guides/source/contributing_to_ruby_on_rails.md b/guides/source/contributing_to_ruby_on_rails.md index da1f305e6cf94..2ab3280dc8078 100644 --- a/guides/source/contributing_to_ruby_on_rails.md +++ b/guides/source/contributing_to_ruby_on_rails.md @@ -244,19 +244,14 @@ $ bundle exec rake test ##### Testing Active Record -This is how you run the Active Record test suite only for SQLite3: +This is how you run the Active Record test suite only for specific database: ```bash $ cd activerecord -$ bundle exec rake test_sqlite3 -``` - -You can now run the tests as you did for `sqlite3`. The tasks are respectively - -```bash -test_mysql -test_mysql2 -test_postgresql +$ bundle exec rake test_sqlite3 #sqlite +$ bundle exec rake test_mysql #mysql using mysql gem +$ bundle exec rake test_mysql2 #mysql using mysql2 gem +$ bundle exec rake test_postgresql #postgres ``` Finally, From e1c5d24369440857de1402d61c85d982b29d8019 Mon Sep 17 00:00:00 2001 From: Gaurish Sharma Date: Mon, 21 Apr 2014 18:33:19 +0530 Subject: [PATCH 08/12] Revert "update doc, assert_template also accepts false" This reverts commit 9b1c077c91f09b64b8105f31fdf5240cd12c2e16. my bad. `assert_template` only accepts a String, Symbol, Hash, Regexp or nil. `false`(layout: false) is provided as a Hash. --- actionpack/lib/action_controller/test_case.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index a79c139b4d8c4..2962ce47f9510 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -170,7 +170,7 @@ def assert_template(options = {}, message = nil) "Expected no partials to be rendered" end else - raise ArgumentError, "assert_template only accepts a String, Symbol, Hash, Regexp, nil or false" + raise ArgumentError, "assert_template only accepts a String, Symbol, Hash, Regexp, or nil" end end end From 07ea37763d62e57d5709ab37da01b2848d12edd5 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Mon, 21 Apr 2014 08:21:12 -0500 Subject: [PATCH 09/12] Revert "Revert "update doc, assert_template also accepts false"" Reason: docrails policy is very strict about code. No matter how innocent the change, if it is not documentation it needs to go through a PR to rails/rails. Plase see the warning box at the bottom of http://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#contributing-to-the-rails-documentation This reverts commit e1c5d24369440857de1402d61c85d982b29d8019. --- actionpack/lib/action_controller/test_case.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index 2962ce47f9510..a79c139b4d8c4 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -170,7 +170,7 @@ def assert_template(options = {}, message = nil) "Expected no partials to be rendered" end else - raise ArgumentError, "assert_template only accepts a String, Symbol, Hash, Regexp, or nil" + raise ArgumentError, "assert_template only accepts a String, Symbol, Hash, Regexp, nil or false" end end end From 957881a45b68a28e6118db28bd465fedba51f593 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Mon, 21 Apr 2014 08:25:50 -0500 Subject: [PATCH 10/12] Revert "Revert "Revert "update doc, assert_template also accepts false""" Revert Festival! I reverted a reverted commit, undo. This reverts commit 07ea37763d62e57d5709ab37da01b2848d12edd5. --- actionpack/lib/action_controller/test_case.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index a79c139b4d8c4..2962ce47f9510 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -170,7 +170,7 @@ def assert_template(options = {}, message = nil) "Expected no partials to be rendered" end else - raise ArgumentError, "assert_template only accepts a String, Symbol, Hash, Regexp, nil or false" + raise ArgumentError, "assert_template only accepts a String, Symbol, Hash, Regexp, or nil" end end end From 75acbac298ba407e6d86082a63ffa4e4a77667ac Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Sun, 27 Apr 2014 21:25:40 +0530 Subject: [PATCH 11/12] Revert "Document ActionController::TestCase::Behavior::ClassMethods.process" This reverts commit 2aef9fddf8b4487a05638ea3341dfd65ceb229ef. Reason: The added change isn't clear in terms of explaining the arguments. Will ask the author to provide a PR and take it forward. [ci skip] --- actionpack/lib/action_controller/test_case.rb | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index 2962ce47f9510..caaebc537a0bf 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -550,18 +550,6 @@ def paramify_values(hash_or_array_or_value) end end - # Simulate a HTTP request to action with the given parameters and set/volley the response. - # - # - +action+: The controller action to call. - # - +http_method+: http method, defaults to +GET+ - # - +session+: A hash of parameters to store in the session. This may be +nil+. - # - +flash+: A hash of parameters to store in the flash. This may be +nil+. - # - # You can also simulate GET, POST, PATCH, PUT, DELETE, and HEAD requests with - # +post+, +patch+, +put+, +delete+, and +head+. - # - # Note that the request method is not verified. The different methods are - # available to make the tests more expressive. def process(action, http_method = 'GET', *args) check_required_ivars From 9ace0a7ba149dd2409f541b1af69893191ff2450 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Sun, 27 Apr 2014 21:29:15 +0530 Subject: [PATCH 12/12] Revert "Running AR tests on postgres, mysql & sqlite" This reverts commit 28bd442034e0974d0a4d664076dafb8e9555816d. Reason: Existing text was clearer imo. [ci skip] --- guides/source/contributing_to_ruby_on_rails.md | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/guides/source/contributing_to_ruby_on_rails.md b/guides/source/contributing_to_ruby_on_rails.md index 2ab3280dc8078..da1f305e6cf94 100644 --- a/guides/source/contributing_to_ruby_on_rails.md +++ b/guides/source/contributing_to_ruby_on_rails.md @@ -244,14 +244,19 @@ $ bundle exec rake test ##### Testing Active Record -This is how you run the Active Record test suite only for specific database: +This is how you run the Active Record test suite only for SQLite3: ```bash $ cd activerecord -$ bundle exec rake test_sqlite3 #sqlite -$ bundle exec rake test_mysql #mysql using mysql gem -$ bundle exec rake test_mysql2 #mysql using mysql2 gem -$ bundle exec rake test_postgresql #postgres +$ bundle exec rake test_sqlite3 +``` + +You can now run the tests as you did for `sqlite3`. The tasks are respectively + +```bash +test_mysql +test_mysql2 +test_postgresql ``` Finally,