diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2017-02-04 20:26:11 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2017-02-08 19:14:29 +0200 |
commit | 2989192d1aa8051aa09164cd097418bd3063d4ad (patch) | |
tree | e277adf2535ac10ed338481ef092731ef84b27e1 /spec/models/route_spec.rb | |
parent | bbb7fbcd02c9d9a8a6d6ca44d7ce668b80962c21 (diff) | |
download | gitlab-ce-dz-refactor-full-path.tar.gz |
Store group and project full name and full path in routes tabledz-refactor-full-path
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'spec/models/route_spec.rb')
-rw-r--r-- | spec/models/route_spec.rb | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/spec/models/route_spec.rb b/spec/models/route_spec.rb index dd2a5109abc..a276aa4b13a 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, path: 'gitlab') } + let!(:group) { create(:group, path: 'gitlab', name: 'gitlab') } let!(:route) { group.route } describe 'relationships' do @@ -15,17 +15,30 @@ describe Route, models: true do end describe '#rename_descendants' 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') } + let!(:nested_group) { create(:group, path: 'test', name: 'test', parent: group) } + let!(:deep_nested_group) { create(:group, path: 'foo', name: 'foo', parent: nested_group) } + let!(:similar_group) { create(:group, path: 'gitlab-org', name: 'gitlab-org') } - before { route.update_attributes(path: 'bar') } + context 'path update' do + 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 + 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 + + context 'name update' do + before { route.update_attributes(name: 'bar') } + + it "updates children routes with new path" do + expect(described_class.exists?(name: 'bar')).to be_truthy + expect(described_class.exists?(name: 'bar / test')).to be_truthy + expect(described_class.exists?(name: 'bar / test / foo')).to be_truthy + expect(described_class.exists?(name: 'gitlab-org')).to be_truthy + end end end end |