summaryrefslogtreecommitdiff
path: root/spec/gitlab_projects_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/gitlab_projects_spec.rb')
-rw-r--r--spec/gitlab_projects_spec.rb20
1 files changed, 12 insertions, 8 deletions
diff --git a/spec/gitlab_projects_spec.rb b/spec/gitlab_projects_spec.rb
index 4341ca5..306597e 100644
--- a/spec/gitlab_projects_spec.rb
+++ b/spec/gitlab_projects_spec.rb
@@ -31,8 +31,8 @@ describe GitlabProjects do
it "should create a branch" do
gl_projects_create.exec
gl_projects.exec
- branch_ref = `cd #{tmp_repo_path} && git rev-parse test_branch`.strip
- master_ref = `cd #{tmp_repo_path} && git rev-parse master`.strip
+ branch_ref = capture_in_tmp_repo(%W(git rev-parse test_branch))
+ master_ref = capture_in_tmp_repo(%W(git rev-parse master))
branch_ref.should == master_ref
end
end
@@ -49,9 +49,9 @@ describe GitlabProjects do
it "should remove a branch" do
gl_projects_create.exec
gl_projects_create_branch.exec
- branch_ref = `cd #{tmp_repo_path} && git rev-parse test_branch`.strip
+ branch_ref = capture_in_tmp_repo(%W(git rev-parse test_branch))
gl_projects.exec
- branch_del = `cd #{tmp_repo_path} && git rev-parse test_branch`.strip
+ branch_del = capture_in_tmp_repo(%W(git rev-parse test_branch))
branch_del.should_not == branch_ref
end
end
@@ -65,8 +65,8 @@ describe GitlabProjects do
it "should create a tag" do
gl_projects_create.exec
gl_projects.exec
- tag_ref = `cd #{tmp_repo_path} && git rev-parse test_tag`.strip
- master_ref = `cd #{tmp_repo_path} && git rev-parse master`.strip
+ tag_ref = capture_in_tmp_repo(%W(git rev-parse test_tag))
+ master_ref = capture_in_tmp_repo(%W(git rev-parse master))
tag_ref.should == master_ref
end
end
@@ -83,9 +83,9 @@ describe GitlabProjects do
it "should remove a branch" do
gl_projects_create.exec
gl_projects_create_tag.exec
- branch_ref = `cd #{tmp_repo_path} && git rev-parse test_tag`.strip
+ branch_ref = capture_in_tmp_repo(%W(git rev-parse test_tag))
gl_projects.exec
- branch_del = `cd #{tmp_repo_path} && git rev-parse test_tag`.strip
+ branch_del = capture_in_tmp_repo(%W(git rev-parse test_tag))
branch_del.should_not == branch_ref
end
end
@@ -300,4 +300,8 @@ describe GitlabProjects do
def repo_name
'gitlab-ci.git'
end
+
+ def capture_in_tmp_repo(cmd)
+ IO.popen(cmd, chdir: tmp_repo_path).read.strip
+ end
end