aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/module/attribute_accessor_per_thread_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Use Thread.pass instead of Kernel.sleep to trigger race conditionGuilherme Mansur2019-08-051-14/+7
|
* Able to initalize default value for thread_mattr_*Guilherme Mansur2019-08-051-11/+27
| | | | | | | | | | | | | | | | | Added the ability to initialize `thread_mattr_*` methods with default values like so: ``` ruby class MyClass thread_attr_reader :foo, default: :foo thread_attr_writer :bar, default: :bar thread_attr_accessor: baz do "baz" end end ``` This is consistent with the api exposed by `mattr_accessor`.
* Use respond_to test helpersDaniel Colson2018-01-251-4/+4
|
* [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
|
* assert_equal takes expectation firstAkira Matsuda2016-12-261-3/+3
|
* Merge pull request #25681 from willnet/fix-thread_mattr_accessorYves Senn2016-08-081-0/+16
|\ | | | | | | Fix `thread_mattr_accessor` share variable superclass with subclass
| * Fix `thread_mattr_accessor` share variable superclass with subclasswillnet2016-08-041-4/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current implementation of `thread_mattr_accessor` set variable sharing superclass with subclass. So the method doesn't work as documented. Precondition class Account thread_mattr_accessor :user end class Customer < Account end Account.user = "DHH" Account.user #=> "DHH" Customer.user = "Rafael" Customer.user # => "Rafael" Documented behavior Account.user # => "DHH" Actual behavior Account.user # => "Rafael" Current implementation set variable statically likes `Thread[:attr_Account_user]`, and customer also use it. Make variable name dynamic to use own thread-local variable.
* | normalizes indentation and whitespace across the projectXavier Noria2016-08-061-4/+4
| |
* | applies new string literal convention in activesupport/testXavier Noria2016-08-061-9/+9
|/ | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Fix `thread_mattr_accessor` thread-local variable namingMichael Ryan2016-03-111-0/+6
| | | | | | | | | | | | | | | | | The current implentation of `thread_mattr_accessor` is setting differently-named thread variables when defining class and instance writer methods, so the method isn't working as documented: Account.user = "DHH" Account.user # => "DHH" Account.new.user # => nil a = Account.new a.user = "ABC" # => "ABC" a.class.user # => "DHH" At this point `:attr_Account_user` and `:attr_Class_user` thread-local variables have been created. Modify the reader and writer methods to use the class name instead of 'Class'.
* Use separate test class nameDavid Heinemeier Hansson2015-12-171-1/+1
|
* Add thread_m/cattr_accessor/reader/writer suite of methods for declaring ↵David Heinemeier Hansson2015-12-171-0/+109
class and module variables that live per-thread