Skip to content

Commit

Permalink
fix: make regex_to_remove_controller_namespace a class method rather …
Browse files Browse the repository at this point in the history
…than an instance method
  • Loading branch information
aaricpittman committed Sep 1, 2023
1 parent da01aac commit bbbd8a6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ def model_namespace_from_controller_namespace
namespace
end

def regex_to_remove_controller_namespace
raise "This is a template method that needs to be implemented by controllers including LoadsAndAuthorizesResource."
end

# this is one of the few pieces of 'magical' functionality that bullet train implements
# for you in your controllers beyond that is provided by the underlying gems that we've
# tied together. we've taken the liberty of doing this because it's heavily based on
Expand Down Expand Up @@ -202,10 +206,6 @@ def account_load_and_authorize_resource(model, options, old_options = {})
end
end

def regex_to_remove_controller_namespace
raise "This is a template method that needs to be implemented by controllers including LoadsAndAuthorizesResource."
end

def load_team
# Not all objects that need to be authorized belong to a team,
# so we give @team a nil value if no association is found.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ class TestClass
assert TestClass.respond_to?(:account_load_and_authorize_resource)
end

test "it defines #load_team" do
assert TestClass.new.respond_to?(:load_team)
test "it defines .regex_to_remove_controller_namespace" do
assert TestClass.respond_to?(:regex_to_remove_controller_namespace)
end

test "it defines #regex_to_remove_controller_namespace" do
assert TestClass.new.respond_to?(:regex_to_remove_controller_namespace)
test "it defines #load_team" do
assert TestClass.new.respond_to?(:load_team)
end
end

0 comments on commit bbbd8a6

Please sign in to comment.