Skip to content

Commit

Permalink
Preventing tests teardown warnings
Browse files Browse the repository at this point in the history
Improving `Git::Status#pretty`
  • Loading branch information
robertodecurnex committed Jan 15, 2014
1 parent 5d5d7d4 commit 8ed8ba4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
19 changes: 12 additions & 7 deletions lib/git/status.rb
Expand Up @@ -27,17 +27,22 @@ def untracked
def pretty
out = ''
self.each do |file|
out << file.path
out << "\n\tsha(r) " + file.sha_repo.to_s + ' ' + file.mode_repo.to_s
out << "\n\tsha(i) " + file.sha_index.to_s + ' ' + file.mode_index.to_s
out << "\n\ttype " + file.type.to_s
out << "\n\tstage " + file.stage.to_s
out << "\n\tuntrac " + file.untracked.to_s
out << "\n"
out << pretty_file(file)
end
out << "\n"
out
end

def pretty_file(file)
<<FILE
#{file.path}
\tsha(r) #{file.sha_repo.to_s} #{file.mode_repo.to_s}
\tsha(i) #{file.sha_index.to_s} #{file.mode_index.to_s}
\ttype #{file.type.to_s}
\tstage #{file.stage.to_s}
\tuntrac #{file.untracked.to_s}
FILE
end

# enumerable method

Expand Down
3 changes: 2 additions & 1 deletion tests/test_helper.rb
Expand Up @@ -24,7 +24,8 @@ def set_file_paths
@wdir = create_temp_repo(@wdir_dot)
end

def teardown
teardown
def git_teardown
if @tmp_path
FileUtils.rm_r(@tmp_path)
end
Expand Down

0 comments on commit 8ed8ba4

Please sign in to comment.