diff --git a/lib/roar-rails.rb b/lib/roar-rails.rb index 5137eb7..675bbc1 100644 --- a/lib/roar-rails.rb +++ b/lib/roar-rails.rb @@ -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 @@ -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' diff --git a/lib/roar/rails/rails7_0_strategy.rb b/lib/roar/rails/rails7_0_strategy.rb new file mode 100644 index 0000000..b26b541 --- /dev/null +++ b/lib/roar/rails/rails7_0_strategy.rb @@ -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