summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorFelipe Artur <felipefac@gmail.com>2017-11-27 17:19:17 -0200
committerFelipe Artur <felipefac@gmail.com>2017-12-07 11:30:32 -0200
commit77c9632e9cbc9d424934852faf61d8dea322b6d0 (patch)
tree8455233c996ac89d653a454e49ffa9d22fbe4e26 /qa
parent9db9f68fe5b20cf0e21b6537482df4ed8ea31db7 (diff)
downloadgitlab-ce-77c9632e9cbc9d424934852faf61d8dea322b6d0.tar.gz
Turn push file into a scenario
Diffstat (limited to 'qa')
-rw-r--r--qa/qa.rb4
-rw-r--r--qa/qa/scenario/gitlab/repository/push.rb40
-rw-r--r--qa/qa/specs/features/repository/push_spec.rb19
3 files changed, 48 insertions, 15 deletions
diff --git a/qa/qa.rb b/qa/qa.rb
index 06b6a76489b..4cbcf585030 100644
--- a/qa/qa.rb
+++ b/qa/qa.rb
@@ -46,6 +46,10 @@ module QA
autoload :Create, 'qa/scenario/gitlab/project/create'
end
+ module Repository
+ autoload :Push, 'qa/scenario/gitlab/repository/push'
+ end
+
module Sandbox
autoload :Prepare, 'qa/scenario/gitlab/sandbox/prepare'
end
diff --git a/qa/qa/scenario/gitlab/repository/push.rb b/qa/qa/scenario/gitlab/repository/push.rb
new file mode 100644
index 00000000000..bc5b6307d13
--- /dev/null
+++ b/qa/qa/scenario/gitlab/repository/push.rb
@@ -0,0 +1,40 @@
+require "pry-byebug"
+
+module QA
+ module Scenario
+ module Gitlab
+ module Repository
+ class Push < Scenario::Template
+ attr_writer :file_name,
+ :file_content,
+ :commit_message,
+ :branch_name
+
+ def initialize
+ @file_name = 'file.txt'
+ @file_content = '# This is test project'
+ @commit_message = "Add #{@file_name}"
+ @branch_name = 'master'
+ end
+
+ def perform
+ Git::Repository.perform do |repository|
+ repository.location = Page::Project::Show.act do
+ choose_repository_clone_http
+ repository_location
+ end
+
+ repository.use_default_credentials
+ repository.clone
+ repository.configure_identity('GitLab QA', 'root@gitlab.com')
+
+ repository.add_file(@file_name, @file_content)
+ repository.commit(@commit_message)
+ repository.push_changes(@branch_name)
+ end
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/specs/features/repository/push_spec.rb b/qa/qa/specs/features/repository/push_spec.rb
index 30935dc1e13..5b930b9818a 100644
--- a/qa/qa/specs/features/repository/push_spec.rb
+++ b/qa/qa/specs/features/repository/push_spec.rb
@@ -10,21 +10,10 @@ module QA
scenario.description = 'project with repository'
end
- Git::Repository.perform do |repository|
- repository.location = Page::Project::Show.act do
- choose_repository_clone_http
- repository_location
- end
-
- repository.use_default_credentials
-
- repository.act do
- clone
- configure_identity('GitLab QA', 'root@gitlab.com')
- add_file('README.md', '# This is test project')
- commit('Add README.md')
- push_changes
- end
+ Scenario::Gitlab::Repository::Push.perform do |scenario|
+ scenario.file_name = 'README.md'
+ scenario.file_content = '# This is test project'
+ scenario.commit_message = 'Add README.md'
end
Page::Project::Show.act do