Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make name optional when updating an Organization #319

Merged
merged 3 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
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
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.