Commit Graph

754 Commits

Author SHA1 Message Date
Yves Senn
d28e5b94a7 introduce ActiveSupport::Testing::FileFixtures.
It's a thin layer to provide easy access to sample files throughout
test-cases. This adds the directory `test/fixtures/files` to newly
generated applications.
2015-01-28 12:29:34 +01:00
Sean Griffin
0b2e0528df Add the method_source gem to the default Gemfile
Fixes #18473
2015-01-13 10:24:10 -07:00
robertomiranda
5cca205114 Add Secure Token Generator 2015-01-11 14:42:54 -05:00
Nobuyoshi Nakada
69e365d2f4 Use IO::NULL always 2015-01-10 15:11:05 +01:00
Carlos Souza
6870d48d19 Add _mailer suffix to i18n path
For mailers created via generators

Follow up to #18074
2015-01-08 22:24:22 -05:00
Carlos Souza
5697bdbb6d Add mailer suffix to generated files and classes
Following the same naming convention used in
controllers and jobs.
2015-01-06 10:46:22 -05:00
Rafael Mendonça França
93559da482 Remove debugger support
bebugger doesn't work with Ruby 2.2 so we don't need to support it
anymore
2015-01-04 15:54:22 -03:00
Rafael Mendonça França
a939506f29 Change the default null value for timestamps to false 2015-01-04 11:58:43 -03:00
Rafael Mendonça França
481e49c64f Remove deprecated methods at Kernel.
`silence_stderr`, `silence_stream`, `capture` and `quietly`.
2015-01-04 11:58:40 -03:00
Carlos Antonio da Silva
217e5f6e4a Improve the matches on the scaffold generator tests
Related to #13434.
2015-01-03 20:30:31 -02:00
Carlos Antonio da Silva
1468a11f9b Merge pull request #13434 from tanraya/local_variables
Use local variables in _form.html.erb generated by scaffold.

Conflicts:
	railties/CHANGELOG.md
2015-01-03 20:20:05 -02:00
Rafael Mendonça França
4591b0fc04 Merge pull request #17227 from claudiob/explicitly-abort-callbacks
Introduce explicit way of halting callback chains by throwing :abort. Deprecate current implicit behavior of halting callback chains by returning `false` in apps ported to Rails 5.0. Completely remove that behavior in brand new Rails 5.0 apps.

Conflicts:
	railties/CHANGELOG.md
2015-01-03 17:22:20 -03:00
Pablo Olmos de Aguilera Corradini
9405ecdd98 Generated fixtures won't use parent_id when generated with parent:references
Fix #18301
2015-01-02 23:01:24 -03:00
claudiob
9c65c539e2 Add config to halt callback chain on return false
This stems from [a comment](rails#17227 (comment)) by @dhh.
In summary:

* New Rails 5.0 apps will not accept `return false` as a way to halt callback chains, and will not display a deprecation warning.
* Existing apps ported to Rails 5.0 will still accept `return false` as a way to halt callback chains, albeit with a deprecation warning.

For this purpose, this commit introduces a Rails configuration option:

```ruby
config.active_support.halt_callback_chains_on_return_false
```

For new Rails 5.0 apps, this option will be set to `false` by a new initializer
`config/initializers/callback_terminator.rb`:

```ruby
Rails.application.config.active_support.halt_callback_chains_on_return_false = false
```

For existing apps ported to Rails 5.0, the initializers above will not exist.
Even running `rake rails:update` will not create this initializer.

Since the default value of `halt_callback_chains_on_return_false` is set to
`true`, these apps will still accept `return true` as a way to halt callback
chains, displaying a deprecation warning.

Developers will be able to switch to the new behavior (and stop the warning)
by manually adding the line above to their `config/application.rb`.

A gist with the suggested release notes to add to Rails 5.0 after this
commit is available at https://gist.github.com/claudiob/614c59409fb7d11f2931
2015-01-02 15:31:56 -08:00
Carlos Antonio da Silva
b63382ec06 Remove warnings
warning: ambiguous first argument; put parentheses or a space even after
    `/' operator'`
2015-01-02 10:29:57 -02:00
Carlos Antonio da Silva
120bf7444f Verify the helper name with plural as it is generated
Thanks @robin850.
2015-01-02 10:29:36 -02:00
claudiob
b6f50b3fa8 Add --skip-action-mailer (or -M) to rails generate 2015-01-01 18:46:12 -08:00
Rafael Mendonça França
4ba0e2fc22 Fix scaffold generator with --helper=false option 2015-01-01 23:16:30 -03:00
Rafael Mendonça França
ac0a8eec62 Fix test description to match the test behaviour 2015-01-01 22:44:30 -03:00
Rafael Mendonça França
156c657731 Remove some warning with Ruby 2.2 2014-12-29 16:09:59 -03:00
Sean Griffin
b7d7e0b15e Add test missed by a03ea684efc3505647cf0327a501aa2dbb591ad2 2014-12-22 14:05:35 -07:00
Sean Griffin
a03ea684ef Use the new foreign_key option on references in generators
Changes `rails g model Post user:references` from

    def change
      create_table :posts do |t|
        t.references :user, index: true
      end

      add_foreign_key :posts, :users
    end

to

    def change
      create_table :posts do |t|
        t.references :user, index: true, foreign_key: true
      end
    end

Changes `rails g migration add_user_to_posts user:references` from

    def change
      add_reference :posts, :users, index: true
      add_foreign_key :posts, :users
    end

to

    def change
      add_reference :posts, :users, index: true, foreign_key: true
    end
2014-12-22 13:47:11 -07:00
Sean Griffin
9fff631a06 Skip byebug on all non-MRI rubies, fix tests
The changes in #18149 added tests for the app generator, but only fixed
it for the plugin generator (I should have let CI finish though I think
it would have failed as an allowed failure).
2014-12-22 13:43:58 -07:00
Arthur Neves
0bb73f03e4
Only add debugger/byebug if on MRI 2014-12-22 15:27:56 -05:00
NorimasaAndo
8493f44976 Fix Duplicate web-console entries in Gemfile 2014-12-14 21:25:26 +09:00
Rafael Mendonça França
78504600f5 Merge pull request #17953 from kirs/test-activejob-generator
Test coverage for ActiveJob generator
2014-12-08 14:31:37 -02:00
Kir Shatrov
1bf42df031 Test coverage for ActiveJob generator 2014-12-07 08:29:12 +03:00
Rafael Mendonça França
da13b9aedc Merge pull request #17797 from y-yagi/donot_delete_mailer_layouts
Don't remove mailer layouts files
2014-12-04 18:29:50 -02:00
Guo Xiang Tan
106db0b419 Silence Minitest for plugin tests.
Fixes https://github.com/rails/rails/issues/17340.

Use Minitest::BacktraceFilter instead of removing all silencers. This
will allow the backtrace for all libraries in the plugin to be shown
while removing noise generated by Minitest's backtrace.
2014-12-02 18:47:03 +08:00
yuuji.yaginuma
f9411b464d Don't remove mailer layouts files 2014-11-27 14:36:10 +09:00
Derek Prior
323334a775 Generators add foreign keys on references
If you run a generator such as:

```
rails generate model accounts supplier:references
```

The resulting migration will now add the corresponding foreign key
constraint unless the reference was specified to be polymorphic.
2014-11-25 20:22:58 -02:00
Guo Xiang Tan
7a47690a13 Generate mailer layouts even if no action is given. 2014-11-25 09:21:37 +08:00
Guo Xiang Tan
b8d8ce7ba8 Add tests which were incorrectly removed. 2014-11-25 09:14:59 +08:00
Andy Jeffries
38cfaa8285 Creates an ApplicationMailer and layout by default, including html and body tags to reduce spam score 2014-11-21 16:46:49 +00:00
Benjamin Fleischer
a7fd386b63 Fix rbx generated Gemfile regex
https://travis-ci.org/rails/rails/jobs/39190983#L460

 1) Failure:
 AppGeneratorTest#test_psych_gem
 [test/generators/app_generator_test.rb:495]:
 Expected /gem 'psych',\s+'~> 2.0', \s+platforms: :rbx/ to match <snip>
 http://git.io/uuLVag)\ngem 'psych', '~> 2.0', platforms: :rbx\n\n
2014-10-27 16:03:53 -05:00
Rafael Mendonça França
bf17c8a531 Add back --skip-turbolinks and remove --skip-gems
For the most part of cases --skip-gems option just remove one line in
the Gemfile. This is not worth for the complexity it adds.

Closes #17196
2014-10-26 20:47:47 -05:00
Yves Senn
ee787d9f58 test, Generators::GeneratedAttribute with references, required, index.
Closes #17197.
Closes #17207.

`{required}` is a type modifier so it should be:

    user:references{required}:index

and not:

    user:references:index{required}
2014-10-16 15:50:13 +02:00
masarakki
a441293cd9 fix test_helper for mountable plugin 2014-10-13 22:17:50 +09:00
Dan Olson
8e9bc11d22 Remove --skip-action-view option from application generator 2014-09-24 10:25:59 -05:00
Yukio Mizuta
7137c6b775 Specify dummy app's db migrate path in plugin's test_helper.rb 2014-09-16 20:21:17 -07:00
Yukio Mizuta
8c9b347342 Use dynamic path for dummy app location in plugin's test_helper.rb 2014-09-14 10:55:19 -07:00
Akira Matsuda
357edaaf83 Rails.root should be a Pathname 2014-08-28 14:41:00 +09:00
Yves Senn
b9b521306c fix broken gem method with non-String arguments. Closes #16709.
This was caused by #15327.
2014-08-27 12:30:35 +02:00
slainer68
2eacdb0cbf Require ActiveJob in case a skip_xxx option is given
Change position of require active_job
2014-08-20 18:08:41 +02:00
Rafael Mendonça França
76883f9237 Merge pull request #16062 from sgrif/sg-required-generators
Add a `required` option to the model generator
2014-08-17 22:57:21 -03:00
Sean Griffin
ea3ba34506 Change the default null value for timestamps
As per discussion, this changes the model generators to specify
`null: false` for timestamp columns. A warning is now emitted if
`timestamps` is called without a `null` option specified, so we can
safely change the behavior when no option is specified in Rails 5.
2014-08-12 14:40:11 -06:00
Arun Agrawal
301b5fd522 Fixes test for Gemfile entry changes
Broken by fbe38c9e9d4fe9f82518e8ffc1d757459b0c5f1c
2014-08-08 19:50:25 +02:00
Sean Griffin
fdfc0fc6c9 Add a required option to the model generator
Syntax was chosen to follow the passing of multiple options to
decimal/numeric types. Curly braces, and allowing any of `,`, `.`, or
`-` to be used as a separator to avoid the need for shell quoting. (I'm
intending to expand this to all columns, but that's another PR.

The `required` option will cause 2 things to change. `required: true`
will be added to the association. `null: false` will be added to the
column in the migration.
2014-08-08 10:29:27 -06:00
Yves Senn
a819211984 Merge pull request #16359 from skanev/after-bundle-in-rails-templates
Add an after_bundle callback in Rails templates

Conflicts:
	railties/CHANGELOG.md
2014-08-06 08:49:00 +02:00
José Valim
e5e4d08450 Bring back the helpers tests
Also keep the hook as other tools may rely on it,
we just don't do anything by default on Rails.
2014-08-05 14:04:30 +02:00