aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
Commit message (Collapse)AuthorAgeFilesLines
* build fix. follow up to 174c9f0df39cd338a4871f82794256cc64f68a81Yves Senn2014-02-241-1/+1
|
* include names in model generator warning message. refs #13515.Yves Senn2014-02-241-1/+1
| | | | | | This is a follow up to #13515. It includes the name given and the singularized version in the warning message. This will aide the user to see wether the detected singular was right or not.
* Merge pull request #13515 from kuldeepaggarwal/f-model-generationGodfrey Chan2014-02-222-1/+8
|\ | | | | Added warning when user tried to create model with pluralize name.
| * Add warning when user tried to create model with pluralize name.Kuldeep Aggarwal2014-02-232-1/+8
| | | | | | | | | | 1. Generate model with correct_name. 2. It will help new users to avoid mistakes when tried to create model with wrong name.
* | Revert "Only lookup `config.log_level` for stdlib `::Logger`. Closes #11665."Guillermo Iguaran2014-02-211-14/+1
|/ | | | | | | | | | | | This reverts commit e0a521cfcd13e4d1f0ae8ab96004289e1c020f71. Conflicts: railties/CHANGELOG.md We expect loggers to quack like stdlib logger. If log4r needs different level= assignment, using a Logger-quacking wrapper is the way to do it. Fixes #14114.
* remove railties changes. fixes #14054Aaron Patterson2014-02-143-100/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Squashed commit of the following: commit 96991e8e919edfb20cc4120bca4e36ed51175d57 Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Fri Feb 14 11:29:24 2014 -0800 Revert "gems can be added or skipped from the template" This reverts commit 8beb42cfbc41753ae4dbb91e16abcd1fb7d00356. Conflicts: railties/lib/rails/generators/rails/app/app_generator.rb railties/test/generators/app_generator_test.rb commit 35599c0e657245ef14ac0f28c9189ad16acf40e6 Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Fri Feb 14 11:26:53 2014 -0800 Revert "oops, template replay needs to happen after bundle. :orz:" This reverts commit 9104702be61253f9448ca070a22fc86bb4299555. Conflicts: railties/lib/rails/generators/rails/app/app_generator.rb commit f519c3902c313db8e906a49251c91643b8e6499e Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Fri Feb 14 11:25:51 2014 -0800 Revert "only ask for these ivars if the target responds to them" This reverts commit 656d412546cd97d5660c634c2a41c799d3f9e211. commit aa524a9428e3e4c45fe221f10a66a08efb827ab5 Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Fri Feb 14 11:25:39 2014 -0800 Revert "refactor generator tests to use block form of Tempfile" This reverts commit 65251820ef0ab7f3cffb38130de3dd41af8d72be. commit 7d3740549fa4dfa62e3761f8d4bc6d6d441256e7 Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Fri Feb 14 11:25:25 2014 -0800 Revert "add a more restricted codepath for templates fixes #13390" This reverts commit 2875b4a66e38e4333da887a4afbed33358999298. commit 525df0af1001918986cdfce59539fd2d52c4f32c Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Fri Feb 14 11:25:11 2014 -0800 Revert "add a send so `apply` can be called. Fixes #13510" This reverts commit c5034d60dba0cd31a6a8c612ee35d63b8127793a.
* fix path shown in mailer's templatesKassio Borges2014-02-141-4/+4
|
* Merge pull request #13945 from rails/json_cookie_serializer_improvementsGuillermo Iguaran2014-02-131-1/+1
|\ | | | | Cookies serializer improvements
| * Fix AppGeneratorTest: serializer option was removed from session_storeGuillermo Iguaran2014-02-111-1/+1
| |
* | do not crash when `config/secrets.yml` is blank.Yves Senn2014-02-121-0/+8
| |
* | add a send so `apply` can be called. Fixes #13510Aaron Patterson2014-02-111-0/+32
|/ | | | | | | THIS IS A HUGE HACK. Thor does not allow us to define public methods without turning them in to "thor tasks". That means we cannot subclass the `apply` method and make it public, so we have to make the method private and call `send` on it.
* Add config to disable schema dump after migrationEmil Soman2014-02-062-0/+48
| | | | | | | | | * Add a config on Active Record named `dump_schema_after_migration` * Schema dump doesn't happen if the config is set to false * Set default value of the config to true * Set config in generated production environment file to false * Update configuration guide * Update CHANGELOG
* Merge pull request #13612 from eval/issue-13588Rafael Mendonça França2014-01-301-0/+134
|\ | | | | Add CreateMigration action
| * Add CreateMigration actionGert Goet2014-01-281-0/+134
| | | | | | | | | | | | | | | | | | | | This Thor-action isolates the logic whether to (over-)write migration and what is shown to the user. It's modelled after Thor's CreateFile-action. This solves the issue that removing a non-existing migration, tried to remove the template-path (#13588). Related issues: #12674
* | Modify the session serializer implementationGuillermo Iguaran2014-01-301-1/+1
| | | | | | | | | | Rename allowed options to :marshal and :json, for custom serializers only allow the use of custom classes.
* | Allow session serializer key in config.session_storeLukasz Sarnacki2014-01-291-1/+1
|/ | | | | | | | | | | | | MessageEncryptor has :serializer option, where any serializer object can be passed. This commit make it possible to set this serializer from configuration level. There are predefined serializers (:marshal_serializer, :json_serialzier) and custom serializer can be passed as String, Symbol (camelized and constantized in ActionDispatch::Session namepspace) or serializer object. Default :json_serializer was also added to generators to provide secure defalt.
* Add a test-case for GH #13825Guillermo Iguaran2014-01-241-2/+8
|
* Use single quotes in generated filesChulki Lee2014-01-141-4/+4
|
* single quotes for controller generated routesCristian Mircea Messel2014-01-142-3/+3
| | | | | | | | | | Write routes in route.rb with single quotes get 'welcome/index' instead of get "welcome/index"
* Favor canonical environment variables for secretsschneems2014-01-131-2/+2
| | | | | | | | | Prefixing an environment variable with `RAILS_` should be used when there is otherwise a conflict, such as `RAILS_ENV` or if it is being used for a very Rails specific value. If we remove the prefix of `RAILS_` in the case of `RAILS_SECRET_KEY_BASE` then we can push for a pseudo standard among other frameworks that will accept a common environment key `SECRET_KEY_BASE` to keep your app secure. This is beneficial for containerized deployments such as docker, Heroku, etc. So that the container need to know one less thing about your app (it can just set it no-matter what language or framework you are using). This change also allows the defaults to be consistent with the way the secret key is accessed so `secrets.secret_key_base` is aliased to `SECRET_KEY_BASE` instead of `RAILS_SECRET_KEY_BASE`.
* Only lookup `config.log_level` for stdlib `::Logger`. Closes #11665.Yves Senn2014-01-131-1/+14
| | | | | | | | This prevents Rails from assigning meaningless log levels to third party loggers like log4r. If `Rails.logger` is not `kind_of?(::Logger)` we simply assign the `config.log_level` as is. This bug was introduced by #11665.
* standardize on jruby_skip & rbx_skipGaurish Sharma2014-01-132-2/+11
| | | | | | This Adds helpers(jruby_skip & rbx_skip). In Future, Plan is to use these helpers instead of calls directly to RUBY_ENGINE/RbConfig/JRUBY_VERSION
* Skip Spring App Generator tests on JRubyGaurish Sharma2014-01-131-0/+2
| | | | | Spring makes extensive use of Process.fork, so won't be able to provide JRuby Support, hence skip these tests on JRuby.
* upgrade SDocXavier Noria2014-01-121-2/+2
| | | | Kudos to @zzak for taking over SDoc and make it work with RDoc 4.
* Ensure Active Record connection consistencyschneems2014-01-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently Active Record can be configured via the environment variable `DATABASE_URL` or by manually injecting a hash of values which is what Rails does, reading in `database.yml` and setting Active Record appropriately. Active Record expects to be able to use `DATABASE_URL` without the use of Rails, and we cannot rip out this functionality without deprecating. This presents a problem though when both config is set, and a `DATABASE_URL` is present. Currently the `DATABASE_URL` should "win" and none of the values in `database.yml` are used. This is somewhat unexpected to me if I were to set values such as `pool` in the `production:` group of `database.yml` they are ignored. There are many ways that active record initiates a connection today: - Stand Alone (without rails) - `rake db:<tasks>` - ActiveRecord.establish_connection - With Rails - `rake db:<tasks>` - `rails <server> | <console>` - `rails dbconsole` We should make all of these behave exactly the same way. The best way to do this is to put all of this logic in one place so it is guaranteed to be used. Here is my prosed matrix of how this behavior should work: ``` No database.yml No DATABASE_URL => Error ``` ``` database.yml present No DATABASE_URL => Use database.yml configuration ``` ``` No database.yml DATABASE_URL present => use DATABASE_URL configuration ``` ``` database.yml present DATABASE_URL present => Merged into `url` sub key. If both specify `url` sub key, the `database.yml` `url` sub key "wins". If other paramaters `adapter` or `database` are specified in YAML, they are discarded as the `url` sub key "wins". ``` ### Implementation Current implementation uses `ActiveRecord::Base.configurations` to resolve and merge all connection information before returning. This is achieved through a utility class: `ActiveRecord::ConnectionHandling::MergeAndResolveDefaultUrlConfig`. To understand the exact behavior of this class, it is best to review the behavior in activerecord/test/cases/connection_adapters/connection_handler_test.rb though it should match the above proposal.
* add a more restricted codepath for templates fixes #13390Aaron Patterson2014-01-081-4/+25
|
* refactor generator tests to use block form of TempfileAaron Patterson2014-01-081-36/+30
|
* Add missing tests for invalid names in `rails plugin new`Robin Böning2014-01-061-0/+6
| | | | | * Test for: Invalid plugin name, because of reserved rails word. * Test for: Invalid plugin name because of constant name that is already in use.
* Add preview_path to autoload_paths in after_initializeAndrew White2014-01-041-1/+41
| | | | | | | | | | Only config.autoload_paths is frozen, so add the preview_path to ActiveSupport::Dependencies.autoload_paths directly in an after_initialize block. Also protect against a blank preview_path being added to autoload_paths which can cause a serious slowdown as Dir[] tries to load all *_preview.rb files under / Fixes #13372
* Use DATABASE_URL by defaultschneems2014-01-021-8/+1
| | | See https://github.com/rails/rails/pull/13463#issuecomment-31480799 for full conversation.
* Automatically maintain test database schemaJon Leighton2014-01-023-3/+57
| | | | | | | | | | | | | | * Move check from generated helper to test_help.rb, so that all applications can benefit * Rather than just raising when the test schema has pending migrations, try to load in the schema and only raise if there are pending migrations afterwards * Opt out of the check by setting config.active_record.maintain_test_schema = false * Deprecate db:test:* tasks. The test helper is now fully responsible for maintaining the test schema, so we don't need rake tasks for this. This is also a speed improvement since we're no longer reloading the test database on every call to "rake test".
* Adding missing requireRafael Mendonça França2014-01-021-0/+1
|
* Move default production database to URL sub keyschneems2014-01-011-1/+5
| | | | By using the URL sub key in the `database.yml` by default we are exposing the ability to set other attributes such as `pool` or `reap_frequency` without need of modifying the URL to contain non-connection specific information.
* fix 2.1.0 bug :(schneems2013-12-251-1/+1
|
* ensure environment is run before db:structure:loadschneems2013-12-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Right now `db:drop` depends on `load_config` since so when `db:drop` gets executed `load_config` gets run. `db:structure:load` depends on `[:environment, :load_config]`. So before it runs, it executes `environment` but because `load_config` has already executed it is skipped. Note `db:load_config` is "invoke"-d twice, but only "execute"-d once: ``` ** Invoke db:drop (first_time) ** Invoke db:load_config (first_time) ** Execute db:load_config ** Execute db:drop ** Invoke db:structure:load (first_time) ** Invoke environment (first_time) ** Execute environment ** Invoke db:load_config ** Execute db:structure:load ``` The fix for this is making sure that the environment is run before any `load_config`: ``` ** Invoke environment (first_time) ** Execute environment ** Invoke db:drop (first_time) ** Invoke db:load_config (first_time) ** Execute db:load_config ** Execute db:drop ** Invoke db:structure:load (first_time) ** Invoke environment ** Invoke db:load_config ** Execute db:structure:load ```
* Partial fix of database url testsschneems2013-12-251-1/+4
| | | | | | | | Prior to #13463 when `DATABASE_URL` was set, Rails automagically used that value instead of the database.yml. There are tests in dbs_test that expect this to still be true. After that PR, `RAILS_DATABASE_URL` is expected to be read into the YAML file via ERB, this PR fixes that behavior. Note: this does not entirely fix the tests. It seems that `ActiveRecord::Tasks::DatabaseTasks.current_config` does not process the url string correctly (convert it into a hash), and ` ActiveRecord::Tasks::DatabaseTasks.structure_load(current_config, filename)` as well as other methods in `DatabaseTasks` expect a hash. It seems like we should involve the resolver somewhere in this process to correctly convert the database url, I do not know the best place for that /cc @josevalim
* Fix tests names: tokens.yml => secrets.ymlGuillermo Iguaran2013-12-251-2/+2
|
* using symbol instead of string in establish_connectionKuldeep Aggarwal2013-12-251-1/+1
|
* Revert "Ensure secret_key_base is set for all environments"José Valim2013-12-241-2/+1
| | | | | | A better solution has been pushed to master. This reverts commit 959cfcef7255bba720ce3f15323056533ea7b50a.
* Fix railties tests in masterschneems2013-12-241-1/+2
| | | | | Tests are failing due to missing env var on master https://travis-ci.org/rails/rails/jobs/15930622#L641 This adds an environment variable `ENV['RAILS_SECRET_KEY_BASE']` so these tests will pass.
* Ensure secret_key_base is set for all environmentsJosé Valim2013-12-241-1/+2
|
* Fix build failures related to the new ENV options in ymlJosé Valim2013-12-241-0/+18
|
* Add comments with urls for email previewsAndrew White2013-12-221-6/+11
|
* Use Full path to sqlite database in testsschneems2013-12-222-4/+4
|
* Fix DB Console tests schneems2013-12-211-20/+22
| | | | | | | | | | | The build is broken: https://travis-ci.org/rails/rails/builds/15824530 This commit fixes it. The problem: Sqlite expects the `database` part to be an absolute path. That prompted this change to be committed to master: https://github.com/rails/rails/commit/fbb79b517f3127ba620fedd01849f9628b78d6ce This change provides correct behavior. Unfortunately tests were introduced in https://github.com/rails/rails/commit/971d5107cd4cd08c22a85d34546f4ba03ed5c925 that were relying on the incorrect behavior. We can avoid the fix by changing to another database url such as `mysql` or `postgresql` In addition to fixing the failure, the assertions are changed so that the "expected" value comes before "actual" value.
* `html` and `text` templates for mailers by defaultKassio Borges2013-12-201-1/+15
|
* Make possible to use symbol as the verifier nameRafael Mendonça França2013-12-191-6/+6
|
* Change all `MiniTest` to `Minitest` since, `MiniTest` namespace has been ↵Vipul A M2013-12-181-2/+2
| | | | | | renamed to `Minitest` Ref: https://github.com/seattlerb/minitest/blob/master/History.txt
* Default I18n.enforce_available_locales to trueCarlos Antonio da Silva2013-12-171-4/+38
| | | | | | | | | | | | We will default this option to true from now on to ensure users properly handle their list of available locales whenever necessary. This option was added as a security measure and thus Rails will follow it defaulting to secure option. Also improve the handling of I18n config options in its railtie, taking the new enforce_available_locales option into account, by setting it as the last one in the process. This ensures no other configuration will trigger a deprecation warning due to that setting.
* Add mailer previews feature based on mail_view gemAndrew White2013-12-172-3/+421
|