| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
The `cookies` hash isn't updated with the value generated by the output
from `to_header` so it wasn't testing anything. Rendering the cookie
value in the controller makes sure that the escaping is actually working.
|
|\ \ \ \ \ \ \
| |_|_|_|_|_|/
|/| | | | | |
| | | | | | | |
into ma2gedev-should-escape-cookie
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
Get an incorrect cookie value in controller action method
if cookie value contains an escapable string.
|
| |_|_|_|/ /
|/| | | | | |
|
| |_|_|/ /
|/| | | |
| | | | |
| | | | | |
`NEVER_UNPERMITTED_PARAMS` is deprecated in Rails 4.2. See #15933.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
A callable cache key writes to the collection cache under a certain namespace.
Which means if we don't have scoped cache key we can just rely on the
`cache model_name do` in the templates to cache them.
Less writes, more sharing.
Add `assert_customer_cached` to better illustrate this in tests, and remove
tests which then don't communicate as much.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
It was difficult to see when the partials were rendered, and how many times
we expected it to be rendered before. Because we weren't explaining it.
|
| |/ / /
|/| | |
| | | |
| | | |
| | | |
| | | |
| | | | |
When people pass `cache: -> item { item.upcase }` they scope the collection
cache keys so the individual partial cache isn't reused.
Test that behavior.
|
|\ \ \ \
| | | | |
| | | | | |
Fix routes to match verb and URL path with -g option also.
|
| | | | | |
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Yesterday, when improving how `parsed_body` extracted a parser I wrote
77bbf1e. Then I thought that was too many changes in one commit
and broke it up locally... or so I thought.
When pushed the extra commits removed the changes! Wups!
In shame, lob those changes together here:
* 3b94c38 which meant to fix the CHANGELOG syntax error.
* 5007df5 which meant to mention `parsed_body` in the docs.
* 036a7a0 which meant to memoize the `parsed_body`.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Add more info about the APIs added and how they work.
Use string keys when comparing the parsed response, like how JSON would
be parsed.
|
| |_|/ /
|/| | |
| | | | |
since starting with Rails 5.x(beta) we prefer to use rails as the replacement of rake commands, may be change log will be the same
|
|\ \ \ \
| | | | |
| | | | | |
Fix argument passing to rake routes
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
- Fixed related documentation and usage all around
Fixes #23561
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
It's common to use several assertions on the parsed response. The response
bodies aren't meant to be mutated. People should make new test requests
instead.
Thus, it should be safe to memoize the parsing.
|
| | | | |
| | | | |
| | | | |
| | | | | |
Little easier to understand when you know the method that's used.
|
| | | | |
| | | | |
| | | | |
| | | | | |
Can't code for shit.
|
|/ / / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
We're not guaranteed to have a `RequestEncoder` to assign on `get` requests
because we aren't extracting the parser from the response content type.
Until now.
|
| | | |
| | | |
| | | |
| | | |
| | | | |
Forgot to add this in the original pull request. No biggie, just show
some examples.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
When testing:
```ruby
post articles_path, params: { article: { title: 'Ahoy!' } }, as: :json
```
It's common to want to make assertions on the response body. Perhaps the
server responded with JSON, so you write `JSON.parse(response.body)`.
But that gets tedious real quick.
Instead add `parsed_body` which will automatically parse the reponse
body as what the last request was encoded `as`.
|
|\ \ \ \
| |/ / /
|/| | | |
Add `as` to encode a request as a specific mime type.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Turns
```
post articles_path(format: :json), params: { article: { name: 'Ahoy!' } }.to_json,
headers: { 'Content-Type' => 'application/json' }
```
into
```
post articles_path, params: { article: { name: 'Ahoy!' } }, as: :json
```
|
| | | |
| | | |
| | | |
| | | |
| | | | |
We don't need to use active support in this case because we know the
type that will be returned.
|
| | | | |
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
```
[aaron@TC rails (master)]$ cat xor.rb
a = "\x14b\"\xB4P8\x05\x8D\xC74\xC3\xEC}\xFDf\x8E!h\xCF^\xBF\xA5%\xC6\xF0\xA9\xF9x\x04\xFA\xF1\x82"
b = "O.\xF7\x01\xA9D\xA3\xE1D\x7FU\x85\xFC\x8Ak\e\x04\x8A\x97\x91\xD01\x02\xA4G\x1EIf:Y\x0F@"
def xor_byte_strings(s1, s2)
s1.bytes.zip(s2.bytes).map { |(c1,c2)| c1 ^ c2 }.pack('c*')
end
def xor_byte_strings2(s1, s2)
s2_bytes = s2.bytes
s1.bytes.map.with_index { |c1, i| c1 ^ s2_bytes[i] }.pack('c*')
end
require 'benchmark/ips'
require 'allocation_tracer'
Benchmark.ips do |x|
x.report 'xor_byte_strings' do
xor_byte_strings a, b
end
x.report 'xor_byte_strings2' do
xor_byte_strings2 a, b
end
end
ObjectSpace::AllocationTracer.setup(%i{type})
result = ObjectSpace::AllocationTracer.trace do
xor_byte_strings a, b
end
p :xor_byte_strings => result
ObjectSpace::AllocationTracer.clear
result = ObjectSpace::AllocationTracer.trace do
xor_byte_strings2 a, b
end
p :xor_byte_strings2 => result
[aaron@TC rails (master)]$ ruby -I~/git/allocation_tracer/lib xor.rb
Calculating -------------------------------------
xor_byte_strings 10.087k i/100ms
xor_byte_strings2 11.339k i/100ms
-------------------------------------------------
xor_byte_strings 108.386k (± 5.8%) i/s - 544.698k
xor_byte_strings2 122.239k (± 3.0%) i/s - 612.306k
{:xor_byte_strings=>{[:T_ARRAY]=>[38, 0, 0, 0, 0, 0], [:T_STRING]=>[2, 0, 0, 0, 0, 0]}}
{:xor_byte_strings2=>{[:T_ARRAY]=>[3, 0, 0, 0, 0, 0], [:T_DATA]=>[1, 0, 0, 0, 0, 0], [:T_IMEMO]=>[2, 0, 0, 0, 0, 0], [:T_STRING]=>[2, 0, 0, 0, 0, 0]}}
```
|
|\ \ \ \
| | | | |
| | | | | |
fix 'method redefined' warnings
|
| | | | | |
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
This reverts commit 8c3cca5e113213958469b1cec8aa9a664535251a, reversing
changes made to 9dcf67c4da35b165301865d9721da1d552f7e03f.
Reason: https://github.com/rails/rails/pull/23562#issuecomment-181442569
|
| | | | |
| | | | |
| | | | | |
rails-html-sanitizer 1.0.2 is vulnerable: https://groups.google.com/d/msg/rubyonrails-security/uh--W4TDwmI/m_CVZtdbFQAJ
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Hand off the interlock to the new thread in AC::Live
|
| |/ / / /
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Most importantly, the original request thread must yield its share lock
while waiting for the live thread to commit -- otherwise a request's
base and live threads can deadlock against each other.
|
|/ / / / |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Referencing Rails.env without checking if it's defined couples
us to Railties.
Fix by avoiding the line breaks if we don't have an env check
to rely on.
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Tests can (and do) access the database from the main thread. In this
case they were starting a transaction, then making a request. The
request would create a new thread, which would allocate a new database
connection. Since the main thread started a transaction that contains
data that the new thread wants to see, the new thread would not see it
due to data visibility from transactions. Spawning the new thread in
production is fine because middleware should not be doing database
manipulation similar to the test harness. Before 603fe20c it was
possible to set the database connection id based on a thread local, but
603fe20c changes the connection lookup code to never look at the
"connection id" but only at the thread object itself. Without that
indirection, we can't force threads to use the same connection pool as
another thread.
Fixes #23483
|
| | | |
| | | |
| | | |
| | | | |
- Fixes #23428.
|
| | | |
| | | |
| | | |
| | | |
| | | | |
Prototype, you have served us well. But you are no longer how we make an
XMLHttpRequest. RIP
|
|\ \ \ \
| | | | |
| | | | | |
Duplicate assert_generates options before modifying it
|
| | | | | |
|
| | | | |
| | | | |
| | | | | |
fix indentation to show it as code
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
And improve changelongs.
[ci skip]
|
| | | | | |
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Some places were saying filter, while others said filter_options, spare the ambiguity
and use filter throughout.
This inlines a needless local variable and clarifies a route filter consists of defaults
and values to match against.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Assume the filter is a string, if it wasn't a hash and isn't nil. Remove needless else
and rely on Ruby's default nil return.
Add spaces within hash braces.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Add options for rake routes task
|
| |/ / / /
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Add two options: `-c` and `-g`.
`-g` option returns the urls name, verb and path fields that match the pattern.
`-c` option returns the urls for specific controller.
Fixes #18902, and Fixes #20420
[Anton Davydov & Vipul A M]
|
|/ / / /
| | | |
| | | |
| | | |
| | | |
| | | | |
Fixes some parts of #23148.
[ci skip]
|
| | | | |
|