Commit Graph

1150 Commits

Author SHA1 Message Date
Andrew White
ce7d5fb2e6 Add support for defining custom url helpers in routes.rb
Allow the definition of custom url helpers that will be available
automatically wherever standard url helpers are available. The
current solution is to create helper methods in ApplicationHelper
or some other helper module and this isn't a great solution since
the url helper module can be called directly or included in another
class which doesn't include the normal helper modules.

Reference #22512.
2017-02-21 15:30:46 +00:00
Kasper Timm Hansen
c1b64429b1 Fix run_via[]= backwards compatibility.
```
Minitest.run_via[:rails] = true
```

👆 would break because a simple alias won't catch the second
true argument there.
2017-02-21 08:28:28 +01:00
Ryuta Kamizono
416d85b65e
Remove unused require
These files are not using `strip_heredoc`.

Closes #27976
2017-02-12 19:38:49 -07:00
Benjamin Fleischer
c8b5d828e7 Correct spelling
```
go get -u github.com/client9/misspell/cmd/misspell
misspell  -w -error -source=text .
```
2017-02-05 19:00:18 -06:00
Dominic Cleal
1c8a4cdf63
Collect all file patterns when running multiple rake test tasks
Replaces the rake_patterns instance variable with simple require, as
`autorun` will run tests from all eagerly required test files.

Fixes #27801
2017-02-04 13:54:52 +01:00
Eugene Kenny
ebededb372
Don't mutate raw_source in mailer preview interceptor
The raw_source method is documented as returning the exact value that
was used to create the body; mutating it breaks that contract.

Additionally, if the value used to create the body is blank, raw_source
returns a frozen string which causes the interceptor to raise an error.
2017-01-30 22:20:47 -07:00
Arthur Nogueira Neves
543f19626b Merge pull request #27797 from y-yagi/correctly_check_error_message
correctly check error message
2017-01-30 20:16:30 -05:00
Rafael França
341fab88a3 Merge pull request #27784 from y-yagi/add_warnings_option_to_test_runner
add warnings option to test runner
2017-01-30 12:48:13 -05:00
yuuji.yaginuma
30206aeff9 remove warning from bin/setup test
This removes the following warnings.

```
test/application/bin_setup_test.rb:43: warning: ambiguous first argument; put parentheses or a space even after `/' operator
```
2017-01-26 07:41:37 +09:00
yuuji.yaginuma
c42bd31977 correctly check error message
`assert_raise` does not check error message. However, in some tests,
it seems like expecting error message checking with `assert_raise`.
Instead of specifying an error message in `assert_raise`, modify to use
another assert to check the error message.
2017-01-25 09:58:15 +09:00
yuuji.yaginuma
4ed0f36689 add warnings option to test runner 2017-01-24 11:05:41 +09:00
Matthew Draper
c309073c74 Bundler 1.14 compat 2017-01-23 12:49:16 -05:00
Akira Matsuda
2d61745af4 Merge two tests that needs to initialize Rails before accessing Rails
Fixes "NameError: uninitialized constant ApplicationTests::ConfigurationTests::CustomTest::Rails"
when run individually
2017-01-23 02:56:17 +09:00
yuuji.yaginuma
bdc8818330 update CREATE TABLE statements generated by sqlite3 command
From SQLite 3.16.0, `IF NOT EXISTS` set to CREATE TABLE statements.
Ref: https://www.sqlite.org/src/info/c7021960f5c070fb

Fixes #27635.
2017-01-19 12:37:09 +09:00
Rafael Mendonça França
209bfc0a5c
Fix style guide violations 2017-01-05 00:40:24 -05:00
Rafael Mendonça França
50cb1b697c
Merge pull request #27399 from sinogermany/rails-env-for-empty-string-env-vars
Rails env for empty string env vars
2017-01-03 23:37:37 -05:00
Daniel Deng
498370c05b Rails.env falls back to dev mode when env var is empty 2017-01-04 15:03:30 +11:00
Rafael Mendonça França
b9db45bb63
Fix configuration test now that Metal#env was removed 2017-01-03 22:36:36 -05:00
Rafael Mendonça França
35404ae046
Remove test to the db:test:clone 2017-01-03 20:42:14 -05:00
Rafael Mendonça França
f9ed83321a
Remove deprecated CONTROLLER environment variable for routes task 2017-01-03 20:42:14 -05:00
Rafael Mendonça França
0129ca2eeb
Remove deprecated config.serve_static_files 2017-01-03 20:42:14 -05:00
Rafael Mendonça França
c861decd44
Remove deprecated config.static_cache_control 2017-01-03 20:42:13 -05:00
Matthew Draper
6b126ffdcd Enforce middleware ordering with a test, instead of comments
We want the actual order to be very predictable, so it's rightly defined
in code -- not with an on-the-fly tsort.

But we can do the tsort here, and then verify that it matches the
implemented ordering. This way we don't leave future readers guessing
which parts of the ordering are deliberate and which are arbitrary.
2016-12-31 08:40:01 +10:30
Matthew Draper
2c5190e329 Merge pull request #27515 from kbrock/fix_log_remote_ip_before_dispatcher_ips_settings
Allow log remote ip addres when config.action_dispatch.trusted_proxie…
2016-12-31 08:30:18 +10:30
Leonid Batizhevsky
6efdb7177b Allow log remote ip addres when config.action_dispatch.trusted_proxies passed 2016-12-30 15:57:32 -05:00
Rafael Mendonça França
5973a984c3
#tables and #table_exists? and returns only tables and not views 2016-12-29 17:53:04 -05:00
Rafael Mendonça França
e646bad5b7
Remove deprecated support to passing a column to #quote 2016-12-29 17:53:03 -05:00
Rafael França
eb6a6141a6 Merge branch 'master' into clear_all_environments_log_by_default 2016-12-29 02:18:38 -05:00
Akira Matsuda
e8ba0c0f21 "Use assert_nil if expecting nil. This will fail in minitest 6." 2016-12-25 02:29:52 +09:00
Akira Matsuda
10fb7211bb Privatize unneededly protected methods in Railties tests 2016-12-24 00:22:23 +09:00
yuuji.yaginuma
baa8c5ad0f quiet generators log in test
This quiet the following log.

```
   create  app/mailers/notifier_mailer.rb
   invoke  erb
   create    app/views/notifier_mailer
identical    app/views/layouts/mailer.text.erb
identical    app/views/layouts/mailer.html.erb
   create    app/views/notifier_mailer/foo.text.erb
   create    app/views/notifier_mailer/foo.html.erb
   invoke  test_unit
   create    test/mailers/notifier_mailer_test.rb
   create    test/mailers/previews/notifier_mailer_preview.rb
```
2016-12-22 11:01:15 +09:00
Jon Moss
c79c40ed82 Limit length of secret being passed
Very similar to PR #25758, see more in depth reasoning there.
2016-12-20 15:07:33 -05:00
Jon Moss
fa69b2c035 ARGV.shift before calling Rails generators
Gems like rspec-rails depend on `ARGV` being shifted, and `scaffold`
(for example) not being the first item in `ARGV`. This should allow
rspec-rails to be passing on Rails master.
2016-12-17 14:01:25 -05:00
Rafael França
ddf81c5aa5 Merge pull request #27042 from kirs/yaml-schema-cache
Schema cache in YAML
2016-12-13 11:59:45 -05:00
Kir Shatrov
4c00c6ed23 Use YAML to serialize schema cache 2016-11-27 22:09:58 -05:00
Taishi Kasuga
da1453e6ba Remove aggressive unit test with mock. And add integration level test. 2016-11-24 14:17:13 +09:00
Isaac Sloan
7102c6ce89 deep symbolize keys on secrets.yml 2016-11-21 16:12:45 -07:00
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
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
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
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
Rafael Mendonça França
fe1f4b2ad5
Add more rubocop rules about whitespaces 2016-10-29 01:17:49 -02: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
yuuji.yaginuma
447e1a4881 clear all environments log files by default
In #22703, `log:clear` task has been changed to clear only standard environment
log files.
However, it is often to add a non-standard environment(e.g. "staging").
Therefore, I think than it is better to clear all environments log files by default.
2016-10-14 08:52:35 +09: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
Kasper Timm Hansen
6813edc7d9 Initial command structure. 2016-09-25 21:31:35 +02:00
Arthur Nogueira Neves
0ce117fac3 Merge pull request #26515 from grosser/grosser/after_run
support minitest after_run
2016-09-23 23:28:37 -04:00
yuuji.yaginuma
05fa6f3db6 use rails command in restart task test 2016-09-19 10:17:30 +09:00
Michael Grosser
a9aed2ac94
improve error message when include assertions fail
assert [1, 3].includes?(2) fails with unhelpful "Asserting failed" message

assert_includes [1, 3], 2 fails with "Expected [1, 3] to include 2" which makes it easier to debug and more obvious what went wrong
2016-09-16 12:03:37 -07:00