Skip to content
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
12 changes: 10 additions & 2 deletions admin/app/controllers/solidus_admin/resources_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@
resource_class.all
end

def per_page; end

def set_resource
@resource ||= resource_class.find(params[:id]).tap do |resource|
instance_variable_set("@#{resource_name}", resource)
Expand Down Expand Up @@ -157,5 +155,15 @@
def after_destroy_path
solidus_admin.send("#{plural_resource_name}_path", **search_filter_params)
end

def blueprint
raise NotImplementedError,

Check warning on line 160 in admin/app/controllers/solidus_admin/resources_controller.rb

View check run for this annotation

Codecov / codecov/patch

admin/app/controllers/solidus_admin/resources_controller.rb#L160

Added line #L160 was not covered by tests
"You must implement the blueprint method in #{self.class}"
end

def blueprint_view
raise NotImplementedError,

Check warning on line 165 in admin/app/controllers/solidus_admin/resources_controller.rb

View check run for this annotation

Codecov / codecov/patch

admin/app/controllers/solidus_admin/resources_controller.rb#L165

Added line #L165 was not covered by tests
"You must implement the blueprint_view method in #{self.class}"
end
end
end
22 changes: 22 additions & 0 deletions admin/spec/requests/solidus_admin/states_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# frozen_string_literal: true

require "spec_helper"

RSpec.describe "SolidusAdmin::StatesController", type: :request do
let(:admin_user) { create(:admin_user) }

before do
allow_any_instance_of(SolidusAdmin::BaseController).to receive(:spree_current_user).and_return(admin_user)
end

describe "GET /index" do
before { create_list(:state, 3) }

it "serves json with a 200 OK status" do
get solidus_admin.states_path
expect(response.headers["Content-Type"]).to include("application/json")
expect(response).to have_http_status(:ok)
expect(JSON.parse(response.body).size).to eq(3)
end
end
end
Loading