aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/test_case.rb
Commit message (Collapse)AuthorAgeFilesLines
* Enable `Layout/EmptyLinesAroundAccessModifier` copRyuta Kamizono2019-06-131-2/+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.
* `@controller` may not be defined here, and if so, it causes a Ruby warningAkira Matsuda2019-05-011-1/+1
| | | | e.g. via test-unit-rails' `run_setup`
* Enable `Performance/UnfreezeString` copyuuji.yaginuma2018-09-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Ruby 2.3 or later, `String#+@` is available and `+@` is faster than `dup`. ```ruby # frozen_string_literal: true require "bundler/inline" gemfile(true) do source "https://rubygems.org" gem "benchmark-ips" end Benchmark.ips do |x| x.report('+@') { +"" } x.report('dup') { "".dup } x.compare! end ``` ``` $ ruby -v benchmark.rb ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux] Warming up -------------------------------------- +@ 282.289k i/100ms dup 187.638k i/100ms Calculating ------------------------------------- +@ 6.775M (± 3.6%) i/s - 33.875M in 5.006253s dup 3.320M (± 2.2%) i/s - 16.700M in 5.032125s Comparison: +@: 6775299.3 i/s dup: 3320400.7 i/s - 2.04x slower ```
* Fix some typos.Mike Boone2017-10-101-2/+2
|
* Clarify intentions around method redefinitionsMatthew Draper2017-09-011-2/+2
| | | | | | | | | Don't use remove_method or remove_possible_method just before a new definition: at best the purpose is unclear, and at worst it creates a race condition. Instead, prefer redefine_method when practical, and silence_redefinition_of_method otherwise.
* Make sure Action View doesn't break with Active StorageRafael Mendonça França2017-08-031-0/+12
| | | | | When Active Storage is not loaded and direct_upload is used on file_field_tag we should not raise an exception.
* Fix testing helpers that use Action View's capturing helpers (e.g. content_for)George Claghorn2017-07-251-0/+2
|
* Use frozen string literal in actionview/Kir Shatrov2017-07-241-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.
* Merge pull request #29540 from kirs/rubocop-frozen-stringMatthew Draper2017-07-021-0/+1
|\ | | | | | | Enforce frozen string in Rubocop
| * Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
| |
* | Make ActionView frozen string literal friendly.Pat Allan2017-06-201-1/+1
|/ | | | Plus a couple of related ActionPack patches.
* Pass params __FILE__ and __LINE__ + 1 if class_eval with <<bogdanvlviv2017-05-291-1/+1
|
* Add custom polymorphic mappingAndrew White2017-02-211-4/+4
| | | | | | | | | | | | | | | | Allow the use of `direct` to specify custom mappings for polymorphic_url, e.g: resource :basket direct(class: "Basket") { [:basket] } This will then generate the following: >> link_to "Basket", @basket => <a href="/basket">Basket</a> More importantly it will generate the correct url when used with `form_for`. Fixes #1769.
* `self.` is not needed when calling its own instance methodAkira Matsuda2017-01-051-2/+2
| | | | Actually, private methods cannot be called with `self.`, so it's not just redundant, it's a bad habit in Ruby
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-3/+3
|
* Add load hooks to all tests classesRafael Mendonça França2016-08-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | Usually users extends tests classes doing something like: ActionView::TestCase.include MyCustomTestHelpers This is bad because it will load the ActionView::TestCase right aways and this will load ActionController::Base making its on_load hooks to execute early than it should. One way to fix this is using the on_load hooks of the components like: ActiveSupport.on_load(:action_view) do ActionView::TestCase.include MyCustomTestHelpers end The problem with this approach is that the test extension will be only load when ActionView::Base is loaded and this may happen too late in the test. To fix this we are adding hooks to people extend the test classes that will be loaded exactly when the test classes are needed.
* 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.
* Fix actionview test failureRyuta Kamizono2016-08-111-1/+1
| | | | Caused by #26092.
* applies remaining conventions across the projectXavier Noria2016-08-061-1/+0
|
* modernizes hash syntax in actionviewXavier Noria2016-08-061-1/+1
|
* applies new string literal convention in actionview/libXavier Noria2016-08-061-8/+8
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Revert "Make sure the cache is always populated"Rafael Mendonça França2016-05-201-1/+1
| | | | | | This reverts commit 0ce7eae7418f1b9bb06b351c1f26d50c3674c0d0. Tests were broken https://travis-ci.org/rails/rails/jobs/131850726#L520
* Make sure the cache is always populatedAaron Patterson2016-05-201-1/+1
| | | | This way we don't have to make multiple calls on anonymous controllers
* TestController#parameters returns AC::ParametersJustin Coyne2015-12-291-1/+1
| | | | | | | Fixes #22827 ActionView::TestCase::TestController#parameters should return an instance of ActionController::Parameters rather than a hash. This enables helper methods to use the correct interface.
* Dont try to call method missing in routes if thats not what we wantArthur Neves2015-08-101-3/+9
| | | | | | | | | | | | | | | | | | | | If, doing a test like this: ``` class BugTest < ActionView::TestCase def test_foo omg end ``` Will raise with: ``` RuntimeError: In order to use #url_for, you must include routing helpers explicitly. For instance, `include Rails.application.routes.url_helpers`. ``` Thats a bit confusing, as we are not calling url_for at all.
* Change AC::TestResponse to AD::TestResponsePrem Sichanugrist2015-07-141-1/+1
| | | | | ActionController::TestResponse was removed in d9fe10c and caused a test failure on Action View as its test case still refers to it.
* use new constructor. (Oops! :bomb:)Aaron Patterson2015-07-081-1/+1
|
* Use public Module#include, in favor of https://bugs.ruby-lang.org/issues/8846robertomiranda2015-01-311-1/+1
| | | | ref: https://github.com/rails/rails/pull/18763#issuecomment-72349769
* Make sure assert_select can assert body tagRafael Mendonça França2014-11-181-4/+5
| | | | | | | | | This reverts commit f93df52845766216f0fe36a4586f8abad505cac4, reversing changes made to a455e3f4e9dbfb9630d47878e1239bc424fb7d13. Conflicts: actionpack/lib/action_controller/test_case.rb actionview/lib/action_view/test_case.rb
* document_root_element need to be publicRafael Mendonça França2014-11-171-5/+5
|
* Parse HTML as document fragment.Kasper Timm Hansen2014-09-291-1/+1
| | | | This is to match the changes in Rails Dom Testing rails/rails-dom-testing#20.
* Do not memoize document_root_element in view testsRafael Mendonça França2014-09-081-2/+1
| | | | | | | Memoizing will not make possible to assert the output of the view if it is changed after the first assert_select call Related with plataformatec/simple_form#1130 and rails/rails-dom-testing#15
* Merge branch 'master' into loofahRafael Mendonça França2014-08-121-1/+1
|\ | | | | | | | | | | | | Conflicts: actionpack/CHANGELOG.md actionpack/test/controller/integration_test.rb actionview/CHANGELOG.md
| * don't access named routes internalsAaron Patterson2014-07-301-1/+1
| | | | | | | | just ask whether or not the route is defined
* | We don't need loofah for the assertionsRafael Mendonça França2014-07-151-2/+1
| | | | | | | | We can just use nokogiri
* | Make output_buffers used in tests be utf-8 encoded. Fixing unknown encoding ↵Timm2014-06-161-1/+3
| | | | | | | | ASCII-8BIT test errors.
* | Support for changes in SelectorAssertions.Timm2014-06-161-5/+6
| |
* | Required rails-dom-testing in test_case.rbTimm2014-06-161-1/+3
| |
* | Moved Dom and Selector assertions from ActionDispatch to ActionView.Timm2014-06-161-0/+1
| |
* | Replaced html-scanner with Loofah.Timm2014-06-151-1/+1
|/
* Fix subscriptions not being unsubscribed.Guo Xiang Tan2014-04-141-1/+2
|
* Move actionpack/lib/action_view* into actionview/libPiotr Sarnacki2013-06-201-0/+272