Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import ActionController::MissingRenderer from Rails #245

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/action_controller/responder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,13 @@ class Responder
put: :edit
}

# See Responder#api_behavior
class MissingRenderer < LoadError
def initialize(format)
super "No renderer defined for format: #{format}"
end
end

def initialize(controller, resources, options = {})
@controller = controller
@request = @controller.request
Expand Down
2 changes: 1 addition & 1 deletion test/action_controller/respond_with_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ def test_using_resource_with_set_responder

def test_raises_missing_renderer_if_an_api_behavior_with_no_renderer
@controller = CsvRespondWithController.new
assert_raise ActionController::MissingRenderer do
assert_raise ActionController::Responder::MissingRenderer do
get :index, format: "csv"
end
end
Expand Down