diff --git a/.gitignore b/.gitignore index 82e4ad2..2fe7912 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.gem support/gitlabhq* +tmp/* diff --git a/Gemfile.lock b/Gemfile.lock index e4932f2..f5f28e6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GIT PATH remote: . specs: - gitlab_git (1.0.3) + gitlab_git (1.0.5) activesupport (~> 3.2.13) github-linguist (~> 2.3.4) grit (~> 2.5.0) diff --git a/Guardfile b/Guardfile new file mode 100644 index 0000000..f547850 --- /dev/null +++ b/Guardfile @@ -0,0 +1,24 @@ +# A sample Guardfile +# More info at https://github.com/guard/guard#readme + +guard 'rspec' do + watch(%r{^spec/.+_spec\.rb$}) + watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } + watch('spec/spec_helper.rb') { "spec" } + + # Rails example + watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } + watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" } + watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] } + watch(%r{^spec/support/(.+)\.rb$}) { "spec" } + watch('config/routes.rb') { "spec/routing" } + watch('app/controllers/application_controller.rb') { "spec/controllers" } + + # Capybara features specs + watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/features/#{m[1]}_spec.rb" } + + # Turnip features and steps + watch(%r{^spec/acceptance/(.+)\.feature$}) + watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' } +end + diff --git a/lib/gitlab_git/popen.rb b/lib/gitlab_git/popen.rb index b26ac81..a1cd1f1 100644 --- a/lib/gitlab_git/popen.rb +++ b/lib/gitlab_git/popen.rb @@ -1,3 +1,5 @@ +require 'open3' + module Gitlab module Git module Popen diff --git a/spec/repository_spec.rb b/spec/repository_spec.rb index 2b0550a..20f44c9 100644 --- a/spec/repository_spec.rb +++ b/spec/repository_spec.rb @@ -93,7 +93,7 @@ it { should_not include("bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a") } end - describe "commits_between" do + describe :commits_between do subject do commits = repository.commits_between("3a4b4fb4cde7809f033822a171b9feae19d41fff", "8470d70da67355c9c009e4401746b1d5410af2e3") @@ -105,7 +105,7 @@ it { should_not include("bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a") } end - describe "branch names" do + describe :branch_names do subject { repository.branch_names } it { should have(32).elements } @@ -113,11 +113,41 @@ it { should_not include("branch-from-space") } end - describe "tag names" do + describe :tag_names do subject { repository.tag_names } it { should have(16).elements } it { should include("v1.2.0") } it { should_not include("v5.0.0") } end + + describe :archive do + let(:archive) { repository.archive_repo('master', repository.repos_path) } + after { FileUtils.rm_r(archive) } + + it { archive.should match(/support\/gitlabhq\/gitlabhq-bcf03b5/) } + it { File.exists?(archive).should be_true } + end + + describe :size do + subject { repository.size } + + it { should == 43.19 } + end + + describe :diffs_between do + let(:diffs) { repository.diffs_between('master', 'stable') } + subject { diffs } + + it { should be_kind_of Array } + its(:size) { should eq(73) } + + context :diff do + subject { diffs.first } + + it { should be_kind_of Gitlab::Git::Diff } + its(:new_path) { should == '.gitignore' } + its(:diff) { should include 'Vagrantfile' } + end + end end