aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/cases/attribute_methods_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Enable `Layout/EmptyLinesAroundAccessModifier` copRyuta Kamizono2019-06-131-1/+0
| | | | | | | | | | | We sometimes say "✂️ newline after `private`" in a code review (e.g. https://github.com/rails/rails/pull/18546#discussion_r23188776, https://github.com/rails/rails/pull/34832#discussion_r244847195). Now `Layout/EmptyLinesAroundAccessModifier` cop have new enforced style `EnforcedStyle: only_before` (https://github.com/rubocop-hq/rubocop/pull/7059). That cop and enforced style will reduce the our code review cost.
* Remove unused method_name from AttributeMethodMatchChris Salzberg2019-04-121-1/+0
|
* Enable `Style/RedundantBegin` cop to avoid newly adding redundant begin blockRyuta Kamizono2018-12-211-52/+38
| | | | | | | | | | Currently we sometimes find a redundant begin block in code review (e.g. https://github.com/rails/rails/pull/33604#discussion_r209784205). I'd like to enable `Style/RedundantBegin` cop to avoid that, since rescue/else/ensure are allowed inside do/end blocks in Ruby 2.5 (https://bugs.ruby-lang.org/issues/12906), so we'd probably meets with that situation than before.
* Use respond_to test helpersDaniel Colson2018-01-251-2/+2
|
* Merge pull request #29788 from kamipo/remove_unused_mutex_mRafael França2017-07-171-1/+1
|\ | | | | Remove unused `Mutex_m` in Active Model
| * Make `generated_attribute_methods` to privateRyuta Kamizono2017-07-141-1/+1
| | | | | | | | Because `generated_attribute_methods` is an internal API.
* | Use frozen string literal in activemodel/Kir Shatrov2017-07-161-0/+2
|/
* 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
|
* 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.
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-2/+2
|
* modernizes hash syntax in activemodelXavier Noria2016-08-061-2/+2
|
* applies new string literal convention in activemodel/testXavier Noria2016-08-061-40/+40
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Completely remove potential global state leaks in ActiveModel tests.Zuhao Wan2014-03-111-24/+52
| | | | ActiveModel tests can now be run in random order.
* Remove deprecation warning from AttributeMethodsMatcherPaul Nikitochkin2013-06-281-11/+0
|
* Convert ActiveModel to 1.9 hash syntax.Patrick Robertson2013-05-011-2/+2
| | | | | I also attempted to fix other styleguide violations such as { a: :b } over {a: :b} and foo(b: 'bar') over foo( b: 'bar' ).
* Small typos here and there.Vipul A M2013-03-151-1/+1
|
* made dynamic finders alias_attribute awareMaximilian Schneider2012-06-221-0/+9
| | | | | previously dynamic finders only worked in combination with the actual column name and not its alias defined with #alias_attribute
* Merge pull request #4785 from ↵José Valim2012-05-251-0/+22
|\ | | | | | | | | ayamomiji/add-self-to-allow-method-name-using-ruby-keyword add `self.` to allow method name using ruby keyword
| * fix `alias_attribute` will raise a syntax error if make an alias on aayaya2012-05-141-0/+22
| | | | | | | | column that named as a ruby keyword
* | allow define_attribute_methods to pass multiple valuesFrancesco Rodriguez2012-05-141-6/+13
|/
* test against ruby features in order to fix tests on Ruby 2.0Aaron Patterson2012-03-261-1/+9
|
* Fix test class name that should read WithoutCarlos Antonio da Silva2012-01-161-2/+2
|
* Fix stack level too deep when model does not have attributes method.Piotr Sarnacki2012-01-151-0/+8
| | | | | | | | | | | Without that patch when using ActiveModel::AttributeMethods in a class that does not respond to `attributes` method, stack level too deep error will be raised on non existing method. While documentation is clear that you need to define `attributes` method in order to use AttributeMethods module, `stack level too deep` is rather obscure and hard to debug, therefore we should try to not break `method_missing` if someone forgets about defining `attributes`.
* remove deprecated define_attr_method from ActiveModel::AttributeMethodsSergey Nartimov2011-12-241-31/+0
|
* Deprecated `define_attr_method` in `ActiveModel::AttributeMethods`Jon Leighton2011-11-291-5/+18
| | | | | This only existed to support methods like `set_table_name` in Active Record, which are themselves being deprecated.
* Generate attribute method unless it's already in the module.Jon Leighton2011-09-141-0/+23
| | | | | | | There's no harm in generating a method name that's already defined on the host class, since we're generating the attribute methods in a module that gets included. In fact, this is desirable as it allows the host class to call super.
* Add an attribute_missing method to ActiveModel::AttributeMethods.Jon Leighton2011-09-131-0/+15
| | | | This can be overloaded by implementors if necessary.
* Let Ruby deal with method visibility.Jon Leighton2011-09-131-0/+36
| | | | | | Check respond_to_without_attributes? in method_missing. If there is any method that responds (even private), let super handle it and raise NoMethodError if necessary.
* Add deprecation for doing `attribute_method_suffix ''`Jon Leighton2011-09-131-6/+11
|
* Use an empty AttributeMethodMatcher by default.Jon Leighton2011-09-131-0/+17
| | | | | | This means that attribute methods which don't exist will get generated when define_attribute_methods is called, so we don't have to use hacks like `attribute_method_suffix ''`.
* removed duplicate codeganesh2011-06-111-1/+0
|
* Do not in place modify what table_name returnsSantiago Pastorino2011-03-221-11/+0
|
* define_attr_method should be able to define methods that returns nilSantiago Pastorino2011-03-171-0/+2
|
* dup strings on return so that in place modifications do not break anything. ↵Aaron Patterson2011-03-171-0/+11
| | | | I am looking at you "compute_table_name"
* define_attr_method correctly defines methods with invalid identifiersSantiago Pastorino2011-03-161-2/+4
|
* Add a define_attr_method testSantiago Pastorino2011-03-161-0/+13
|
* Add test for define_attr_method using as name an invalid identifierSantiago Pastorino2011-03-161-0/+13
|
* Add test for define_attribute_method using as name an invalid identifierSantiago Pastorino2011-03-161-3/+26
|
* Move ActiveModel::AttributeMethods#attribute_methods_generated? to ↵Alexander Uvarov2011-03-011-3/+7
| | | | | | | | ActiveRecord, so it's flexible now [#6428 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* allow spaces and other characters in attribute names [#4725 state:resolved]Caleb Land2011-02-031-0/+30
| | | | | | | | * define the dynamically defined methods with 'define_method' instead of def * wrap some string injected method names in quotes Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Deletes trailing whitespaces (over text files only find * -type f -exec sed ↵Santiago Pastorino2010-08-141-2/+2
| | | | 's/[ \t]*$//' -i {} \;)
* Use better assertion methods for testingNeeraj Singh2010-05-191-1/+1
| | | | | | [#4645 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Fixed behavior of attribute_methods_generated? [#3220 state:resolved]Sam Pohlenz2009-10-071-0/+26
| | | | Signed-off-by: Joshua Peek <josh@joshpeek.com>
* Don't share attribute matchers between classes [#3216 state:resolved]Sam Pohlenz2009-10-071-0/+20
Allows separate models that include ActiveModel::AttributeMethods to use different sets of attribute matchers. Signed-off-by: Joshua Peek <josh@joshpeek.com>