diff --git a/.rubocop.yml b/.rubocop.yml index 53772503..cbbeecc2 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -137,9 +137,15 @@ Minitest/NoAssertions: Minitest/NoTestCases: Enabled: true +Minitest/NonExecutableTestMethod: + Enabled: true + Minitest/NonPublicTestMethod: Enabled: true +Minitest/RedundantMessageArgument: + Enabled: true + Minitest/RefuteEmpty: Enabled: true diff --git a/Gemfile.lock b/Gemfile.lock index d3de9134..dd4f5c81 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -155,8 +155,8 @@ GEM racc (~> 1.4) nokogiri (1.15.5-x86_64-linux) racc (~> 1.4) - parallel (1.23.0) - parser (3.2.2.4) + parallel (1.24.0) + parser (3.3.0.5) ast (~> 2.4.1) racc psych (5.1.1.1) @@ -210,31 +210,32 @@ GEM rake (13.1.0) rdoc (6.6.0) psych (>= 4.0.0) - regexp_parser (2.8.3) + regexp_parser (2.9.0) reline (0.4.1) io-console (~> 0.5) responders (3.1.1) actionpack (>= 5.2) railties (>= 5.2) rexml (3.2.6) - rubocop (1.59.0) + rubocop (1.61.0) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.2.2.4) + parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) rubocop-ast (>= 1.30.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.30.0) - parser (>= 3.2.1.0) - rubocop-minitest (0.33.0) + rubocop-ast (1.31.1) + parser (>= 3.3.0.4) + rubocop-minitest (0.34.5) rubocop (>= 1.39, < 2.0) - rubocop-performance (1.19.1) - rubocop (>= 1.7.0, < 2.0) - rubocop-ast (>= 0.4.0) + rubocop-ast (>= 1.30.0, < 2.0) + rubocop-performance (1.20.2) + rubocop (>= 1.48.1, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) simplecov (0.22.0) diff --git a/lib/inherited_resources/base_helpers.rb b/lib/inherited_resources/base_helpers.rb index 80bbde89..379cc54a 100644 --- a/lib/inherited_resources/base_helpers.rb +++ b/lib/inherited_resources/base_helpers.rb @@ -217,7 +217,7 @@ def method_for_find # def get_resource_ivar #:nodoc: if instance_variable_defined?(:"@#{resource_instance_name}") - instance_variable_get("@#{resource_instance_name}") + instance_variable_get(:"@#{resource_instance_name}") else nil end @@ -226,14 +226,14 @@ def get_resource_ivar #:nodoc: # Set resource ivar based on the current resource controller. # def set_resource_ivar(resource) #:nodoc: - instance_variable_set("@#{resource_instance_name}", resource) + instance_variable_set(:"@#{resource_instance_name}", resource) end # Get collection ivar based on the current resource controller. # def get_collection_ivar #:nodoc: if instance_variable_defined?(:"@#{resource_collection_name}") - instance_variable_get("@#{resource_collection_name}") + instance_variable_get(:"@#{resource_collection_name}") else nil end @@ -242,7 +242,7 @@ def get_collection_ivar #:nodoc: # Set collection ivar based on the current resource controller. # def set_collection_ivar(collection) #:nodoc: - instance_variable_set("@#{resource_collection_name}", collection) + instance_variable_set(:"@#{resource_collection_name}", collection) end # Used to allow to specify success and failure within just one block: diff --git a/lib/inherited_resources/belongs_to_helpers.rb b/lib/inherited_resources/belongs_to_helpers.rb index d08b6cdb..38d17352 100644 --- a/lib/inherited_resources/belongs_to_helpers.rb +++ b/lib/inherited_resources/belongs_to_helpers.rb @@ -79,7 +79,7 @@ def evaluate_parent(parent_symbol, parent_config, chain = nil) #:nodoc: def get_parent_ivar(instance_name) #:nodoc: instance_variable_defined?(:"@#{instance_name}") && - instance_variable_get("@#{instance_name}") + instance_variable_get(:"@#{instance_name}") end def set_parent_instance(parent_config, chain) #:nodoc: @@ -99,7 +99,7 @@ def set_parent_instance(parent_config, chain) #:nodoc: parent = parent.send(parent_config[:finder], params[parent_config[:param]]) end - instance_variable_set("@#{parent_config[:instance_name]}", parent) + instance_variable_set(:"@#{parent_config[:instance_name]}", parent) end # Maps parents_symbols to build association chain. In this case, it diff --git a/lib/inherited_resources/polymorphic_helpers.rb b/lib/inherited_resources/polymorphic_helpers.rb index ed7cd956..86226d89 100644 --- a/lib/inherited_resources/polymorphic_helpers.rb +++ b/lib/inherited_resources/polymorphic_helpers.rb @@ -122,8 +122,8 @@ def parent_class # def parent if parent_type - p = instance_variable_defined?("@#{parent_type}") && instance_variable_get("@#{parent_type}") - p || instance_variable_set("@#{parent_type}", association_chain[-1]) + p = instance_variable_defined?(:"@#{parent_type}") && instance_variable_get(:"@#{parent_type}") + p || instance_variable_set(:"@#{parent_type}", association_chain[-1]) end end diff --git a/test/defaults_test.rb b/test/defaults_test.rb index 1a45c1b4..d3f74c58 100644 --- a/test/defaults_test.rb +++ b/test/defaults_test.rb @@ -34,6 +34,14 @@ def test_expose_all_painters_as_instance_variable assert_equal [mock_painter], assigns(:malarze) end + def test_collection_instance_variable_should_not_be_set_if_already_defined + @controller.instance_variable_set(:@malarze, [mock_painter]) + Malarz.expects(:scoped).never + get :index + + assert_equal [mock_painter], assigns(:malarze) + end + def test_expose_the_requested_painter_on_show Malarz.expects(:find_by_slug).with('forty_two').returns(mock_painter) get :show, params: { id: 'forty_two' } diff --git a/test/url_helpers_test.rb b/test/url_helpers_test.rb index cd5d283b..f44e36a4 100644 --- a/test/url_helpers_test.rb +++ b/test/url_helpers_test.rb @@ -165,27 +165,27 @@ def test_url_helpers_on_simple_inherited_resource # rubocop:disable Minitest/NoA [:url, :path].each do |path_or_url| controller.expects("houses_#{path_or_url}").with({}).once - controller.send("collection_#{path_or_url}") + controller.send(:"collection_#{path_or_url}") controller.expects("house_#{path_or_url}").with(:house, {}).once - controller.send("resource_#{path_or_url}") + controller.send(:"resource_#{path_or_url}") controller.expects("new_house_#{path_or_url}").with({}).once - controller.send("new_resource_#{path_or_url}") + controller.send(:"new_resource_#{path_or_url}") controller.expects("edit_house_#{path_or_url}").with(:house, {}).once - controller.send("edit_resource_#{path_or_url}") + controller.send(:"edit_resource_#{path_or_url}") # With arg controller.expects("house_#{path_or_url}").with(:arg, {}).once - controller.send("resource_#{path_or_url}", :arg) + controller.send(:"resource_#{path_or_url}", :arg) controller.expects("house_#{path_or_url}").with(:arg, {}).once - controller.send("resource_#{path_or_url}", :arg) + controller.send(:"resource_#{path_or_url}", :arg) # With options controller.expects("house_#{path_or_url}").with(:arg, page: 1).once - controller.send("resource_#{path_or_url}", :arg, page: 1) + controller.send(:"resource_#{path_or_url}", :arg, page: 1) end end @@ -195,27 +195,27 @@ def test_url_helpers_on_simple_inherited_resource_using_uncountable # rubocop:di [:url, :path].each do |path_or_url| controller.expects("news_index_#{path_or_url}").with({}).once - controller.send("collection_#{path_or_url}") + controller.send(:"collection_#{path_or_url}") controller.expects("news_#{path_or_url}").with(:news, {}).once - controller.send("resource_#{path_or_url}") + controller.send(:"resource_#{path_or_url}") controller.expects("new_news_#{path_or_url}").with({}).once - controller.send("new_resource_#{path_or_url}") + controller.send(:"new_resource_#{path_or_url}") controller.expects("edit_news_#{path_or_url}").with(:news, {}).once - controller.send("edit_resource_#{path_or_url}") + controller.send(:"edit_resource_#{path_or_url}") # With arg controller.expects("news_#{path_or_url}").with(:arg, {}).once - controller.send("resource_#{path_or_url}", :arg) + controller.send(:"resource_#{path_or_url}", :arg) controller.expects("news_#{path_or_url}").with(:arg, {}).once - controller.send("resource_#{path_or_url}", :arg) + controller.send(:"resource_#{path_or_url}", :arg) # With options controller.expects("news_#{path_or_url}").with(:arg, page: 1).once - controller.send("resource_#{path_or_url}", :arg, page: 1) + controller.send(:"resource_#{path_or_url}", :arg, page: 1) end end @@ -227,27 +227,27 @@ def test_url_helpers_on_simple_inherited_namespaced_resource [:url, :path].each do |path_or_url| controller.expects("admin_tour_backpacks_#{path_or_url}").with({}).once - controller.send("collection_#{path_or_url}") + controller.send(:"collection_#{path_or_url}") controller.expects("admin_backpack_#{path_or_url}").with(:backpack, {}).once - controller.send("resource_#{path_or_url}") + controller.send(:"resource_#{path_or_url}") controller.expects("new_admin_backpack_#{path_or_url}").with({}).once - controller.send("new_resource_#{path_or_url}") + controller.send(:"new_resource_#{path_or_url}") controller.expects("edit_admin_backpack_#{path_or_url}").with(:backpack, {}).once - controller.send("edit_resource_#{path_or_url}") + controller.send(:"edit_resource_#{path_or_url}") # With arg controller.expects("admin_backpack_#{path_or_url}").with(:arg, {}).once - controller.send("resource_#{path_or_url}", :arg) + controller.send(:"resource_#{path_or_url}", :arg) controller.expects("admin_backpack_#{path_or_url}").with(:arg, {}).once - controller.send("resource_#{path_or_url}", :arg) + controller.send(:"resource_#{path_or_url}", :arg) # With options controller.expects("admin_backpack_#{path_or_url}").with(:arg, page: 1).once - controller.send("resource_#{path_or_url}", :arg, page: 1) + controller.send(:"resource_#{path_or_url}", :arg, page: 1) end end @@ -257,21 +257,21 @@ def test_url_helpers_on_simple_inherited_singleton_resource # rubocop:disable Mi [:url, :path].each do |path_or_url| controller.expects("root_#{path_or_url}").with({}).once - controller.send("collection_#{path_or_url}") + controller.send(:"collection_#{path_or_url}") controller.expects("universum_#{path_or_url}").with({}).once - controller.send("resource_#{path_or_url}") + controller.send(:"resource_#{path_or_url}") controller.expects("new_universum_#{path_or_url}").with({}).once - controller.send("new_resource_#{path_or_url}") + controller.send(:"new_resource_#{path_or_url}") controller.expects("edit_universum_#{path_or_url}").with({}).once - controller.send("edit_resource_#{path_or_url}") + controller.send(:"edit_resource_#{path_or_url}") # With options # Also tests that argument sent are not used controller.expects("universum_#{path_or_url}").with(page: 1).once - controller.send("resource_#{path_or_url}", :arg, page: 1) + controller.send(:"resource_#{path_or_url}", :arg, page: 1) end end @@ -283,27 +283,27 @@ def test_url_helpers_on_singleton_belongs_to # rubocop:disable Minitest/NoAssert [:url, :path].each do |path_or_url| controller.expects("house_fireplace_flames_#{path_or_url}").with(:house, {}).once - controller.send("collection_#{path_or_url}") + controller.send(:"collection_#{path_or_url}") controller.expects("house_fireplace_flame_#{path_or_url}").with(:house, :flame, {}).once - controller.send("resource_#{path_or_url}") + controller.send(:"resource_#{path_or_url}") controller.expects("new_house_fireplace_flame_#{path_or_url}").with(:house, {}).once - controller.send("new_resource_#{path_or_url}") + controller.send(:"new_resource_#{path_or_url}") controller.expects("edit_house_fireplace_flame_#{path_or_url}").with(:house, :flame, {}).once - controller.send("edit_resource_#{path_or_url}") + controller.send(:"edit_resource_#{path_or_url}") controller.expects("house_fireplace_#{path_or_url}").with(:house, {}).once - controller.send("parent_#{path_or_url}") + controller.send(:"parent_#{path_or_url}") controller.expects("edit_house_fireplace_#{path_or_url}").with(:house, {}).once - controller.send("edit_parent_#{path_or_url}") + controller.send(:"edit_parent_#{path_or_url}") # With options # Also tests that argument sent are not used controller.expects("house_fireplace_flame_#{path_or_url}").with(:house, :arg, page: 1).once - controller.send("resource_#{path_or_url}", :arg, page: 1) + controller.send(:"resource_#{path_or_url}", :arg, page: 1) end end @@ -314,36 +314,36 @@ def test_url_helpers_on_belongs_to # rubocop:disable Minitest/NoAssertions [:url, :path].each do |path_or_url| controller.expects("house_tables_#{path_or_url}").with(:house, {}).once - controller.send("collection_#{path_or_url}") + controller.send(:"collection_#{path_or_url}") controller.expects("house_table_#{path_or_url}").with(:house, :table, {}).once - controller.send("resource_#{path_or_url}") + controller.send(:"resource_#{path_or_url}") controller.expects("new_house_table_#{path_or_url}").with(:house, {}).once - controller.send("new_resource_#{path_or_url}") + controller.send(:"new_resource_#{path_or_url}") controller.expects("edit_house_table_#{path_or_url}").with(:house, :table, {}).once - controller.send("edit_resource_#{path_or_url}") + controller.send(:"edit_resource_#{path_or_url}") controller.expects("house_#{path_or_url}").with(:house, {}).once - controller.send("parent_#{path_or_url}") + controller.send(:"parent_#{path_or_url}") controller.expects("edit_house_#{path_or_url}").with(:house, {}).once - controller.send("edit_parent_#{path_or_url}") + controller.send(:"edit_parent_#{path_or_url}") # With arg controller.expects("house_table_#{path_or_url}").with(:house, :arg, {}).once - controller.send("resource_#{path_or_url}", :arg) + controller.send(:"resource_#{path_or_url}", :arg) controller.expects("edit_house_table_#{path_or_url}").with(:house, :arg, {}).once - controller.send("edit_resource_#{path_or_url}", :arg) + controller.send(:"edit_resource_#{path_or_url}", :arg) controller.expects("house_#{path_or_url}").with(:arg, {}).once - controller.send("parent_#{path_or_url}", :arg) + controller.send(:"parent_#{path_or_url}", :arg) # With options controller.expects("house_table_#{path_or_url}").with(:house, :arg, page: 1).once - controller.send("resource_#{path_or_url}", :arg, page: 1) + controller.send(:"resource_#{path_or_url}", :arg, page: 1) end end @@ -354,36 +354,36 @@ def test_url_helpers_on_not_default_belongs_to # rubocop:disable Minitest/NoAsse [:url, :path].each do |path_or_url| controller.expects("big_house_rooms_#{path_or_url}").with(:house, {}).once - controller.send("collection_#{path_or_url}") + controller.send(:"collection_#{path_or_url}") controller.expects("big_house_room_#{path_or_url}").with(:house, :room, {}).once - controller.send("resource_#{path_or_url}") + controller.send(:"resource_#{path_or_url}") controller.expects("new_big_house_room_#{path_or_url}").with(:house, {}).once - controller.send("new_resource_#{path_or_url}") + controller.send(:"new_resource_#{path_or_url}") controller.expects("edit_big_house_room_#{path_or_url}").with(:house, :room, {}).once - controller.send("edit_resource_#{path_or_url}") + controller.send(:"edit_resource_#{path_or_url}") controller.expects("big_house_#{path_or_url}").with(:house, {}).once - controller.send("parent_#{path_or_url}") + controller.send(:"parent_#{path_or_url}") controller.expects("edit_big_house_#{path_or_url}").with(:house, {}).once - controller.send("edit_parent_#{path_or_url}") + controller.send(:"edit_parent_#{path_or_url}") # With args controller.expects("big_house_room_#{path_or_url}").with(:house, :arg, {}).once - controller.send("resource_#{path_or_url}", :arg) + controller.send(:"resource_#{path_or_url}", :arg) controller.expects("edit_big_house_room_#{path_or_url}").with(:house, :arg, {}).once - controller.send("edit_resource_#{path_or_url}", :arg) + controller.send(:"edit_resource_#{path_or_url}", :arg) controller.expects("big_house_#{path_or_url}").with(:arg, {}).once - controller.send("parent_#{path_or_url}", :arg) + controller.send(:"parent_#{path_or_url}", :arg) # With options controller.expects("big_house_room_#{path_or_url}").with(:house, :arg, page: 1).once - controller.send("resource_#{path_or_url}", :arg, page: 1) + controller.send(:"resource_#{path_or_url}", :arg, page: 1) end end @@ -395,36 +395,36 @@ def test_url_helpers_on_nested_belongs_to # rubocop:disable Minitest/NoAssertion [:url, :path].each do |path_or_url| controller.expects("house_table_chairs_#{path_or_url}").with(:house, :table, {}).once - controller.send("collection_#{path_or_url}") + controller.send(:"collection_#{path_or_url}") controller.expects("house_table_chair_#{path_or_url}").with(:house, :table, :chair, {}).once - controller.send("resource_#{path_or_url}") + controller.send(:"resource_#{path_or_url}") controller.expects("new_house_table_chair_#{path_or_url}").with(:house, :table, {}).once - controller.send("new_resource_#{path_or_url}") + controller.send(:"new_resource_#{path_or_url}") controller.expects("edit_house_table_chair_#{path_or_url}").with(:house, :table, :chair, {}).once - controller.send("edit_resource_#{path_or_url}") + controller.send(:"edit_resource_#{path_or_url}") controller.expects("house_table_#{path_or_url}").with(:house, :table, {}).once - controller.send("parent_#{path_or_url}") + controller.send(:"parent_#{path_or_url}") controller.expects("edit_house_table_#{path_or_url}").with(:house, :table, {}).once - controller.send("edit_parent_#{path_or_url}") + controller.send(:"edit_parent_#{path_or_url}") # With args controller.expects("edit_house_table_chair_#{path_or_url}").with(:house, :table, :arg, {}).once - controller.send("edit_resource_#{path_or_url}", :arg) + controller.send(:"edit_resource_#{path_or_url}", :arg) controller.expects("house_table_chair_#{path_or_url}").with(:house, :table, :arg, {}).once - controller.send("resource_#{path_or_url}", :arg) + controller.send(:"resource_#{path_or_url}", :arg) controller.expects("house_table_#{path_or_url}").with(:house, :arg, {}).once - controller.send("parent_#{path_or_url}", :arg) + controller.send(:"parent_#{path_or_url}", :arg) # With options controller.expects("edit_house_table_chair_#{path_or_url}").with(:house, :table, :arg, page: 1).once - controller.send("edit_resource_#{path_or_url}", :arg, page: 1) + controller.send(:"edit_resource_#{path_or_url}", :arg, page: 1) end end @@ -435,27 +435,27 @@ def test_url_helpers_on_singletons_with_belongs_to # rubocop:disable Minitest/No [:url, :path].each do |path_or_url| controller.expects("house_#{path_or_url}").with(:house, {}).once - controller.send("collection_#{path_or_url}") + controller.send(:"collection_#{path_or_url}") controller.expects("house_owner_#{path_or_url}").with(:house, {}).once - controller.send("resource_#{path_or_url}") + controller.send(:"resource_#{path_or_url}") controller.expects("new_house_owner_#{path_or_url}").with(:house, {}).once - controller.send("new_resource_#{path_or_url}") + controller.send(:"new_resource_#{path_or_url}") controller.expects("edit_house_owner_#{path_or_url}").with(:house, {}).once - controller.send("edit_resource_#{path_or_url}") + controller.send(:"edit_resource_#{path_or_url}") controller.expects("house_#{path_or_url}").with(:house, {}).once - controller.send("parent_#{path_or_url}") + controller.send(:"parent_#{path_or_url}") controller.expects("edit_house_#{path_or_url}").with(:house, {}).once - controller.send("edit_parent_#{path_or_url}") + controller.send(:"edit_parent_#{path_or_url}") # With options # Also tests that argument sent are not used controller.expects("house_owner_#{path_or_url}").with(:house, page: 1).once - controller.send("resource_#{path_or_url}", :arg, page: 1) + controller.send(:"resource_#{path_or_url}", :arg, page: 1) end end @@ -480,22 +480,22 @@ def test_url_helpers_on_singleton_and_polymorphic_belongs_to # rubocop:disable M [:url, :path].each do |path_or_url| mock_polymorphic(controller, "house_dishwasher_fork_spots_#{path_or_url}").with(house, fork).once - controller.send("collection_#{path_or_url}") + controller.send(:"collection_#{path_or_url}") mock_polymorphic(controller, "house_dishwasher_fork_spot_#{path_or_url}").with(house, fork, spot).once - controller.send("resource_#{path_or_url}") + controller.send(:"resource_#{path_or_url}") mock_polymorphic(controller, "new_house_dishwasher_fork_spot_#{path_or_url}").with(house, fork).once - controller.send("new_resource_#{path_or_url}") + controller.send(:"new_resource_#{path_or_url}") mock_polymorphic(controller, "edit_house_dishwasher_fork_spot_#{path_or_url}").with(house, fork, spot).once - controller.send("edit_resource_#{path_or_url}") + controller.send(:"edit_resource_#{path_or_url}") mock_polymorphic(controller, "house_dishwasher_fork_#{path_or_url}").with(house, fork).once - controller.send("parent_#{path_or_url}") + controller.send(:"parent_#{path_or_url}") mock_polymorphic(controller, "edit_house_dishwasher_fork_#{path_or_url}").with(house, fork).once - controller.send("edit_parent_#{path_or_url}") + controller.send(:"edit_parent_#{path_or_url}") end end @@ -516,22 +516,22 @@ def test_url_helpers_on_polymorphic_belongs_to # rubocop:disable Minitest/NoAsse [:url, :path].each do |path_or_url| mock_polymorphic(controller, "house_beds_#{path_or_url}").with(house).once - controller.send("collection_#{path_or_url}") + controller.send(:"collection_#{path_or_url}") mock_polymorphic(controller, "house_bed_#{path_or_url}").with(house, bed).once - controller.send("resource_#{path_or_url}") + controller.send(:"resource_#{path_or_url}") mock_polymorphic(controller, "new_house_bed_#{path_or_url}").with(house).once - controller.send("new_resource_#{path_or_url}") + controller.send(:"new_resource_#{path_or_url}") mock_polymorphic(controller, "edit_house_bed_#{path_or_url}").with(house, bed).once - controller.send("edit_resource_#{path_or_url}") + controller.send(:"edit_resource_#{path_or_url}") mock_polymorphic(controller, "house_#{path_or_url}").with(house).once - controller.send("parent_#{path_or_url}") + controller.send(:"parent_#{path_or_url}") mock_polymorphic(controller, "edit_house_#{path_or_url}").with(house).once - controller.send("edit_parent_#{path_or_url}") + controller.send(:"edit_parent_#{path_or_url}") end # With options @@ -572,22 +572,22 @@ def test_url_helpers_on_polymorphic_belongs_to_using_uncountable # rubocop:disab [:url, :path].each do |path_or_url| mock_polymorphic(controller, "news_sheep_index_#{path_or_url}").with(news).once - controller.send("collection_#{path_or_url}") + controller.send(:"collection_#{path_or_url}") mock_polymorphic(controller, "news_sheep_#{path_or_url}").with(news, sheep).once - controller.send("resource_#{path_or_url}") + controller.send(:"resource_#{path_or_url}") mock_polymorphic(controller, "new_news_sheep_#{path_or_url}").with(news).once - controller.send("new_resource_#{path_or_url}") + controller.send(:"new_resource_#{path_or_url}") mock_polymorphic(controller, "edit_news_sheep_#{path_or_url}").with(news, sheep).once - controller.send("edit_resource_#{path_or_url}") + controller.send(:"edit_resource_#{path_or_url}") mock_polymorphic(controller, "news_#{path_or_url}").with(news).once - controller.send("parent_#{path_or_url}") + controller.send(:"parent_#{path_or_url}") mock_polymorphic(controller, "edit_news_#{path_or_url}").with(news).once - controller.send("edit_parent_#{path_or_url}") + controller.send(:"edit_parent_#{path_or_url}") end # With options @@ -625,22 +625,22 @@ def test_url_helpers_on_shallow_belongs_to_using_uncountable # rubocop:disable M [:url, :path].each do |path_or_url| controller.expects("bed_fish_index_#{path_or_url}").with(bed, {}).once - controller.send("collection_#{path_or_url}") + controller.send(:"collection_#{path_or_url}") controller.expects("fish_#{path_or_url}").with(fish, {}).once - controller.send("resource_#{path_or_url}") + controller.send(:"resource_#{path_or_url}") controller.expects("new_bed_fish_#{path_or_url}").with(bed, {}).once - controller.send("new_resource_#{path_or_url}") + controller.send(:"new_resource_#{path_or_url}") controller.expects("edit_fish_#{path_or_url}").with(fish, {}).once - controller.send("edit_resource_#{path_or_url}") + controller.send(:"edit_resource_#{path_or_url}") controller.expects("bed_#{path_or_url}").with(bed, {}).once - controller.send("parent_#{path_or_url}") + controller.send(:"parent_#{path_or_url}") controller.expects("edit_bed_#{path_or_url}").with(bed, {}).once - controller.send("edit_parent_#{path_or_url}") + controller.send(:"edit_parent_#{path_or_url}") end end @@ -661,22 +661,22 @@ def test_url_helpers_on_namespaced_polymorphic_belongs_to # rubocop:disable Mini [:url, :path].each do |path_or_url| mock_polymorphic(controller, "admin_house_desks_#{path_or_url}").with(house).once - controller.send("collection_#{path_or_url}") + controller.send(:"collection_#{path_or_url}") mock_polymorphic(controller, "admin_house_desk_#{path_or_url}").with(house, desk).once - controller.send("resource_#{path_or_url}") + controller.send(:"resource_#{path_or_url}") mock_polymorphic(controller, "new_admin_house_desk_#{path_or_url}").with(house).once - controller.send("new_resource_#{path_or_url}") + controller.send(:"new_resource_#{path_or_url}") mock_polymorphic(controller, "edit_admin_house_desk_#{path_or_url}").with(house, desk).once - controller.send("edit_resource_#{path_or_url}") + controller.send(:"edit_resource_#{path_or_url}") mock_polymorphic(controller, "admin_house_#{path_or_url}").with(house).once - controller.send("parent_#{path_or_url}") + controller.send(:"parent_#{path_or_url}") mock_polymorphic(controller, "edit_admin_house_#{path_or_url}").with(house).once - controller.send("edit_parent_#{path_or_url}") + controller.send(:"edit_parent_#{path_or_url}") end # With options @@ -719,22 +719,22 @@ def test_url_helpers_on_nested_polymorphic_belongs_to # rubocop:disable Minitest [:url, :path].each do |path_or_url| mock_polymorphic(controller, "house_table_dishes_#{path_or_url}").with(house, table).once - controller.send("collection_#{path_or_url}") + controller.send(:"collection_#{path_or_url}") mock_polymorphic(controller, "house_table_dish_#{path_or_url}").with(house, table, dish).once - controller.send("resource_#{path_or_url}") + controller.send(:"resource_#{path_or_url}") mock_polymorphic(controller, "new_house_table_dish_#{path_or_url}").with(house, table).once - controller.send("new_resource_#{path_or_url}") + controller.send(:"new_resource_#{path_or_url}") mock_polymorphic(controller, "edit_house_table_dish_#{path_or_url}").with(house, table, dish).once - controller.send("edit_resource_#{path_or_url}") + controller.send(:"edit_resource_#{path_or_url}") mock_polymorphic(controller, "house_table_#{path_or_url}").with(house, table).once - controller.send("parent_#{path_or_url}") + controller.send(:"parent_#{path_or_url}") mock_polymorphic(controller, "edit_house_table_#{path_or_url}").with(house, table).once - controller.send("edit_parent_#{path_or_url}") + controller.send(:"edit_parent_#{path_or_url}") end # With options @@ -773,22 +773,22 @@ def test_url_helpers_on_singleton_nested_polymorphic_belongs_to # rubocop:disabl [:url, :path].each do |path_or_url| mock_polymorphic(controller, "house_table_#{path_or_url}").with(house, table).once - controller.send("collection_#{path_or_url}") + controller.send(:"collection_#{path_or_url}") mock_polymorphic(controller, "house_table_center_#{path_or_url}").with(house, table).once - controller.send("resource_#{path_or_url}") + controller.send(:"resource_#{path_or_url}") mock_polymorphic(controller, "new_house_table_center_#{path_or_url}").with(house, table).once - controller.send("new_resource_#{path_or_url}") + controller.send(:"new_resource_#{path_or_url}") mock_polymorphic(controller, "edit_house_table_center_#{path_or_url}").with(house, table).once - controller.send("edit_resource_#{path_or_url}") + controller.send(:"edit_resource_#{path_or_url}") mock_polymorphic(controller, "house_table_#{path_or_url}").with(house, table).once - controller.send("parent_#{path_or_url}") + controller.send(:"parent_#{path_or_url}") mock_polymorphic(controller, "edit_house_table_#{path_or_url}").with(house, table).once - controller.send("edit_parent_#{path_or_url}") + controller.send(:"edit_parent_#{path_or_url}") end # With options @@ -819,16 +819,16 @@ def test_url_helpers_on_optional_polymorphic_belongs_to # rubocop:disable Minite [:url, :path].each do |path_or_url| mock_polymorphic(controller, "beds_#{path_or_url}").with().once - controller.send("collection_#{path_or_url}") + controller.send(:"collection_#{path_or_url}") mock_polymorphic(controller, "bed_#{path_or_url}").with(bed).once - controller.send("resource_#{path_or_url}") + controller.send(:"resource_#{path_or_url}") mock_polymorphic(controller, "new_bed_#{path_or_url}").with().once - controller.send("new_resource_#{path_or_url}") + controller.send(:"new_resource_#{path_or_url}") mock_polymorphic(controller, "edit_bed_#{path_or_url}").with(bed).once - controller.send("edit_resource_#{path_or_url}") + controller.send(:"edit_resource_#{path_or_url}") end # With options @@ -850,22 +850,22 @@ def test_url_helpers_on_belongs_to_with_shallowed_route # rubocop:disable Minite [:url, :path].each do |path_or_url| controller.expects("house_mirrors_#{path_or_url}").with(:house, {}).once - controller.send("collection_#{path_or_url}") + controller.send(:"collection_#{path_or_url}") controller.expects("mirror_#{path_or_url}").with(:mirror, {}).once - controller.send("resource_#{path_or_url}") + controller.send(:"resource_#{path_or_url}") controller.expects("new_house_mirror_#{path_or_url}").with(:house, {}).once - controller.send("new_resource_#{path_or_url}") + controller.send(:"new_resource_#{path_or_url}") controller.expects("edit_mirror_#{path_or_url}").with(:mirror, {}).once - controller.send("edit_resource_#{path_or_url}") + controller.send(:"edit_resource_#{path_or_url}") controller.expects("house_#{path_or_url}").with(:house, {}).once - controller.send("parent_#{path_or_url}") + controller.send(:"parent_#{path_or_url}") controller.expects("edit_house_#{path_or_url}").with(:house, {}).once - controller.send("edit_parent_#{path_or_url}") + controller.send(:"edit_parent_#{path_or_url}") end end @@ -877,22 +877,22 @@ def test_url_helpers_on_nested_belongs_to_with_shallowed_route # rubocop:disable [:url, :path].each do |path_or_url| controller.expects("window_buttons_#{path_or_url}").with(:window, {}).once - controller.send("collection_#{path_or_url}") + controller.send(:"collection_#{path_or_url}") controller.expects("button_#{path_or_url}").with(:button, {}).once - controller.send("resource_#{path_or_url}") + controller.send(:"resource_#{path_or_url}") controller.expects("new_window_button_#{path_or_url}").with(:window, {}).once - controller.send("new_resource_#{path_or_url}") + controller.send(:"new_resource_#{path_or_url}") controller.expects("edit_button_#{path_or_url}").with(:button, {}).once - controller.send("edit_resource_#{path_or_url}") + controller.send(:"edit_resource_#{path_or_url}") controller.expects("window_#{path_or_url}").with(:window, {}).once - controller.send("parent_#{path_or_url}") + controller.send(:"parent_#{path_or_url}") controller.expects("edit_window_#{path_or_url}").with(:window, {}).once - controller.send("edit_parent_#{path_or_url}") + controller.send(:"edit_parent_#{path_or_url}") end end @@ -903,10 +903,10 @@ def test_url_helpers_with_custom_actions # rubocop:disable Minitest/NoAssertions controller.instance_variable_set(:@button, :button) [:url, :path].each do |path_or_url| controller.expects("delete_button_#{path_or_url}").with(:button, {}).once - controller.send("delete_resource_#{path_or_url}") + controller.send(:"delete_resource_#{path_or_url}") controller.expects("search_window_buttons_#{path_or_url}").with(:window, {}).once - controller.send("search_resources_#{path_or_url}") + controller.send(:"search_resources_#{path_or_url}") end end @@ -935,22 +935,22 @@ def test_url_helpers_on_namespaced_resource_with_shallowed_route # rubocop:disab [:url, :path].each do |path_or_url| controller.expects("admin_house_mirrors_#{path_or_url}").with(:house, {}).once - controller.send("collection_#{path_or_url}") + controller.send(:"collection_#{path_or_url}") controller.expects("admin_mirror_#{path_or_url}").with(:mirror, {}).once - controller.send("resource_#{path_or_url}") + controller.send(:"resource_#{path_or_url}") controller.expects("new_admin_house_mirror_#{path_or_url}").with(:house, {}).once - controller.send("new_resource_#{path_or_url}") + controller.send(:"new_resource_#{path_or_url}") controller.expects("edit_admin_mirror_#{path_or_url}").with(:mirror, {}).once - controller.send("edit_resource_#{path_or_url}") + controller.send(:"edit_resource_#{path_or_url}") controller.expects("admin_house_#{path_or_url}").with(:house, {}).once - controller.send("parent_#{path_or_url}") + controller.send(:"parent_#{path_or_url}") controller.expects("edit_admin_house_#{path_or_url}").with(:house, {}).once - controller.send("edit_parent_#{path_or_url}") + controller.send(:"edit_parent_#{path_or_url}") end end @@ -963,7 +963,7 @@ def test_url_helpers_with_action_controller_parameters # rubocop:disable Minites [:url, :path].each do |path_or_url| controller.expects("houses_#{path_or_url}").with({'page' => 2}).once - controller.send("collection_#{path_or_url}", parameters) + controller.send(:"collection_#{path_or_url}", parameters) end end end