summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-10-18 06:26:16 -0200
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-10-19 14:58:28 -0200
commitf0ad0ceff5236f3ee5babee47bfec217a54c3b07 (patch)
tree40640e4204f01b732827dd29769dd8977eeb3001
parent1a41a89cb383d286e21a125e8a643eb0fbb2442b (diff)
downloadgitlab-ce-f0ad0ceff5236f3ee5babee47bfec217a54c3b07.tar.gz
Fix GitHub importer spec
-rw-r--r--lib/gitlab/github_import/label_formatter.rb5
-rw-r--r--spec/lib/gitlab/github_import/importer_spec.rb2
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/gitlab/github_import/label_formatter.rb b/lib/gitlab/github_import/label_formatter.rb
index 3101116a614..8ed1574c4fc 100644
--- a/lib/gitlab/github_import/label_formatter.rb
+++ b/lib/gitlab/github_import/label_formatter.rb
@@ -16,8 +16,11 @@ module Gitlab
def create!
params = attributes.except(:project)
service = ::Labels::CreateService.new(project.owner, project, params)
+ label = service.execute
- service.execute
+ raise ActiveRecord::RecordInvalid.new(label) unless label.persisted?
+
+ label
end
private
diff --git a/spec/lib/gitlab/github_import/importer_spec.rb b/spec/lib/gitlab/github_import/importer_spec.rb
index 8854c8431b5..1af553f8f03 100644
--- a/spec/lib/gitlab/github_import/importer_spec.rb
+++ b/spec/lib/gitlab/github_import/importer_spec.rb
@@ -157,7 +157,7 @@ describe Gitlab::GithubImport::Importer, lib: true do
{ type: :pull_request, url: "https://api.github.com/repos/octocat/Hello-World/pulls/1347", errors: "Validation failed: Validate branches Cannot Create: This merge request already exists: [\"New feature\"]" },
{ type: :wiki, errors: "Gitlab::Shell::Error" },
{ type: :release, url: 'https://api.github.com/repos/octocat/Hello-World/releases/2', errors: "Validation failed: Description can't be blank" }
- ]
+ ]
}
described_class.new(project).execute