diff --git a/api/README.md b/api/README.md index b02a28c8e29..f5e634f401f 100644 --- a/api/README.md +++ b/api/README.md @@ -1,6 +1,6 @@ # solidus_api -API contains the controllers and rabl views implementing the REST API of +API contains the controllers and Jbuilder views implementing the REST API of Solidus. ## Testing diff --git a/api/lib/spree/api/responders.rb b/api/lib/spree/api/responders.rb index 7df86b3eae6..5a0d7232316 100644 --- a/api/lib/spree/api/responders.rb +++ b/api/lib/spree/api/responders.rb @@ -1,13 +1,13 @@ # frozen_string_literal: true require 'responders' -require 'spree/api/responders/rabl_template' +require 'spree/api/responders/jbuilder_template' module Spree module Api module Responders class AppResponder < ActionController::Responder - include RablTemplate + include JbuilderTemplate end end end diff --git a/api/lib/spree/api/responders/rabl_template.rb b/api/lib/spree/api/responders/jbuilder_template.rb similarity index 70% rename from api/lib/spree/api/responders/rabl_template.rb rename to api/lib/spree/api/responders/jbuilder_template.rb index 54909568e6a..122a1aba336 100644 --- a/api/lib/spree/api/responders/rabl_template.rb +++ b/api/lib/spree/api/responders/jbuilder_template.rb @@ -3,7 +3,7 @@ module Spree module Api module Responders - module RablTemplate + module JbuilderTemplate def to_format if template render template, status: options[:status] || 200 @@ -16,6 +16,8 @@ def template options[:default_template] end end + + RablTemplate = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('RablTemplate', 'JbuilderTemplate') end end end diff --git a/api/spec/lib/spree_api_responders_spec.rb b/api/spec/lib/spree_api_responders_spec.rb new file mode 100644 index 00000000000..54e1243bdb1 --- /dev/null +++ b/api/spec/lib/spree_api_responders_spec.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +require "spec_helper" + +describe "Spree Api Responders" do + it "RablTemplate is deprecated Use JbuilderTemplate" do + warning_message = /DEPRECATION WARNING: RablTemplate is deprecated! Use JbuilderTemplate instead/ + expect{ Spree::Api::Responders::RablTemplate.methods }.to output(warning_message).to_stderr + end +end diff --git a/api/spec/requests/rabl_cache_spec.rb b/api/spec/requests/jbuilder_cache_spec.rb similarity index 91% rename from api/spec/requests/rabl_cache_spec.rb rename to api/spec/requests/jbuilder_cache_spec.rb index cf1dcfe13a6..204b5966e79 100644 --- a/api/spec/requests/rabl_cache_spec.rb +++ b/api/spec/requests/jbuilder_cache_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe "Rabl Cache", type: :request, caching: true do +describe "Jbuilder Cache", type: :request, caching: true do let!(:user) { create(:admin_user) } before do @@ -11,7 +11,7 @@ expect(Spree::Product.count).to eq(1) end - it "doesn't create a cache key collision for models with different rabl templates" do + it "doesn't create a cache key collision for models with different jbuilder templates" do get "/api/variants", params: { token: user.spree_api_key } expect(response.status).to eq(200)