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

Add rails 7 support #140

Open
wants to merge 1 commit into
base: master
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
29 changes: 15 additions & 14 deletions lib/roar-rails.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
require "roar/rails/version"
require "roar/representer"
require "roar/decorator"
require "roar/rails/railtie"
require 'roar/rails/version'
require 'roar/representer'
require 'roar/decorator'
require 'roar/rails/railtie'

module Roar
autoload("XML", "roar/xml")
autoload("JSON", "roar/json")
autoload('XML', 'roar/xml')
autoload('JSON', 'roar/json')

module JSON
autoload("HAL", "roar/rails/hal")
autoload("JSONAPI", "roar/rails/json_api")
autoload('HAL', 'roar/rails/hal')
autoload('JSONAPI', 'roar/rails/json_api')
end

autoload("Hypermedia", "roar/hypermedia")
autoload('Hypermedia', 'roar/hypermedia')
end


module Roar
module Rails
def self.rails_version
Expand All @@ -35,17 +34,19 @@ def self.rails_version
require 'roar/rails/rails4_2_strategy'
when Gem::Version.new(5.0)
require 'roar/rails/rails5_0_strategy'
when Gem::Version.new("5.1")
when Gem::Version.new('5.1')
require 'roar/rails/rails5_0_strategy'
when Gem::Version.new("5.2")
when Gem::Version.new('5.2')
require 'roar/rails/rails5_0_strategy'
when Gem::Version.new('7.0')
require 'roar/rails/rails7_0_strategy'
else
# fallback to 4.0 strategy
require 'roar/rails/rails4_0_strategy'
end

autoload("TestCase", "roar/rails/test_case")
autoload('TestCase', 'roar/rails/test_case')
end
end

require "roar/rails/controller_additions"
require 'roar/rails/controller_additions'
16 changes: 16 additions & 0 deletions lib/roar/rails/rails7_0_strategy.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
require 'action_controller/responder'

module Roar::Rails
class Responder < ActionController::Responder
module VersionStrategy
end
end

module TestCase
module VersionStrategy
def process_args(action, http_method, document="", params={})
[action, { method: http_method, params: params }]
end
end
end
end