diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-12-19 22:55:28 +0000 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-12-19 22:55:28 +0000 |
commit | f8262e8533866306bb0ddce71546b159341fd5bc (patch) | |
tree | ea90493397fde6c9c5042fd9a44cfd53ee0adf40 /spec/models | |
parent | ea8806d144ba02668ab53353bca73fd2ecd5e2c6 (diff) | |
parent | 95e0fac59ae8174d11873e95a3ef579af476f215 (diff) | |
download | gitlab-ce-f8262e8533866306bb0ddce71546b159341fd5bc.tar.gz |
Merge branch 'dz-fix-route-rename' into 'master'
Fix Route#rename_children behavior
## What does this MR do?
Fix Route#rename_children behavior.
Given group `gitlab` and `gitlab-org` exists. When rename `gitlab` it
will rename `gitlab-org` group route too. This MR fixes it
## What are the relevant issue numbers?
https://gitlab.com/gitlab-org/gitlab-ce/issues/2772
See merge request !8182
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/route_spec.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/spec/models/route_spec.rb b/spec/models/route_spec.rb index 6f491fdf9a0..8481a9bef16 100644 --- a/spec/models/route_spec.rb +++ b/spec/models/route_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe Route, models: true do - let!(:group) { create(:group) } + let!(:group) { create(:group, path: 'gitlab') } let!(:route) { group.route } describe 'relationships' do @@ -17,13 +17,15 @@ describe Route, models: true do describe '#rename_children' do let!(:nested_group) { create(:group, path: "test", parent: group) } let!(:deep_nested_group) { create(:group, path: "foo", parent: nested_group) } + let!(:similar_group) { create(:group, path: 'gitlab-org') } - it "updates children routes with new path" do - route.update_attributes(path: 'bar') + before { route.update_attributes(path: 'bar') } + it "updates children routes with new path" do expect(described_class.exists?(path: 'bar')).to be_truthy expect(described_class.exists?(path: 'bar/test')).to be_truthy expect(described_class.exists?(path: 'bar/test/foo')).to be_truthy + expect(described_class.exists?(path: 'gitlab-org')).to be_truthy end end end |