Commit Graph

2526 Commits

Author SHA1 Message Date
Andrew White
fef1064052 Merge pull request #21804 from merhard/mounted_engine_route_fix
Mounted engine route fix
2015-10-07 22:25:39 +01:00
Kasper Timm Hansen
54f3a18eec Output inline is set to true in the plugin.
Change the reporter to just read the option.

Pass output_inline where needed in tests.
2015-10-07 22:49:41 +02:00
Kasper Timm Hansen
11a3e02237 Refactor create_test_file to take a pass option.
Lets us cut the verbose and straight up duplicated setup in 3 tests down to one line.
2015-10-07 22:49:41 +02:00
Kasper Timm Hansen
da832016bf Hide Minitest's aggregated results if outputting inline.
We'd see the failures and errors reported after the run, which is needless, when we've already
reported them.

Turns:

```

.......................................S....................F

This failed

bin/rails test test/models/bunny_test.rb:14

....

Finished in 0.100886s, 1020.9583 runs/s, 1001.1338 assertions/s.

  2) Failure:
BunnyTest#test_something_failing [/Users/kasperhansen/Documents/code/collection_caching_test/test/models/bunny_test.rb:15]:
This failed

103 runs, 101 assertions, 1 failures, 0 errors, 1 skips

You have skipped tests. Run with --verbose for details.
```

Into:

```

...................S.......................................F

This failed

bin/rails test test/models/bunny_test.rb:14

......................

Finished in 0.069910s, 1473.3225 runs/s, 1444.7143 assertions/s.

103 runs, 101 assertions, 1 failures, 0 errors, 1 skips
```
2015-10-07 22:49:41 +02:00
Matthew Erhard
bcfbd8ba21 Fix mounted engine named routes regression
When generating the url for a mounted engine through its proxy, the path should be the sum of three parts:

1. Any `SCRIPT_NAME` request header or the value of `ActionDispatch::Routing::RouteSet#relative_url_root`.
2. A prefix (the engine's mounted path).
3. The path of the named route inside the engine.

Since commit 44ff0313c1, this has been broken. Step 2 has been changed to:

2. A prefix (the value of `ActionDispatch::Routing::RouteSet#relative_url_root` + the engine's mounted path).

The value of `ActionDispatch::Routing::RouteSet#relative_url_root` is taken into account in step 1 of the route generation and should be ignored when generating the mounted engine's prefix in step 2.

This commit fixes the regression by having `ActionDispatch::Routing::RouteSet#url_for` check `options[:relative_url_root]` before falling back to `ActionDispatch::Routing::RouteSet#relative_url_root`. The prefix generating code then sets `options[:relative_url_root]` to an empty string. This empty string is used instead of `ActionDispatch::Routing::RouteSet#relative_url_root` and avoids the duplicate `relative_url_root` value in the final result.

This resolves #20920 and resolves #21459
2015-10-07 12:45:01 -04:00
Aaron Patterson
24f9c03d52 Revert "removing Rack::Runtime from the default stack."
This reverts commit 37423e4ff883ad5584bab983aceb4b2b759a1fd8.

Jeremy is right that we shouldn't remove this.  The fact is that many
engines are depending on this middleware to be in the default stack.
This ties our hands and forces us to keep the middleware in the stack so
that engines will work.  To be extremely clear, I think this is another
smell of "the rack stack" that we have in place.  When manipulating
middleware, we should have meaningful names for places in the req / res
lifecycle **not** have engines depend on a particular constant be in a
particular place in the stack.  This is a weakness of the API that we
have to figure out a way to address before removing the constant.

As far as timing attacks are concerned, we can reduce the granularity
such that it isn't useful information for hackers, but is still useful
for developers.
2015-10-03 14:21:31 -07:00
Aaron Patterson
37423e4ff8 removing Rack::Runtime from the default stack.
The runtime header is a potential target for timing attacks since it
returns the amount of time spent on the server (eliminating network
speed).  Total time is also not accurate for streaming responses.

The middleware can be added back via:

```ruby
config.middleware.ues ::Rack::Runtime
```
2015-10-02 14:45:31 -07:00
Aaron Patterson
ff30db1372 run against edge sass to eliminate circular require warnings 2015-09-30 07:42:58 -07:00
Jeremy Daer
bb25c671c8 Merge pull request #21794 from jeremy/sprockets/move-asset-manifest-from-toplevel-to-config-subdir
Eliminate overlapping `app/assets` load path
2015-09-29 13:22:56 -07:00
Jeremy Daer
20ec1e922c Eliminate overlapping app/assets load path
* Move `app/assets/manifest.js` to `app/assets/config/manifest.js`.
  Avoid the suggestion that you can/should deep-link `stylesheets/foo`.
* Pull in all toplevel stylesheets and JavaScripts, not just
  `application.js` and `.css`. Demonstrate how to use `link_directory`
  with a specified `.js`/`.css` type.
* Fix RAILS_ENV handling in assets tests.
* Shush warnings spam from third-party libs that distract from tests.
2015-09-29 11:56:58 -07:00
Kasper Timm Hansen
2310fb9d81 Add fail fast to test runner.
Passing `--fail-fast` to the test runner will now abort the test run
on the first failure. The run continues on any unexpected errors.
2015-09-29 08:37:33 +02:00
Kasper Timm Hansen
64a3b09b40 Add inline failure reporting to test runner.
Any failures or errors will be reported inline during the run by default.
Skipped tests will be reported if run in verbose mode.

Any result is output with failure messages and a rerun snippet for that test.

Rerun snippets won't be output after a run, unless `--defer-output` is passed.
2015-09-28 20:30:03 +02:00
eileencodes
0ce3b97fa3 Fix test that was failing because of typo
Here `app` needed to be `get` because we're getting a route. This fixes
the typo so the test passes.
2015-09-27 11:39:32 -04:00
Aditya Kapoor
b5e82d99ef Add missing routing tests for info controller
Vaguely related to #21605 where I proposed to remove index route since it was redirecting to the 'routes' action,

but this was kept so I thought it made sense to add some tests regarding this.
2015-09-27 12:49:20 +05:30
amitkumarsuroliya
563020d8a1 Fix typo in configuration test descritive > descriptive [ci skip] 2015-09-26 18:10:07 +05:30
Aaron Patterson
46cd257aad make sure flash middleware is required 2015-09-25 15:53:15 -07:00
Ronak Jangir
d1a35c35d5 Removed Mocha from app generators tests 2015-09-23 23:36:25 +05:30
Kasper Timm Hansen
4aefd95945 Remove unneeded generator variable. 2015-09-22 18:07:00 +02:00
Ronak Jangir
352690e166 Removed mocha from Railites PluginGeneratorTest 2015-09-22 19:27:42 +05:30
yuuji.yaginuma
2e8146909a fix application_controller require_dependency path generated by the scaffold generator
This is follow up to #6643.
In #6643, the controller generator only had been fixed, in this commit to fix the scaffold generator.
2015-09-20 16:30:18 +09:00
Aaron Patterson
38d2bf5fd1 mostly remove the ParamsParser middleware
This can still be added to the middleware stack, but is really not
necessary.  I'll follow up with a commit that deprecates the constant
2015-09-18 15:36:55 -07:00
Akira Matsuda
dcecbb4234 File encoding is defaulted to utf-8 in Ruby >= 2.1 2015-09-18 17:05:05 +09:00
Wojciech Wnętrzak
472358d030 Fix displaying mailer previews on non local requests.
When config `action_mailer.show_previews` is set, previews are displayed
regardless of local request check.
2015-09-17 15:57:09 +02:00
yuuji.yaginuma
084a3908fc raise LoadError when a non-existent file or directory is specified to the test runner
Currently, if a file or directory that does not exist was specified in the test runner,
that argument is ignored.
This commit has been modified to cause an error if there is no file or directory.
2015-09-07 08:13:50 +09:00
Ronak Jangir
8d7bf97798 Removed duplicate requiring minitest/mock as it is already required in method_call_assertions 2015-08-26 19:43:54 +05:30
NehaGautam
c23e06c969 remove unused require ‘set’ 2015-08-25 18:54:53 +05:30
Aaron Patterson
c25cf09c13 override controller_class on the request
Just like the other places.  We need to refactor this because the code
is almost identical to that in the action pack tests
2015-08-24 15:18:29 -07:00
Rafael Mendonça França
1c1ad2b746 Merge pull request #21267 from davidcornu/rails-server-port-env-var
Use the PORT environment variable for rails server
2015-08-24 12:11:36 -03:00
Kasper Timm Hansen
c83b117d4b Merge pull request #21279 from ronakjangir47/test_cleanup
Cleaned up generators tests using internal assertion helper
2015-08-20 07:37:59 +02:00
Ronak Jangir
63a70ad6ff Cleaned up generators tests using internal assertion helper 2015-08-20 09:22:56 +05:30
Andrei Istratii
d0e0fbafb2 Migrate to Sprockets 4. 2015-08-19 21:45:46 +03:00
David Cornu
306c14c411 Use the PORT environment variable for rails server 2015-08-18 08:43:11 -04:00
Daniel Morris
0a888f0c0d Updated tests for the generated version number change 2015-08-16 23:45:55 +01:00
Kasper Timm Hansen
a0fa45c0e6 Merge pull request #21124 from kirs/feature/reload-i18n
Reload I18n.load_path in development
2015-08-10 07:34:13 +02:00
Kir Shatrov
f50e90a1ae Reload I18n locales in development 2015-08-10 00:17:49 +02:00
yuuji.yaginuma
22d863d272 make generated scaffold functional tests work inside API engines
* set engine's route in setup
* use fixture with engine namespace
2015-08-09 21:32:39 +09:00
Rafael Mendonça França
ce1bd47698 Merge pull request #21043 from y-yagi/loading_fixtures_in_engine_integration_tests
set the correct path to `ActionDispatch::IntegrationTest.fixture_path`
2015-08-06 17:29:19 -03:00
Chuck Callebs
a01e58afd9 Add rake dev:cache task to enable dev mode caching.
Taken from @Sonopa's commits on PR #19091.

Add support for dev caching via "rails s" flags.

Implement suggestions from @kaspth.

Remove temporary cache file if server does not have flags.

Break at 80 characters in railties/CHANGELOG.md

Remove ability to disable cache based on server options.

Add more comprehensive options: --dev-caching / --no-dev-caching
2015-08-04 23:41:23 -04:00
Yves Senn
bc3956c0d5 Revert "test runner should crash with non existing file argument."
This reverts commit 465f0fbca3d4a1c269038b84ec9cc248fdab5fab.

This breaks some cases where non file / directory arguments are passed
to the runner (for example db:migrate).

I still think that we can get this to work. From what I can tell there
is no reason why db:migrate is passed along to `Minitest.run`. I'll
revert and investigate possible solutions.
2015-08-03 13:42:30 +02:00
Yves Senn
465f0fbca3 test runner should crash with non existing file argument.
Before this patch, using `bin/rails test` with a non existing
file or directory argument would silently swallow the argument and
run the whole test suite.

After the patch the command fails with `cannot load such file --`.
2015-08-03 11:17:07 +02:00
schneems
9b18ba75b1 Fix rake/notes_test
Presumably due to https://github.com/rails/sprockets-rails/pull/265 sprockets was trying to load the "scss" gem but it isn't in the gemfile:

```
ApplicationTests::RakeTests::RakeNotesTest#test_register_a_new_extension:
LoadError: cannot load such file -- sass
```

If we use an empty precompile list, it won't try to load sass.
2015-07-29 20:12:56 -05:00
schneems
4bc2469156 Fix reported regression rails/sprockets-rails#265
We can prevent the UglifierCompressor from being instantiated prematurely by setting precompile to an empty array in this test.
2015-07-29 20:12:56 -05:00
yuuji.yaginuma
46599260b1 set the correct path to ActionDispatch::IntegrationTest.fixture_path
`ActionDispatch::IntegrationTest.fixture_path` set by `test_help.rb`, but if the engine,
path under the dummy is will be set, fixtures under test was not loaded.
2015-07-28 08:05:53 +09:00
Robin Dupret
a120f2716e Enable the api_only option for API plugins' generators
This way, running a generator inside the plugin's directory, files that
are not relevant won't be generated (e.g. views or assets).

This won't interfere with the application's generators configuration.
2015-07-23 19:36:49 +02:00
Robin Dupret
ce32c9da96 Generate an API dummy application for API plugins 2015-07-23 18:27:19 +02:00
Robin Dupret
e3cfd5b174 Make ApplicationController inherit from AC::API for API plugins 2015-07-23 18:27:18 +02:00
Robin Dupret
67863aa844 Skip assets, helpers and views generation for API plugins 2015-07-23 18:27:15 +02:00
Rafael Mendonça França
9582b3f509 Merge pull request #20819 from y-yagi/rails_api_gemfile
remove `web-console` from API app generated Gemfile
2015-07-21 10:59:30 -03:00
David Heinemeier Hansson
068865a7d5 Merge pull request #20384 from kaspth/per-request-cache
Use digest cache in development.
2015-07-20 13:15:55 +02:00
Kasper Timm Hansen
40f79da8f2 Make digest cache work in development.
Avoid computing the same fragment digest many times when looping over templates.

The cache is cleared on every request so template changes are still picked up.
2015-07-18 21:54:19 +02:00