summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorJames Lopez <james@gitlab.com>2017-05-03 10:12:32 +0000
committerRémy Coutable <remy@rymai.me>2017-05-03 10:12:32 +0000
commit2174e37845f6865c20ba94da5520c8d9e874998f (patch)
tree1a6eb510ae73492e00d6d3621a3138d869c9d8fe /spec/models
parentd811004d023cee1ae5cbcb5792faca34b30336a3 (diff)
downloadgitlab-ce-2174e37845f6865c20ba94da5520c8d9e874998f.tar.gz
Include missing project attributes to Import/Export
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/project_spec.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 49455303096..36ce3070a6e 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -1906,4 +1906,23 @@ describe Project, models: true do
expect(project.pipeline_status).to be_loaded
end
end
+
+ describe '#append_or_update_attribute' do
+ let(:project) { create(:project) }
+
+ it 'shows full error updating an invalid MR' do
+ error_message = 'Failed to replace merge_requests because one or more of the new records could not be saved.'\
+ ' Validate fork Source project is not a fork of the target project'
+
+ expect { project.append_or_update_attribute(:merge_requests, [create(:merge_request)]) }.
+ to raise_error(ActiveRecord::RecordNotSaved, error_message)
+ end
+
+ it 'updates the project succesfully' do
+ merge_request = create(:merge_request, target_project: project, source_project: project)
+
+ expect { project.append_or_update_attribute(:merge_requests, [merge_request]) }.
+ not_to raise_error
+ end
+ end
end