Skip to content

Commit 6d66dad

Browse files
authored
Merge pull request #6276 from chaimann/admin-resources-controller-cleanup
[Admin] Fix rubocop offence and resources controller cleanup
2 parents e19e1a7 + a0aca43 commit 6d66dad

2 files changed

Lines changed: 32 additions & 2 deletions

File tree

admin/app/controllers/solidus_admin/resources_controller.rb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,6 @@ def resources_collection
9696
resource_class.all
9797
end
9898

99-
def per_page; end
100-
10199
def set_resource
102100
@resource ||= resource_class.find(params[:id]).tap do |resource|
103101
instance_variable_set("@#{resource_name}", resource)
@@ -157,5 +155,15 @@ def after_update_path
157155
def after_destroy_path
158156
solidus_admin.send("#{plural_resource_name}_path", **search_filter_params)
159157
end
158+
159+
def blueprint
160+
raise NotImplementedError,
161+
"You must implement the blueprint method in #{self.class}"
162+
end
163+
164+
def blueprint_view
165+
raise NotImplementedError,
166+
"You must implement the blueprint_view method in #{self.class}"
167+
end
160168
end
161169
end
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# frozen_string_literal: true
2+
3+
require "spec_helper"
4+
5+
RSpec.describe "SolidusAdmin::StatesController", type: :request do
6+
let(:admin_user) { create(:admin_user) }
7+
8+
before do
9+
allow_any_instance_of(SolidusAdmin::BaseController).to receive(:spree_current_user).and_return(admin_user)
10+
end
11+
12+
describe "GET /index" do
13+
before { create_list(:state, 3) }
14+
15+
it "serves json with a 200 OK status" do
16+
get solidus_admin.states_path
17+
expect(response.headers["Content-Type"]).to include("application/json")
18+
expect(response).to have_http_status(:ok)
19+
expect(JSON.parse(response.body).size).to eq(3)
20+
end
21+
end
22+
end

0 commit comments

Comments
 (0)