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

Remove RABL remnants #3425

Merged
merged 1 commit into from
Nov 18, 2019
Merged
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
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
kennyadsl marked this conversation as resolved.
Show resolved Hide resolved
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