Skip to content

Commit

Permalink
Remove RABL remnants
Browse files Browse the repository at this point in the history
RABL was removed from the project on version 2.4.0 (See #2147 #2146).
This updates the responder template to match with Jbuilder and updates
the README file.
  • Loading branch information
JuanCrg90 committed Nov 15, 2019
1 parent dd42c4a commit 3e07558
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion api/README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions api/lib/spree/api/responders.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -16,6 +16,8 @@ def template
options[:default_template]
end
end

RablTemplate = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('RablTemplate', 'JbuilderTemplate')
end
end
end
10 changes: 10 additions & 0 deletions api/spec/lib/spree_api_responders_spec.rb
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

Expand Down

0 comments on commit 3e07558

Please sign in to comment.