Commit 0b4338007593a984bde00672c63b6b1d4d26aa1a

Authored by Spencer Alan
1 parent e7dfbe7a
Exists in master

fix put archiving bug

app/controllers/scim_rails/scim_users_controller.rb
... ... @@ -98,7 +98,9 @@ module ScimRails
98 98 end
99 99  
100 100 def active?
101   - active = put_active_param || patch_active_param
  101 + active = put_active_param
  102 + active = patch_active_param if active.nil?
  103 +
102 104 case active
103 105 when true, "true", 1
104 106 true
... ...
spec/controllers/scim_rails/scim_users_controller_spec.rb
... ... @@ -419,6 +419,27 @@ RSpec.describe ScimRails::ScimUsersController, type: :controller do
419 419 expect(response.status).to eq 200
420 420 end
421 421  
  422 + it "archives an inactive record" do
  423 + request.content_type = "application/scim+json"
  424 + put :put_update, params: {
  425 + id: 1,
  426 + userName: "test@example.com",
  427 + name: {
  428 + givenName: "Test",
  429 + familyName: "User"
  430 + },
  431 + emails: [
  432 + {
  433 + value: "test@example.com"
  434 + },
  435 + ],
  436 + active: false
  437 + }
  438 +
  439 + expect(response.status).to eq 200
  440 + expect(user.reload.active?).to eq false
  441 + end
  442 +
422 443 it "returns :not_found for id that cannot be found" do
423 444 get :put_update, params: { id: "fake_id" }
424 445  
... ...