Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2017-02-08 23:54:33 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2017-02-09 00:36:23 +0300
commit4d40c3c30a945d28487dfe08c0985ccb636ce3bc (patch)
treeabfd4455ccfc2bd022a6e39bdaaf63823c7fbc93 /spec/models/route_spec.rb
parentd01cd84e69999677b5cb0d4f03d140f33cfdc0f7 (diff)
Fix route rename descendants if route.name is blank
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'spec/models/route_spec.rb')
-rw-r--r--spec/models/route_spec.rb24
1 files changed, 18 insertions, 6 deletions
diff --git a/spec/models/route_spec.rb b/spec/models/route_spec.rb
index a276aa4b13a..0b222022e62 100644
--- a/spec/models/route_spec.rb
+++ b/spec/models/route_spec.rb
@@ -20,13 +20,25 @@ describe Route, models: true do
let!(:similar_group) { create(:group, path: 'gitlab-org', name: 'gitlab-org') }
context 'path update' do
- before { route.update_attributes(path: 'bar') }
+ context 'when route name is set' 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
+ end
+ end
- 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
+ context 'when route name is nil' do
+ before do
+ route.update_column(:name, nil)
+ end
+
+ it "does not fail" do
+ expect(route.update_attributes(path: 'bar')).to be_truthy
+ end
end
end