Sha256: ab0c268ca2890a4ec0a0fd7e98c09ccaf200571c1d2c843c6615cba628bd77bb
Contents?: true
Size: 1.18 KB
Versions: 3
Compression:
Stored size: 1.18 KB
Contents
require 'test/test_helper' class HelpersTest < ActionController::TestCase tests ApplicationController test 'get resource name from request path' do @request.path = '/users/session' assert_equal :user, @controller.resource_name end test 'get resource name from specific request path' do @request.path = '/admin_area/session' assert_equal :admin, @controller.resource_name end test 'get resource class from request path' do @request.path = '/users/session' assert_equal User, @controller.resource_class end test 'get resource instance variable from request path' do @request.path = '/admin_area/session' @controller.instance_variable_set(:@admin, admin = Admin.new) assert_equal admin, @controller.resource end test 'set resource instance variable from request path' do @request.path = '/admin_area/session' admin = @controller.send(:resource_class).new @controller.send(:resource=, admin) assert_equal admin, @controller.send(:resource) assert_equal admin, @controller.instance_variable_get(:@admin) end test 'resources methods are not controller actions' do assert @controller.class.action_methods.empty? end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
devise-0.2.0 | test/controllers/helpers_test.rb |
devise-0.1.1 | test/controllers/helpers_test.rb |
devise-0.1.0 | test/controllers/helpers_test.rb |