Commit 9cb19a10 authored by Shinya Maeda's avatar Shinya Maeda

Merge branch 'jj-adjust-subscription-association' into 'master'

Don’t create new records on nested attributes

See merge request gitlab-org/gitlab!40537
parents 24402a40 9388bb91
......@@ -31,7 +31,7 @@ module EE
has_one :gitlab_subscription
has_one :elasticsearch_indexed_namespace
accepts_nested_attributes_for :gitlab_subscription
accepts_nested_attributes_for :gitlab_subscription, update_only: true
accepts_nested_attributes_for :namespace_limit
scope :include_gitlab_subscription, -> { includes(:gitlab_subscription) }
......
---
title: Don’t create new gitlab_subscription records on nested attributes to namespaces
merge_request: 40537
author:
type: fixed
......@@ -246,13 +246,14 @@ RSpec.describe API::Namespaces do
end
it "updates the gitlab_subscription record" do
group1.create_gitlab_subscription!
existing_subscription = group1.create_gitlab_subscription!
put api("/namespaces/#{group1.id}", admin), params: {
gitlab_subscription_attributes: gitlab_subscription
}
expect(group1.reload.gitlab_subscription.reload.seats).to eq 20
expect(group1.gitlab_subscription).to eq existing_subscription
end
context 'when params are invalid' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment