test/singleton_test.rb in karsthammer-inherited_resources-1.1.2.1 vs test/singleton_test.rb in karsthammer-inherited_resources-1.2.1
- old
+ new
@@ -2,14 +2,16 @@
# This test file is instead to test the how controller flow and actions
# using a belongs_to association. This is done using mocks a la rspec.
#
class Store
+ extend ActiveModel::Naming
end
class Manager
- def self.human_name; 'Manager'; end
+ extend ActiveModel::Naming
+# def self.human_name; 'Manager'; end
end
class ManagersController < InheritedResources::Base
belongs_to :store, :singleton => true
end
@@ -64,9 +66,10 @@
end
def test_the_requested_manager_is_destroyed_on_destroy
Store.expects(:find).with('37').returns(mock_store)
mock_store.expects(:manager).returns(mock_manager)
+ @controller.expects(:parent_url).returns('http://test.host/')
mock_manager.expects(:destroy)
delete :destroy, :store_id => '37'
assert_equal mock_store, assigns(:store)
assert_equal mock_manager, assigns(:manager)
end