summaryrefslogtreecommitdiff
path: root/spec/models/namespace_spec.rb
diff options
context:
space:
mode:
authorAndreas Brandl <abrandl@gitlab.com>2019-05-02 15:54:21 +0000
committerAndreas Brandl <abrandl@gitlab.com>2019-05-02 15:54:21 +0000
commit37606e666736c9686054ee5155e3d2d21eb1a0c9 (patch)
tree9c81314df7c2e8d8b0390bf606ebc98a2cce1864 /spec/models/namespace_spec.rb
parent00a5b9b0fa9ed8086b7a6c3528281a5038327aa3 (diff)
parentfc22626f453f64409ad5b2967cdec541dbcc041d (diff)
downloadgitlab-ce-37606e666736c9686054ee5155e3d2d21eb1a0c9.tar.gz
Merge branch '9932-fix-deprecated-attribute_changed-ce' into 'master'
[CE] Remove deprecated usage of `attribute_changed?` See merge request gitlab-org/gitlab-ce!27577
Diffstat (limited to 'spec/models/namespace_spec.rb')
-rw-r--r--spec/models/namespace_spec.rb30
1 files changed, 18 insertions, 12 deletions
diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb
index 95a4b0f6d71..dd5edca5059 100644
--- a/spec/models/namespace_spec.rb
+++ b/spec/models/namespace_spec.rb
@@ -743,22 +743,25 @@ describe Namespace do
end
end
- describe '#full_path_was' do
+ describe '#full_path_before_last_save' do
context 'when the group has no parent' do
- it 'returns the path was' do
- group = create(:group, parent: nil)
- expect(group.full_path_was).to eq(group.path_was)
+ it 'returns the path before last save' do
+ group = create(:group)
+
+ group.update(parent: nil)
+
+ expect(group.full_path_before_last_save).to eq(group.path_before_last_save)
end
end
context 'when a parent is assigned to a group with no previous parent' do
- it 'returns the path was' do
+ it 'returns the path before last save' do
group = create(:group, parent: nil)
-
parent = create(:group)
- group.parent = parent
- expect(group.full_path_was).to eq("#{group.path_was}")
+ group.update(parent: parent)
+
+ expect(group.full_path_before_last_save).to eq("#{group.path_before_last_save}")
end
end
@@ -766,9 +769,10 @@ describe Namespace do
it 'returns the parent full path' do
parent = create(:group)
group = create(:group, parent: parent)
- group.parent = nil
- expect(group.full_path_was).to eq("#{parent.full_path}/#{group.path}")
+ group.update(parent: nil)
+
+ expect(group.full_path_before_last_save).to eq("#{parent.full_path}/#{group.path}")
end
end
@@ -777,8 +781,10 @@ describe Namespace do
parent = create(:group)
group = create(:group, parent: parent)
new_parent = create(:group)
- group.parent = new_parent
- expect(group.full_path_was).to eq("#{parent.full_path}/#{group.path}")
+
+ group.update(parent: new_parent)
+
+ expect(group.full_path_before_last_save).to eq("#{parent.full_path}/#{group.path}")
end
end
end