summaryrefslogtreecommitdiff
path: root/qa/qa/resource/project.rb
diff options
context:
space:
mode:
Diffstat (limited to 'qa/qa/resource/project.rb')
-rw-r--r--qa/qa/resource/project.rb69
1 files changed, 27 insertions, 42 deletions
diff --git a/qa/qa/resource/project.rb b/qa/qa/resource/project.rb
index d3c1e91f358..0750ea49224 100644
--- a/qa/qa/resource/project.rb
+++ b/qa/qa/resource/project.rb
@@ -107,32 +107,6 @@ module QA
super
end
- def has_file?(file_path)
- response = repository_tree
-
- raise ResourceNotFoundError, (response[:message]).to_s if response.is_a?(Hash) && response.has_key?(:message)
-
- response.any? { |file| file[:path] == file_path }
- end
-
- def has_branch?(branch)
- has_branches?(Array(branch))
- end
-
- def has_branches?(branches)
- branches.all? do |branch|
- response = get(request_url("#{api_repository_branches_path}/#{branch}"))
- response.code == HTTP_STATUS_OK
- end
- end
-
- def has_tags?(tags)
- tags.all? do |tag|
- response = get(request_url("#{api_repository_tags_path}/#{tag}"))
- response.code == HTTP_STATUS_OK
- end
- end
-
def api_get_path
"/projects/#{CGI.escape(path_with_namespace)}"
end
@@ -237,6 +211,32 @@ module QA
post_body
end
+ def has_file?(file_path)
+ response = repository_tree
+
+ raise ResourceNotFoundError, (response[:message]).to_s if response.is_a?(Hash) && response.has_key?(:message)
+
+ response.any? { |file| file[:path] == file_path }
+ end
+
+ def has_branch?(branch)
+ has_branches?(Array(branch))
+ end
+
+ def has_branches?(branches)
+ branches.all? do |branch|
+ response = get(request_url("#{api_repository_branches_path}/#{branch}"))
+ response.code == HTTP_STATUS_OK
+ end
+ end
+
+ def has_tags?(tags)
+ tags.all? do |tag|
+ response = get(request_url("#{api_repository_tags_path}/#{tag}"))
+ response.code == HTTP_STATUS_OK
+ end
+ end
+
def change_repository_storage(new_storage)
response = put(request_url(api_put_path), repository_storage: new_storage)
@@ -372,27 +372,12 @@ module QA
api_post_to(api_wikis_path, title: title, content: content)
end
- # Object comparison
- #
- # @param [QA::Resource::Project] other
- # @return [Boolean]
- def ==(other)
- other.is_a?(Project) && comparable_project == other.comparable_project
- end
-
- # Override inspect for a better rspec failure diff output
- #
- # @return [String]
- def inspect
- JSON.pretty_generate(comparable_project)
- end
-
protected
# Return subset of fields for comparing projects
#
# @return [Hash]
- def comparable_project
+ def comparable
reload! if api_response.nil?
api_resource.slice(