Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

failing test for custom actions with and without optional parents #202

Closed
wants to merge 1 commit into from

2 participants

Jacob Henry Rafael Mendonça França
Jacob Henry

I tried creating a patch but was unsuccessful. Could you please look at these failing tests to see if you have an idea for a workarount. The problem roots from custom actions not having a polymorphic path. The workaround in this post worked for me on an individual basis. Instead of using the custom action url helpers archive_resource_url I am using the main helper with a :action option resource_url(:action => :archive)

Rafael Mendonça França rafaelfranca removed the Bug label
Rafael Mendonça França
Collaborator

This issue has been automatically closed because of inactivity.

If you can still reproduce this error on the newest version, please reply with all of the information you have about it in order to keep the issue open.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 35 additions and 0 deletions.
  1. +35 −0 test/url_helpers_test.rb
35 test/url_helpers_test.rb
View
@@ -119,6 +119,14 @@ class ButtonsController < InheritedResources::Base
custom_actions :resource => :delete, :collection => :search
end
+class PanelController < InheritedResources::Base
+ belongs_to :display, :optional => true do
+ belongs_to :window
+ end
+
+ custom_actions :resource => :lock, :collection => :search
+end
+
class ImageButtonsController < ButtonsController
end
@@ -764,6 +772,33 @@ def test_url_helpers_with_custom_actions
controller.send("search_resources_#{path_or_url}")
end
end
+
+ def test_url_helpers_on_custom_actions_with_optional_parents
+ controller = PanelController.new
+ controller.instance_variable_set('@display', :display)
+ controller.instance_variable_set('@window', :window)
+ controller.instance_variable_set('@panel', :panel)
+ [:url, :path].each do |path_or_url|
+ controller.expects("lock_display_window_panel_#{path_or_url}").with(:panel, {}).once
+ controller.send("lock_resource_#{path_or_url}")
+
+ controller.expects("search_display_window_panels_#{path_or_url}").with(:window, {}).once
+ controller.send("search_resources_#{path_or_url}")
+ end
+ end
+
+ def test_url_helpers_on_custom_actions_without_optional_parents
+ controller = PanelController.new
+ controller.instance_variable_set('@window', :window)
+ controller.instance_variable_set('@panel', :panel)
+ [:url, :path].each do |path_or_url|
+ controller.expects("lock_window_panel_#{path_or_url}").with(:panel, {}).once
+ controller.send("lock_resource_#{path_or_url}")
+
+ controller.expects("search_window_panels_#{path_or_url}").with(:window, {}).once
+ controller.send("search_resources_#{path_or_url}")
+ end
+ end
def test_helper_methods_with_custom_actions
controller = ButtonsController.new
Something went wrong with that request. Please try again.