Permalink
Browse files

init tests passing

  • Loading branch information...
1 parent d8d2b32 commit baec2fe80681c4fcb5b26aea1021b61d851dbc6f @schacon schacon committed Feb 21, 2011
Showing with 23 additions and 0 deletions.
  1. +2 −0 lib/git-scribe/init.rb
  2. +21 −0 test/init_test.rb
@@ -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
View
@@ -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.