From b44bfa4c244e25642bd838972ee41669d2b37222 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Thu, 1 May 2014 16:03:26 -0700 Subject: always pass options to the _url method --- actionview/test/template/test_test.rb | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'actionview') 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 'David', link_to_person(person) + assert_equal person, the_model end end -- cgit v1.2.3