spec/git_spec.rb in trahald-0.0.4 vs spec/git_spec.rb in trahald-0.0.5

- old
+ new

@@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- require File.expand_path(File.dirname(__FILE__) + '/spec_helper') -describe "Trahald::Git" do +describe "Trahald::Git", :if => defined? Trahald::Git do before(:all) do @dir = File.expand_path(File.dirname(__FILE__) + '/repos_for_spec') @git = Trahald::Git.new(@dir) end @@ -11,35 +11,15 @@ FileTest.exist?(@dir).should be_false Trahald::Git.init_repo_if_needed @dir FileTest.exist?(@dir).should be_true end - it "should enable to add and commit some files." do - name1 = "sample" - body1 = "# title\n\n* hoge\n* huga\n* 123" - name2 = "サンプル" - body2 = "# タイトル\n\n* いち\n* に\n* さん" - name3 = "サンプル/初夢" - body3 = "# タイトル\n\n* 富士\n* 鷹\n* なすび" - @git.add!(name1, body1) - @git.add!(name2, body2) - @git.add!(name3, body3) - message = "コミット" - - @git.commit!(message).should be_true - @git.body(name1).should == body1 - @git.body(name2).should == body2 - @git.body(name3).should == body3 + it_behaves_like 'backend db' do + let(:db) { @git } end - it "should enable to output list." do - @git.list.should == ['sample', 'サンプル', 'サンプル/初夢'] - end - after(:all) do if FileTest.exist? @dir - Dir.glob(@dir + '/**/').each{|e| - puts e} FileUtils.rm_rf(Dir.glob(@dir + '/**/')) end end end