Skip to content

Commit 4df9ace

Browse files
author
Simon Coffey
committed
wip
1 parent 4eaf514 commit 4df9ace

File tree

1 file changed

+25
-26
lines changed

1 file changed

+25
-26
lines changed

tests/units/test_branch.rb

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -57,46 +57,45 @@ def test_branch_commit
5757
end
5858

5959
def test_branch_create_and_switch
60-
Dir.chdir(@wdir) do
61-
assert(!@git.branch('new_branch').current)
62-
@git.branch('other_branch').create
63-
assert(!@git.branch('other_branch').current)
64-
@git.branch('new_branch').checkout
65-
assert(@git.branch('new_branch').current)
60+
in_bare_repo_clone do |git|
61+
assert(!git.branch('new_branch').current)
62+
git.branch('other_branch').create
63+
assert(!git.branch('other_branch').current)
64+
git.branch('new_branch').checkout
65+
assert(git.branch('new_branch').current)
6666

67-
assert_equal(1, @git.branches.select { |b| b.name == 'new_branch' }.size)
67+
assert_equal(1, git.branches.select { |b| b.name == 'new_branch' }.size)
6868

6969
new_file('test-file1', 'blahblahblah1')
7070
new_file('test-file2', 'blahblahblah2')
7171
new_file('.test-dot-file1', 'blahblahblahdot1')
72-
assert(@git.status.untracked.assoc('test-file1'))
73-
assert(@git.status.untracked.assoc('.test-dot-file1'))
72+
assert(git.status.untracked.assoc('test-file1'))
73+
assert(git.status.untracked.assoc('.test-dot-file1'))
7474

75-
@git.add(['test-file1', 'test-file2'])
76-
assert(!@git.status.untracked.assoc('test-file1'))
75+
git.add(['test-file1', 'test-file2'])
76+
assert(!git.status.untracked.assoc('test-file1'))
7777

78-
@git.reset
79-
assert(@git.status.untracked.assoc('test-file1'))
80-
assert(!@git.status.added.assoc('test-file1'))
78+
git.reset
79+
assert(git.status.untracked.assoc('test-file1'))
80+
assert(!git.status.added.assoc('test-file1'))
8181

8282
assert_raise Git::GitExecuteError do
83-
@git.branch('new_branch').delete
83+
git.branch('new_branch').delete
8484
end
85-
assert_equal(1, @git.branches.select { |b| b.name == 'new_branch' }.size)
85+
assert_equal(1, git.branches.select { |b| b.name == 'new_branch' }.size)
8686

87-
@git.branch('master').checkout
88-
@git.branch('new_branch').delete
89-
assert_equal(0, @git.branches.select { |b| b.name == 'new_branch' }.size)
87+
git.branch('master').checkout
88+
git.branch('new_branch').delete
89+
assert_equal(0, git.branches.select { |b| b.name == 'new_branch' }.size)
9090

91-
@git.checkout('other_branch')
92-
assert(@git.branch('other_branch').current)
91+
git.checkout('other_branch')
92+
assert(git.branch('other_branch').current)
9393

94-
@git.checkout('master')
95-
assert(!@git.branch('other_branch').current)
96-
97-
@git.checkout(@git.branch('other_branch'))
98-
assert(@git.branch('other_branch').current)
94+
git.checkout('master')
95+
assert(!git.branch('other_branch').current)
9996

97+
git.checkout(@git.branch('other_branch'))
98+
assert(git.branch('other_branch').current)
10099
end
101100
end
102101
end

0 commit comments

Comments
 (0)