Skip to content

Commit

Permalink
init tests passing
Browse files Browse the repository at this point in the history
  • Loading branch information
schacon committed Feb 21, 2011
1 parent d8d2b32 commit baec2fe
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/git-scribe/init.rb
Expand Up @@ -8,7 +8,9 @@ def init(args = [])

info "inititalizing #{name}"
from_stdir = File.join(SCRIBE_ROOT, 'template')
ign = Dir.glob(from_stdir + '/.[a-z]*')
FileUtils.cp_r from_stdir, name
FileUtils.cp_r ign, name
end
end
end
21 changes: 21 additions & 0 deletions test/init_test.rb
Expand Up @@ -12,4 +12,25 @@
end
end
end

test "can't init a scribe repo for existing dir" do
in_temp_dir do
Dir.mkdir('t')
assert_raise RuntimeError do
@scribe.init('t')
end
end
end

test "can init a scribe repo" do
in_temp_dir do
@scribe.init('t')
files = Dir.glob('t/**/*', File::FNM_DOTMATCH)
assert files.include? "t/book/book.asc"
assert files.include? "t/LICENSE"
assert files.include? "t/README.asciidoc"
assert files.include? "t/.gitscribe"
assert files.include? "t/.gitignore"
end
end
end

0 comments on commit baec2fe

Please sign in to comment.