Commit e71fcd9e authored by Jacob Vosmaer's avatar Jacob Vosmaer

Use IO.popen instead of Kernel#` to read refs

parent 4e22874b
......@@ -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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment