spec/tonic/tonic_spec.rb in tonic-0.0.4 vs spec/tonic/tonic_spec.rb in tonic-0.0.6
- old
+ new
@@ -1,52 +1,57 @@
require 'tonic'
-module Tonic
- module GhPages
- class << self
+describe Tonic do
+ context 'Tonic will' do
- private
+ context "create gh-pages and" do
- def gh_pages(template = nil)
- are_you_in_repo?
-
- if branch_exists?
- abort 'You shall no pass. First you should delete gh-pages branch'
+ before :all do
+ unless Dir.pwd =~ /spec\/dummy_git_repo/
+ command = <<EOF
+ cd spec/dummy_git_repo;\
+ git init;\
+ git add .;\
+ git commit -am 'init commit';\
+ rspec ../../
+EOF
+ exec command
end
+ end
- # This for run shell commands from needed directory
- # puts 'Do you really want to create gh-pages branch with tonic? [y/n]'
- # if gets.chomp =~ /y/i
- check_status
- create_branch
- remove_all_files
- create template
- commit_changes
- # end
+ it "copy there tonic-template" do
+ Tonic.activate []
+
+ Tonic::Shell.new('git branch').run.to_s.should =~ /\* gh-pages/
+
+ Dir.glob('*').should == %w(assets Gemfile Gemfile.lock Rakefile)
+
+ Tonic::Shell.new('git status -s').run.to_s.should == ""
end
- end
- end
-end
+ it "copy there middleman template" do
+ Tonic.activate ['middleman']
-describe Tonic do
- context 'Tonic will' do
+ Tonic::Shell.new('git branch').run.to_s.should =~ /\* gh-pages/
- it "do the right stuff with repo" do
- unless Dir.pwd =~ /spec\/dummy_git_repo/
- exec 'cd spec/dummy_git_repo; rspec ../../'
- else
- Tonic.activate []
- Dir.glob('*').size.should == 4
- c = Tonic::Shell.new('git status -s').run.to_s.should == ""
+ Dir.glob('*').should == %w(config.rb source)
+
+ Tonic::Shell.new('git status -s').run.to_s.should == ""
end
- end
- if Dir.pwd =~ /spec\/dummy_git_repo/
+ after :each do
+ if Dir.pwd =~ /spec\/dummy_git_repo/
+ `git checkout master; git branch -D gh-pages`
+ end
+ end
+
after :all do
- `git checkout master; git branch -D gh-pages`
- exec 'cd ../..'
+ if Dir.pwd =~ /spec\/dummy_git_repo/
+ `rm -rf .git`
+ exec 'cd ../..'
+ end
end
+
end
end
end