Skip to content
This repository has been archived by the owner on Sep 25, 2021. It is now read-only.

Commit

Permalink
Merge pull request #43 from georgeclaghorn/media-type
Browse files Browse the repository at this point in the history
Prefer ActionDispatch::Response#media_type when it's available
  • Loading branch information
rafaelfranca committed Jun 14, 2019
2 parents 2f42a3e + 8da1f63 commit 7505284
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/turbolinks/assertions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def assert_redirected_to(options = {}, message = nil)

def assert_turbolinks_visited(options = {}, message = nil)
assert_response(:ok, message)
assert_equal("text/javascript", response.content_type)
assert_equal("text/javascript", response.try(:media_type) || response.content_type)

visit_location, _ = turbolinks_visit_location_and_action

Expand All @@ -34,7 +34,7 @@ def assert_turbolinks_visited(options = {}, message = nil)
# header is cleared after controller action processing to prevent it
# from leaking into subsequent requests.
def turbolinks_request?
!request.get? && response.content_type == "text/javascript"
!request.get? && (response.try(:media_type) || response.content_type) == "text/javascript"
end

def turbolinks_visit_location_and_action
Expand Down

0 comments on commit 7505284

Please sign in to comment.