Making sure you are not creating unwanted actions by including Modules

This will blow up if someone includes a module with public methods that would count as actions.

# application_controller_test.rb
class ApplicationControllerTest < ActionController::TestCase
  class CleanController < ApplicationController
  end

  test "should be clean" do
    assert_equal [], CleanController.action_methods.to_a.
      reject{|a| a =~ /^_conditional_callback_around_/}
  end
end

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s