Skip to content

Commit 79218db

Browse files
committed
Add missing request test for states_controller
1 parent b5892a3 commit 79218db

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
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)