Permalink
Browse files

Fix ActionView::RecordIdentifier to work as a singleton

We extend it with self, but the methods were not working properly were
used directly on module.
  • Loading branch information...
1 parent 8eb4600 commit f4d493ed7c451f3df7602c5164a1954caa40284e @drogus drogus committed Aug 25, 2012
@@ -27,6 +27,7 @@ module ActionView
# same naming convention and allows you to write less code if you follow it.
module RecordIdentifier
extend self
+ extend ModelNaming
include ModelNaming
@@ -37,4 +37,13 @@ def test_dom_class
def test_dom_class_with_prefix
assert_equal "custom_prefix_#{@singular}", dom_class(@record, :custom_prefix)
end
+
+ def test_dom_id_as_singleton_method
+ @record.save
+ assert_equal "#{@singular}_1", ActionView::RecordIdentifier.dom_id(@record)
+ end
+
+ def test_dom_class_as_singleton_method
+ assert_equal @singular, ActionView::RecordIdentifier.dom_class(@record)
+ end
end

0 comments on commit f4d493e

Please sign in to comment.