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

Revert "Only include errors mixin in production mode" #15

Merged
merged 1 commit into from
Nov 12, 2020
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
4 changes: 1 addition & 3 deletions app/controllers/alchemy/json_api/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ module JsonApi
class BaseController < ::ApplicationController
include Alchemy::ControllerActions
include JSONAPI::Fetching
if Rails.env.production?
include JSONAPI::Errors
end
include JSONAPI::Errors
include JSONAPI::Filtering
include JSONAPI::Pagination
end
Expand Down
14 changes: 6 additions & 8 deletions spec/requests/alchemy/json_api/layout_pages_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@
let(:page) { FactoryBot.create(:alchemy_page, :public, elements: [element]) }
let(:element) { FactoryBot.create(:alchemy_element, name: "article", autogenerate_contents: true) }

it "raises 404 error" do
expect {
get alchemy_json_api.layout_page_path(page)
}.to raise_error(ActiveRecord::RecordNotFound)
it "returns a 404" do
get alchemy_json_api.layout_page_path(page)
expect(response).to have_http_status(404)
end
end

Expand All @@ -49,10 +48,9 @@
let!(:other_language) { FactoryBot.create(:alchemy_language, :german) }
let(:page) { FactoryBot.create(:alchemy_page, :public, :layoutpage, language: other_language) }

it "raises 404 error" do
expect {
get alchemy_json_api.layout_page_path(page)
}.to raise_error(ActiveRecord::RecordNotFound)
it "returns a 404" do
get alchemy_json_api.layout_page_path(page.urlname)
expect(response).to have_http_status(404)
end
end
end
Expand Down
7 changes: 3 additions & 4 deletions spec/requests/alchemy/json_api/pages_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,9 @@
let!(:other_language) { FactoryBot.create(:alchemy_language, :german) }
let(:page) { FactoryBot.create(:alchemy_page, :public, language: other_language) }

it "raises 404 error" do
expect {
get alchemy_json_api.page_path(page)
}.to raise_error(ActiveRecord::RecordNotFound)
it "returns a 404" do
get alchemy_json_api.page_path(page.urlname)
expect(response).to have_http_status(404)
end
end
end
Expand Down