Skip to content
This repository has been archived by the owner on May 12, 2018. It is now read-only.

Commit

Permalink
Guardfile and more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dzaporozhets committed Apr 30, 2013
1 parent b7f8960 commit 05ffad7
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.gem
support/gitlabhq*
tmp/*
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
24 changes: 24 additions & 0 deletions Guardfile
Original file line number Diff line number Diff line change
@@ -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

2 changes: 2 additions & 0 deletions lib/gitlab_git/popen.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'open3'

module Gitlab
module Git
module Popen
Expand Down
36 changes: 33 additions & 3 deletions spec/repository_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -105,19 +105,49 @@
it { should_not include("bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a") }
end

describe "branch names" do
describe :branch_names do
subject { repository.branch_names }

it { should have(32).elements }
it { should include("master") }
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

0 comments on commit 05ffad7

Please sign in to comment.