Skip to content

Commit 81b68ef

Browse files
authored
Moved and cleaned up rspec
1 parent 94b5f3e commit 81b68ef

File tree

2 files changed

+11
-20
lines changed

2 files changed

+11
-20
lines changed

spec/requests/admin/users_requests_spec.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,17 @@
237237
end
238238
end
239239
end
240+
describe "Validate Order of returned organization list" do
241+
let!(:pawnee_organization) { create(:organization, id: 2, name: "Pawnee") }
242+
let!(:sf_diaper_organization) { create(:organization, id: 3, name: "SF Diaper") }
243+
let!(:second_city_organization) { create(:organization, id: 4, name: "Second City") }
244+
245+
it "Should sort display resource in human alphabetical order" do
246+
get "/admin/users/resource_ids?resource_type=org_admin"
247+
puts response.body
248+
expect(response.body).to match(/{\"results\":\[{\"id\":\d+,\"text\":\"Org ABC\"},{\"id\":\d+,\"text\":\"Pawnee\"},{\"id\":\d+,\"text\":\"Second City\"},{\"id\":\d+,\"text\":\"SF Diaper\"}]}/)
249+
end
250+
end
240251
end
241252

242253
context "When logged in as an organization_admin" do

spec/system/admin/users_system_spec.rb

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -167,24 +167,4 @@
167167
end
168168
end
169169
end
170-
171-
describe "Resourse Dropdown List: Validate Order" do
172-
before do
173-
sign_in(super_admin)
174-
end
175-
176-
it "Should sort display resource in human alphabetical order" do
177-
FactoryBot.create(:organization, id: 2, name: "Pawnee")
178-
FactoryBot.create(:organization, id: 3, name: "SF Diaper")
179-
FactoryBot.create(:organization, id: 4, name: "Second City")
180-
181-
# params
182-
# - resource_type - Organization, Resource
183-
# - q - query string
184-
# visit admin_users_resource_ids_path # (name: "Organization", q: "")
185-
186-
visit "/admin/users/resource_ids?resource_type=org_admin"
187-
expect(page).to have_content("{\"id\":2,\"text\":\"Pawnee\"},{\"id\":4,\"text\":\"Second City\"},{\"id\":3,\"text\":\"SF Diaper\"}")
188-
end
189-
end
190170
end

0 commit comments

Comments
 (0)