require File.dirname(__FILE__)+'/../test_helper' class HelpersTest < ActiveSupport::TestCase def setup @controller = PostsController.new @params = stub :[] => "1" @controller.stubs(:params).returns(@params) @_rc_object = Post.new Post.stubs(:find).with("1").returns(@_rc_object) @collection = mock() Post.stubs(:find).with(:all).returns(@collection) end ResourceController::NAME_ACCESSORS.each do |accessor| context "#{accessor} accessor" do should "default to returning the singular name of the controller" do assert_equal "post", @controller.send(accessor) end end end end