Commit Graph

12289 Commits

Author SHA1 Message Date
Aaron Patterson
e956172b8b push is_a checks up the stack
now `hash_filter` doesn't need to know about the `Parameters` class
2015-07-17 14:26:47 -07:00
Aaron Patterson
7779e63371 remove useless conditional
Since we proved that `element` is always of type `Parameter`, we know
that it will always respond to `permit`, so lets remove this conditional
2015-07-17 14:18:47 -07:00
Aaron Patterson
89448a7f5c remove useless conditionals
`element` can never be a hash because:

1. `slice` returns a Parameters object and calls each on it: cb3f25593b/actionpack/lib/action_controller/metal/strong_parameters.rb (L656)
2. `each` which is implemented by `each_pair` will call `convert_hashes_to_parameters` on the value: cb3f25593b/actionpack/lib/action_controller/metal/strong_parameters.rb (L192-197)
3. `convert_hashes_to_parameters` will convert any hash objects in to parameters objects: cb3f25593b/actionpack/lib/action_controller/metal/strong_parameters.rb (L550-566)
2015-07-17 14:08:12 -07:00
Aaron Patterson
cb3f25593b remove useless function
Now that the value is cached on the stack,
`array_of_permitted_scalars_filter` is exactly the same as
`array_of_permitted_scalars?`, so lets just have one
2015-07-17 13:36:33 -07:00
Aaron Patterson
2df8e86caf stop passing params to array_of_permitted_scalars_filter
this way the method doesn't have to know what the new params object is,
it just yields to a block.  This change also caches the value of
`self[key]` on the stack
2015-07-17 13:36:33 -07:00
Aaron Patterson
55d0e6f877 push key checking up
We should disconnect `array_of_permitted_scalars_filter` from the
instance so that we can make hash filtering functional.  For now, pull
the conditional up out of that method
2015-07-17 13:36:33 -07:00
Jon Atack
ea747f7d2e [skip ci] Lookup can be a noun but it is not a verb
Various grammar corrections and wrap to 80 characters.
2015-07-17 20:18:57 +02:00
Robin Dupret
ae1b96cfcd Skip a few failing tests on JRuby with the attached tickets 2015-07-17 15:00:00 +02:00
Akira Matsuda
022c676aee Oops! 💣 2015-07-17 18:31:59 +09:00
Akira Matsuda
8b3c68399f "warning: instance variable @routes not initialized" 2015-07-17 18:29:52 +09:00
Zoltan Kiss
ea6e7ffd78 Standardize ActionController::Parameters#to_unsafe_h return value
`ActionController::Parameters#to_h` returns a hash, so lets have
`ActionController::Parameters#to_unsafe_h` return a hash instead of
an `ActiveSupport::HashWithIndifferentAccess` for consistency.
2015-07-15 19:20:21 -05:00
Prem Sichanugrist
84b861f1aa Update documentation on AC::Parameters 2015-07-15 13:02:53 -04:00
Prem Sichanugrist
14a3bd520d Make AC::Parameters not inherited from Hash
This is another take at #14384 as we decided to wait until `master` is
targeting Rails 5.0. This commit is implementation-complete, as it
guarantees that all the public methods on the hash-inherited Parameters
are still working (based on test case). We can decide to follow-up later
if we want to remove some methods out from Parameters.
2015-07-15 11:11:36 -04:00
Aaron Patterson
4d4d764ab6 Rack implements redirect? so we don't need it
Rack [already implements `redirect?` on the response object](1569a985e1/lib/rack/response.rb (L141)) so we don't need to implement our own.
2015-07-14 11:22:35 -07:00
Rafael Mendonça França
8aadbeb3de Remove concurrent-ruby from Action Pack gemspec
It is already on Active Support
2015-07-14 15:17:41 -03:00
Aaron Patterson
468a55b741 Merge pull request #20866 from jdantonio/countdown-latch
Replace `ActiveSupport::Concurrency::Latch` with `Concurrent::CountDownLatch` from concurrent-ruby.
2015-07-14 11:06:20 -07:00
Rafael Mendonça França
7645a5f85d Merge pull request #20877 from sikachu/rename-ac-test_response
Change AC::TestResponse to AD::TestResponse
2015-07-14 12:26:30 -03:00
Aaron Patterson
9cff248469 only call methods that are on the superclass
We want to treat the response object as if it's a real response object
(not a test object), so we should only call methods that are on the
superclass.
2015-07-14 07:46:17 -07:00
Prem Sichanugrist
e26d11c876 Change AC::TestResponse to AD::TestResponse
ActionController::TestResponse was removed in d9fe10c and caused a test
failure on Action View as its test case still refers to it.
2015-07-14 09:27:42 -04:00
Aaron Patterson
908bc79729 use a lookup table for assert_response
We shouldn't depend on specific methods imlemented in the TestResponse
subclass because the response could actually be a real response object.

In the future, we should either push the aliased predicate methods in
TestResponse up to the real response object, or remove them
2015-07-13 18:10:36 -07:00
Aaron Patterson
d9fe10cb8a only have one TestResponse class 2015-07-13 17:52:02 -07:00
Aaron Patterson
b37e29ec2d move buffer caching on to the buffer 2015-07-13 17:48:56 -07:00
Robin Dupret
48609420b8 Merge pull request #20736 from antoine-lizee/docs
[ci skip] docs: making clear that perform_caching has a limited impact
2015-07-13 22:41:45 +02:00
Jerry D'Antonio
284a9ba8ec Replaced ActiveSupport::Concurrency::Latch with concurrent-ruby.
The concurrent-ruby gem is a toolset containing many concurrency
utilities. Many of these utilities include runtime-specific
optimizations when possible. Rather than clutter the Rails codebase with
concurrency utilities separate from the core task, such tools can be
superseded by similar tools in the more specialized gem. This commit
replaces `ActiveSupport::Concurrency::Latch` with
`Concurrent::CountDownLatch`, which is functionally equivalent.
2015-07-13 15:44:21 -04:00
antoine.lizee
89a55edd59 [ci skip] doc: making clear that perform_caching has a limited impact 2015-07-13 11:35:18 -07:00
Claudio B.
e0a7e7b0ee Merge pull request #20842 from TheBlasfem/removed_usage_lines_docs
Removed usage line docs [ci skip]
2015-07-11 22:38:05 -07:00
Julio Lopez
789a2df86e added description instead of remove usage [ci skip] 2015-07-11 21:28:07 -05:00
Aaron Patterson
8f81f7a73d Merge pull request #17102 from matthewd/load-interlock
Concurrent load interlock (rm Rack::Lock)
2015-07-10 15:42:08 -07:00
Aaron Patterson
3c5bd78ddb we don't really need an extra method to set the script name 2015-07-10 14:19:11 -07:00
Aaron Patterson
85903d1b08 Remove useless conditional
PATH_INFO is already set, so this branch will never execute.
2015-07-10 14:19:11 -07:00
Aaron Patterson
e459b29fb4 default PATH_INFO to the generated path
we were already generating a path in the previous code (it was just not
returned), so lets just use the already computed path to popluate the
PATH_INFO header
2015-07-10 14:19:11 -07:00
Aaron Patterson
8b4eca09a5 always default the SCRIPT_NAME to whatever is on the controller 2015-07-10 14:19:11 -07:00
Aaron Patterson
889a4a3da0 remove useless ivar clearing
Since we only work with new instances, these ivars will not be set.
2015-07-10 14:19:11 -07:00
Aaron Patterson
314ac0cd57 call the path_parameters= setter rather than rely on mutations
We should call the setter on `path_parameters` so that we know the hash
will only contain the values that we've set.
2015-07-10 14:19:10 -07:00
Aaron Patterson
f1fcf9b526 start collecting env mutations
I'd like to put all env mutations together so we can understand how to
change this code to call `call` on the controller
2015-07-10 14:19:10 -07:00
Aaron Patterson
0adb8f8fa6 Parameters are converted to a query string
Since parameters are converted to a query string, they will
automatically be turned in to strings by the query parser
2015-07-10 14:19:10 -07:00
Aaron Patterson
11bc078928 no more HWIA
non_path_parameters is used internally (it never escapes this method) so
we should be able to safely use a regular hash.
2015-07-10 14:19:10 -07:00
Aaron Patterson
79ab812663 remove param dup'ing logic
since we are serializing parameters, we don't need to do all the dup
checks on each object.
2015-07-10 14:19:10 -07:00
Aaron Patterson
c546a2b045 encode / decode parameters before assigning them to the request
We should roundtrip the parameters through their respective encoders /
decoders so that the controller will get parameters similar to what they
actually get in a real world situation
2015-07-10 14:19:10 -07:00
Aaron Patterson
f3bae24c81 start disconnecting the parameter parser from the instance
pass in the instance variable to start decoupling the meat of the parser
from the instance of the middleware
2015-07-10 11:53:06 -07:00
Aaron Patterson
a1d7d65f0a drop a conditional by always assigning
We will always make an assignment to the env hash and eliminate a
conditional
2015-07-10 11:53:05 -07:00
Aaron Patterson
eb10496a1c drop runtime conditionals in parameter parsing
If we only deal with proc objects, then we can eliminate type checking
in the parameter parsing middleware
2015-07-09 14:56:38 -07:00
Aaron Patterson
140d5a3b2f use Rack::Test::UploadedFile when uploading files
We should use rack-test's upload file objects on the test side so that
we will be able to correctly generate mime blob posts in the future
2015-07-09 11:51:45 -07:00
Aaron Patterson
394b7be036 set parameters as a query string
We should convert request parameters to a query string, then let the
request object parse that query string.  This should give us results
that are more similar to the real-world
2015-07-09 10:12:19 -07:00
Aaron Patterson
40ed4eefe4 use JSON to communicate between the controller and the tests 2015-07-09 07:50:41 -07:00
Aaron Patterson
5ea8efecd0 build and assign parameters rather than rely on mutations
We should assign parameters to the request object rather than mutate the
hash that is returned by `query_parameters` or `request_parameters`
2015-07-08 16:43:58 -07:00
Aaron Patterson
9f09848918 assign the cookie hash on request allocation
this prevents mutations from being available globally
2015-07-08 16:27:02 -07:00
Aaron Patterson
f65fd25f04 request objects are no longer recycled
Instead of trying to manually clear out a request object, lets just
allocate a new one.  The rack ENV is reused and cleaned (still), but the
request object is not.
2015-07-08 16:23:32 -07:00
Aaron Patterson
b5a9525932 pass the variant as a parameter to more reflect real world apps 2015-07-08 16:15:50 -07:00
Aaron Patterson
78a5124bf0 add a new constructor for allocating test requests 2015-07-08 16:09:49 -07:00