aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/safe_buffer_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Fix `CustomCops/AssertNot` to allow it to have failure messageRyuta Kamizono2018-05-131-2/+2
| | | | Follow up of #32605.
* Use assert_predicate and assert_not_predicateDaniel Colson2018-01-251-7/+7
|
* [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment`Koichi ITO2017-07-111-0/+1
|
* Use frozen-string-literal in ActiveSupportKir Shatrov2017-07-091-0/+1
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* "Use assert_nil if expecting nil from ...:in `...'. This will fail in ↵Akira Matsuda2016-12-251-1/+1
| | | | minitest 6."
* Expectation firstAkira Matsuda2016-12-251-1/+1
|
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-1/+1
|
* Add three new rubocop rulesRafael Mendonça França2016-08-161-1/+1
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* applies new string literal convention in activesupport/testXavier Noria2016-08-061-41/+41
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Properly dump primitive-like AS::SafeBuffer strings as YAMLGodfrey Chan2015-02-111-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `coder.represent_scalar` means something along the lines of "Here is a quoted string, you can just add it to the output", which is not the case here. It only works for simple strings that can appear unquoted in YAML, but causes problems for e.g. primitive-like strings ("1", "true"). `coder.represent_object` on the other hand, means that "This is the Ruby-object representation for this thing suitable for use in YAML dumping", which is what we want here. Before: YAML.load ActiveSupport::SafeBuffer.new("Hello").to_yaml # => "Hello" YAML.load ActiveSupport::SafeBuffer.new("true").to_yaml # => true YAML.load ActiveSupport::SafeBuffer.new("false").to_yaml # => false YAML.load ActiveSupport::SafeBuffer.new("1").to_yaml # => 1 YAML.load ActiveSupport::SafeBuffer.new("1.1").to_yaml # => 1.1 After: YAML.load ActiveSupport::SafeBuffer.new("Hello").to_yaml # => "Hello" YAML.load ActiveSupport::SafeBuffer.new("true").to_yaml # => "true" YAML.load ActiveSupport::SafeBuffer.new("false").to_yaml # => "false" YAML.load ActiveSupport::SafeBuffer.new("1").to_yaml # => "1" YAML.load ActiveSupport::SafeBuffer.new("1.1").to_yaml # => "1.1" If we ever want Ruby to behave more like PHP or JavaScript though, this is an excellent trick to use ;)
* Just check if the buffer exists before changing itRafael Mendonça França2014-12-291-5/+1
|
* When trying to access a character on a string buffer object via `:[]`, if ↵Vipul A M2014-12-291-0/+9
| | | | | | | | | | | | | | | | the object being accessed currently returns `html_safe?` as true, we used to set `@html_safe` variable as true on new object created. When doing something like x = 'Hello'.html_safe x[/a/, 1] would throw an error on ruby 2.2, since when nothign gets matched nil is returned by the code and it tries to set `@html_safe` value to true, which would error since starting 2.2 nil is frozen. This change adds a safety net to avoid setting `@html_safe = true` on frozen objects. Fixes #18235
* Fixes interpolation on SafeBufferJulien Letessier2013-12-141-0/+25
| | | | | | | | | Interpolation was untested and did not work with hash arguments. Adds - support for interpolation with hash argument - tests for the above - tests for safe/unsafe interpolation
* Ensure [] respects the status of the buffer.José Valim2012-02-291-4/+23
|
* delete vulnerable AS::SafeBuffer#[]Akira Matsuda2012-02-201-6/+0
|
* add AS::SafeBuffer#clone_emptyAkira Matsuda2012-02-201-0/+9
|
* global variables may not be set depending on the match. fixes #4703Aaron Patterson2012-01-261-0/+4
|
* No need to require psych since require yaml does that.Rafael Mendonça França2012-01-041-1/+0
|
* No need to use rescue block to require psychRafael Mendonça França2012-01-041-5/+1
|
* Whitespaces :scissors:Rafael Mendonça França2012-01-041-1/+1
|
* Add test to make sure that add two safe buffers always return a safe bufferRafael Mendonça França2012-01-041-0/+7
|
* Revert removing gsub and sub from safe buffer.José Valim2011-09-081-27/+14
|
* this should have gone with the previous commitXavier Noria2011-09-081-2/+2
|
* remove support of symbols on classify and camelizeDamien Mathieu2011-09-081-14/+27
|
* Reset @dirty to false when slicing an instance of SafeBufferBrian Cardarella2011-07-291-0/+6
|
* remove unused variables warnings removedVishnu Atrai2011-07-261-2/+0
|
* Using slice for instead of gsub to pass with 1.8.7Arun Agrawal2011-06-231-1/+1
|
* calling unsafe methods which don't return a string shouldn't failDamien Mathieu2011-06-221-0/+4
|
* safe_concat should not work on dirty buffers.José Valim2011-06-161-0/+7
|
* Fix safe buffer by adding a dirty status.José Valim2011-06-161-6/+31
|
* Ensure that the strings returned by SafeBuffer#gsub and friends aren't ↵Michael Koziarski2011-06-071-0/+12
| | | | | | | | | | considered html_safe? Also make sure that the versions of those methods which modify a string in place such as gsub! can't be called on safe buffers at all. Conflicts: activesupport/test/safe_buffer_test.rb
* make sure we play nicely when syck is activatedAaron Patterson2011-01-281-0/+22
|
* Deleted all references to ActionView::SafeBuffer in favor of ↵Santiago Pastorino2010-01-311-0/+41
ActiveSupport::SafeBuffer Signed-off-by: Yehuda Katz <wycats@Yehuda-Katz.local>