Testing Devise Helper Methods Integration in heartcombo/devise
This test suite validates the integration of Devise helper methods within API controllers, specifically focusing on controller helpers and authentication functionality. It ensures proper inclusion of helper methods while maintaining API controller simplicity.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
heartcombo/devise
test/controllers/helper_methods_test.rb
# frozen_string_literal: true
require 'test_helper'
class ApiController < ActionController::Metal
include Devise::Controllers::Helpers
end
class HelperMethodsTest < Devise::ControllerTestCase
tests ApiController
test 'includes Devise::Controllers::Helpers' do
assert_includes @controller.class.ancestors, Devise::Controllers::Helpers
end
test 'does not respond_to helper or helper_method' do
assert_not_respond_to @controller.class, :helper
assert_not_respond_to @controller.class, :helper_method
end
test 'defines methods like current_user' do
assert_respond_to @controller, :current_user
end
end