aboutsummaryrefslogtreecommitdiffstats
path: root/actionview
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2014-05-01 16:03:26 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2014-05-01 16:03:26 -0700
commitb44bfa4c244e25642bd838972ee41669d2b37222 (patch)
treeb676ae3a650fa28853256315d1ae1b835195afb0 /actionview
parent7f97eac6d26945f97d2a59cbef1834ea2a9a8be2 (diff)
downloadrails-b44bfa4c244e25642bd838972ee41669d2b37222.tar.gz
rails-b44bfa4c244e25642bd838972ee41669d2b37222.tar.bz2
rails-b44bfa4c244e25642bd838972ee41669d2b37222.zip
always pass options to the _url method
Diffstat (limited to 'actionview')
-rw-r--r--actionview/test/template/test_test.rb16
1 files changed, 13 insertions, 3 deletions
diff --git a/actionview/test/template/test_test.rb b/actionview/test/template/test_test.rb
index 108a674d95..5721ee6c6f 100644
--- a/actionview/test/template/test_test.rb
+++ b/actionview/test/template/test_test.rb
@@ -37,10 +37,20 @@ class PeopleHelperTest < ActionView::TestCase
def test_link_to_person
with_test_route_set do
- person = mock(:name => "David")
- person.class.extend ActiveModel::Naming
- expects(:mocha_mock_path).with(person).returns("/people/1")
+ person = Struct.new(:name) {
+ extend ActiveModel::Naming
+ def self.name; 'Mocha::Mock'; end
+ }.new "David"
+
+ the_model = nil
+ extend Module.new {
+ define_method(:mocha_mock_path) { |model, *args|
+ the_model = model
+ "/people/1"
+ }
+ }
assert_equal '<a href="/people/1">David</a>', link_to_person(person)
+ assert_equal person, the_model
end
end