Skip to content

Commit

Permalink
Make name optional when updating an Organization (#319)
Browse files Browse the repository at this point in the history
* Make name optional when updating an Organization

* cleanup

* 5.4.0
  • Loading branch information
faroceann authored Aug 5, 2024
1 parent ae64c0e commit 0f14026
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
workos (5.3.0)
workos (5.4.0)

GEM
remote: https://rubygems.org/
Expand Down
2 changes: 1 addition & 1 deletion lib/workos/organizations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def update_organization(
organization:,
domain_data: nil,
domains: nil,
name:,
name: nil,
allow_profiles_outside_organization: nil
)
body = { name: name }
Expand Down
2 changes: 1 addition & 1 deletion lib/workos/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module WorkOS
VERSION = '5.3.0'
VERSION = '5.4.0'
end
16 changes: 15 additions & 1 deletion spec/lib/workos/organizations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,28 @@

describe '.update_organization' do
context 'with valid payload' do
it 'creates an organization' do
it 'updates the organization' do
VCR.use_cassette 'organization/update' do
organization = described_class.update_organization(
organization: 'org_01F6Q6TFP7RD2PF6J03ANNWDKV',
domains: ['example.me'],
name: 'Test Organization',
)

expect(organization.id).to eq('org_01F6Q6TFP7RD2PF6J03ANNWDKV')
expect(organization.name).to eq('Test Organization')
expect(organization.domains.first[:domain]).to eq('example.me')
end
end
end
context 'without a name' do
it 'updates the organization' do
VCR.use_cassette 'organization/update_without_name' do
organization = described_class.update_organization(
organization: 'org_01F6Q6TFP7RD2PF6J03ANNWDKV',
domains: ['example.me'],
)

expect(organization.id).to eq('org_01F6Q6TFP7RD2PF6J03ANNWDKV')
expect(organization.name).to eq('Test Organization')
expect(organization.domains.first[:domain]).to eq('example.me')
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0f14026

Please sign in to comment.