While migrating an application from Rails 2.3.17 to 3.2.21.. We are facing an issue with Rails legacy form helper link_to_remote
while testing with MiniTest.
In older version of rails we have used link_to_remote form helper which is removed in Rails 3. To provide support we have added prototype_legacy_helper plugin in our application which works fine in UI but tests for that fails and throws error like given below:
NoMethodError: undefined method `link_to_remote' for #<ApplicationHelperTest:0xc800dd4>
This is our code inside ApplicationHelper
def reservation_menu_command_link(command, *args)
...
command_link = link_to_remote(anchor_text,options = {}, {:class => style_class})
...
end
This is our test case for application_helper test
def test_reservation_menu_command_link
options = { :lodging_view => lv}
assert_equal(%q{xyz}, reservation_menu_command_link(:cancel_all_possible, options))
end
So you can see that we have a method reservation_menu_command_link and we used it inside our UI which works fine but test for this definition fails.
Could anyone can help me out from this behaviour of plugin?
link_to_remote
was deprecated between rails 2 and 3 the correct usage these days is
link_to 'Foo', { action: 'create' }, remote: true
. Hopefully that helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With