Commit Graph

11465 Commits

Author SHA1 Message Date
Kasper Timm Hansen
5aea0952e7 Pass rails runner args onto file again.
When making the new command insfrastructure I had missed that
`bin/rails runner some_file.rb some args` would pass the extra
args onto the file in `ARGV`.

Now fixed by allowing the command to take extra args again, and
make sure to remove the file name from `ARGV`.
2016-11-20 16:02:39 +01:00
Guillermo Iguaran
03fc9a4930 Use existing --skip-turbolinks option for conditionals instead of checking if turbolinks is present in gemfile list 2016-11-19 21:26:34 -05:00
Eileen M. Uchitelle
64127cde8c Merge pull request #27106 from prathamesh-sonpatki/add-missing-test
Add missing test for singular resource output in rake routes
2016-11-19 15:41:09 -05:00
Prathamesh Sonpatki
b945c9ad62
Add missing test for singular resource output in rake routes
- This test was present in https://github.com/rails/rails/pull/27089
  but not present on master, may be removed in merge commit?
- There was discussion about moving this to `application/rake_test` so
  may be this happened in merge commit.
- https://github.com/rails/rails/pull/27089#discussion_r88731157
2016-11-19 16:24:28 +05:30
yuuji.yaginuma
f5e738b604 move CHANGELOG entry to the appropriate file [ci skip]
Follow up to #27098
2016-11-19 16:18:21 +09:00
Rafael Mendonça França
ff2fe014d9
Merge pull request #27089 from erickueen/erickueen_fix_26606
Fix incorrect output from rails routes when using singular resources …
2016-11-18 17:38:35 -05:00
Rafael França
8106a177a4 Merge pull request #27092 from prathamesh-sonpatki/https-source-bundler
Use secure source for gems referencing "github" in the generated apps
2016-11-18 16:54:31 -05:00
Erick Reyna
c79848e1e7 Fix incorrect output from rails routes when using singular resources issue #26606
Rails routes (even rake routes in previous versions) output showed incorrect routes when an application use resource :controller, implying that edit_controller_path match with controller#show.
The order of the output has changed to correct this. View #26606 for more information.

Added a test case, change unit test in rake to expect the new output.
Since the output of resource :controller is changing, the string spected of the railties/test/application/rake_test.rb test_rails_routes_with_controller_environment had to be modified.
2016-11-18 15:12:13 -06:00
Tawan Sierek
064744bef6
Fix ActionDispatch::IntegrationTest#open_session
Reset a new session directly after its creation in
`ActionDispatch::IntegrationTest#open_session`. Reset the session to a clean
state before making it available to the client's test code.

Issue #22742 reports unexpected behavior of integration tests that run multiple
sessions. For example an `ActionDispatch::Flash` instance is shared across
multiple sessions, though a client code will rightfully assume that each new
session has its own flash hash.

The following test failed due to this behavior:

    class Issue22742Test < ActionDispatch::IntegrationTest
      test 'issue #22742' do
        integration_session # initialize first session
        a = open_session
        b = open_session

        refute_same(a.integration_session, b.integration_session)
      end
    end

Instead of creating a new `ActionDispatch::Integration::Session` instance,
the same instance is shared across all newly opened test sessions. This is
due to the way how new test sessions are created in
`ActionDispatch::IntegrationTest#open_session`. The already existing
`ActionDispatch::IntegrationTest` instance is duplicated  with `Object#dup`,
This approach was introduced in commit 15c31c7639b. `Object#dup` copies the
instance variables, but not the objects they reference. Therefore this issue
only occurred when the current test instance had been tapped in such a way that
the instance variable `@integration_session` was initialized before creating the
new test session.

Close #22742

[Tawan Sierek + Sina Sadeghian]
2016-11-18 15:07:16 -05:00
Prathamesh Sonpatki
efcc361b32
Use secure source for gems referencing "github" in the generated apps
- New apps generated on master and latest bundler give warning about
  "github" source being insecure.
- Use the same solution used for Rails master in the generated app's
  Gemfile to fix this issue.
2016-11-18 12:24:48 +05:30
Tsukuru Tanimichi
592c06d7cb Add :skip_sprockets to Rails::PluginBuilder::PASSTHROUGH_OPTIONS
`rails plugin new` with `--full` and `--skip-sprockets` options generates a dummy application that throws `NoMethodError`.

```
% rails plugin new my_engine -S --full --skip-gemspec
% cd my_engine
% bin/rails test
rails aborted!
NoMethodError: undefined method `assets' for #<Rails::Application::Configuration:0x007f83aa1e6100>
```
2016-11-14 20:56:49 +09:00
Andrew White
0ef5b6c163 Merge pull request #26905 from bogdanvlviv/docs
Add missing `+` around a some literals.
2016-11-13 14:09:30 +00:00
Sean Griffin
d2e84fa919 Add test for #25248 2016-11-12 15:10:59 -05:00
Sean Griffin
33d47a09d4 Merge pull request #25248 from bluesh55:features/skip-coffee
Add --skip-coffee generating option
2016-11-12 15:10:28 -05:00
yuuji.yaginuma
9d700ad625 remove unused require
YAML and ERB were removed at 971d510
2016-11-05 14:24:05 +09:00
Akira Matsuda
7b0b119c50 Use tr instead of gsub 2016-11-02 16:59:53 +09:00
yuuji.yaginuma
34530f5bd5 remove warning from railtie
This removes the following warnings.

```ruby
rails/railties/lib/rails/railtie.rb:186: warning: instance variable @rake_tasks not initialized
rails/railties/lib/rails/railtie.rb:186: warning: instance variable @rake_tasks not initialized
rails/railties/lib/rails/railtie.rb:186: warning: instance variable @load_console not initialized
rails/railties/lib/rails/railtie.rb:186: warning: instance variable @rake_tasks not initialized
```
2016-11-02 11:08:03 +09:00
Arthur Neves
9ebb3558f4
Make register_block_for private 2016-11-01 19:24:10 -04:00
Bouke van der Bijl
de08be6af6
Don't put db:migrate and db:setup in binfiles if activerecord is excluded 2016-11-01 14:29:29 -04:00
Arthur Neves
4a8edc0d82
Merge PR #26052 2016-11-01 12:37:23 -04:00
Rafael Fidelis
8360d9944b
Added register_block method to register rake_tasks, generators, console & runner blocks
fixing @generators var initialization

pre initializing variables values

Changing from var init to symbol to instance var get/set
2016-11-01 12:34:38 -04:00
Rafael Mendonça França
fe1f4b2ad5
Add more rubocop rules about whitespaces 2016-10-29 01:17:49 -02:00
Rafael Mendonça França
a8b996a0ee
Revert "Merge pull request #23698 from meinac/add_missing_types_into_ar_model_generator_usage"
This reverts commit aaf561d26cf9a879ff40190b625155015c6225da, reversing
changes made to 83776676e54b387fc52081ff31cfd7710bae9e03.

Reason: It is not a good idea to connect to the database on generators
2016-10-28 21:21:24 -02:00
Arthur Nogueira Neves
aaf561d26c Merge pull request #23698 from meinac/add_missing_types_into_ar_model_generator_usage
Dynamically show available sql types [ci skip]
2016-10-28 17:09:28 -04:00
Kasper Timm Hansen
83776676e5 Hide commands from API site.
They're just barren on the site and confure more than guide, instead
rely on the built in --help to guide users.
2016-10-28 20:44:58 +02:00
Akira Matsuda
a36ef6ee3e Explicitly show --no-helper and --no-assets options in help message
I'm sorry for causing #24168. I wasn't aware of --no-helper and --no-assets.
So I'm adding them to the help message.
I'm still not sure how to show `--no-test-framework` though.
2016-10-28 13:00:08 +09:00
bogdanvlviv
5faa9a235c Add missing + around a some literals.
Mainly around `nil`

[ci skip]
2016-10-27 00:27:47 +03:00
yuuji.yaginuma
5b54a90410 remove assets config from new_framework_defaults if --skip-sprockets is true
If `sprockets` is not loaded, `Rails.application.config.assets` is not defined.
2016-10-25 07:58:05 +09:00
Aaron Patterson
b6f935bbf9
Use on_load to trigger commandline processing code
We need to use on_load so that plugins will get the same functionality
2016-10-21 14:44:17 -07:00
Aaron Patterson
797f1dd63c
Prevent the test framework from being loaded in production mode
The test framework should not be autoloaded in production mode.  Before
this commit, the testing railtie would extend AS::TestCase.  This caused
AS::TestCase to be preloaded regardless of the environment in which we
were running.

This commit just moves the code that adds line filtering support in to
the test command where we actually execute the test runner.  That allows
us to maintain the line runner feature but only load the minimal amount
of code we need.
2016-10-21 13:10:26 -07:00
José Gomes Júnior
1b7263143a don't create db directory when skip active_record 2016-10-21 10:51:31 -02:00
Rafael Mendonça França
fda5afeb79
Remove deprecated code in ssl middleware 2016-10-10 01:35:59 -03:00
Rafael Mendonça França
79a5ea9ead
Remove deprecated support to :text in render 2016-10-10 00:02:52 -03:00
Esteban Santana Santana
ddddedc487 Allow the use of listen's 3.1.x branch.
When the initial evented monitor feature was written, the latest version of listen
was the 3.0.x series. Since then the listen project has moved on to the 3.1.x series.
This patch allows the use of the new versions.
2016-10-03 16:58:17 +05:30
yuuji.yaginuma
ca41fafd9a remove mongrel once again
`mongrel` was removed in #26408. But have back accidentally in #26414.
2016-09-29 17:30:56 +09:00
yuuji.yaginuma
1269795ae2 use active_support/testing/autorun in bin/test script
29f0fbd5db643b885665e4a14c7de3bf6c0d9c96 has changed that always call
`Minitest.autorun` in `active_support/testing/autorun`.

Therefore, when used directly `Minitest.run`, tests are performed twice.
2016-09-27 19:34:58 +09:00
Kasper Timm Hansen
c994a893c1 Merge pull request #26414 from rails/rails-commands
Initial Rails Commands Infrastructure
2016-09-26 20:28:40 +02:00
Kasper Timm Hansen
c0c73738bd Apply test command changes. 2016-09-26 17:19:59 +02:00
Kasper Timm Hansen
d5457af76f Fix server command tests. 2016-09-25 21:31:46 +02:00
Kasper Timm Hansen
0fd5377a36 Fix dbconsole tests. 2016-09-25 21:31:46 +02:00
Kasper Timm Hansen
47e4795060 Apply Rafaels review fixes. 2016-09-25 21:31:46 +02:00
Kasper Timm Hansen
efd808755c Fix console tests. 2016-09-25 21:31:45 +02:00
Kasper Timm Hansen
03c982fa34 Remove the old command files.
Wash out your old! These adhoc scripts are replaced by the new
commands.
2016-09-25 21:31:45 +02:00
Kasper Timm Hansen
4e106ee08b Per Dr. Eileen's orders :)
Prescribed some review fixes for myself!
2016-09-25 21:31:36 +02:00
Kasper Timm Hansen
993c0696e6 Simplify auxiliary command files directory finding.
Still vulnerable to different file structures. We likely want something
more robust when we tackle in app commands.
2016-09-25 21:31:35 +02:00
Kasper Timm Hansen
d5bd4b259f Run engine commands through command infrastructure. 2016-09-25 21:31:35 +02:00
Kasper Timm Hansen
6813edc7d9 Initial command structure. 2016-09-25 21:31:35 +02:00
Kasper Timm Hansen
6b8e6c4fbd Merge pull request #26579 from y-yagi/remove_unnecessary_rails_env_setting
remove unnecessary `RAILS_ENV` setting
2016-09-25 21:11:58 +02:00
Kasper Timm Hansen
b724dbbb8b Use autorun when running via Rake.
Makes sure we get support for `Minitest.after_run` hooks and don't
accidentally run tests twice.

Requires overriding minitest `run` to respect the TESTOPTS variable.
2016-09-25 20:57:50 +02:00
Kasper Timm Hansen
29f0fbd5db Revise setting of run_with_rails_extension.
The Rails test runner supports three ways to run tests: directly, via rake, or ruby.

When Running with Ruby ala `ruby -Itest test/models/post_test.rb` our test file would
be evaluated first, requiring `test_helper` and then `active_support/testing/autorun`
that would then require the test file (which it hadn't been before) thus reevaluating
it. This caused exceptions if using Active Support's declarative syntax.

Fix this by shifting around when we set the how we're run to closer mimick the require
order.

If we're running with `bin/rails test` the test command file is run first and we then
set `run_with_rails_extension`, later we hit `active_support/testing/autorun` and do
nothing — because we've been run elsewhere.

If we at this point haven't set `run_with_rails_extension` we've been running with
`ruby` this whole time and thus we set that.

We should always trigger `Minitest.autorun` as it doesn't hurt to call it twice.

Consolidate the two methods into a single one that better brings out the intent of
why they're there.
2016-09-25 20:36:30 +02:00