diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-01-04 21:45:30 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-01-04 21:45:30 +0200 |
commit | ef5b36eaaf92db19ae90cc599c3f64b865bdc4d5 (patch) | |
tree | 4dd03fbf865b82a93cdec1f5d9d44c6b1d211d02 /spec | |
parent | afbdbb0c959affbdb8725eafb8169025a8aede1e (diff) | |
download | gitlab-ce-ef5b36eaaf92db19ae90cc599c3f64b865bdc4d5.tar.gz |
Fixed protected branches and file edit
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/commit_spec.rb | 2 | ||||
-rw-r--r-- | spec/support/stubbed_repository.rb | 13 |
2 files changed, 13 insertions, 2 deletions
diff --git a/spec/models/commit_spec.rb b/spec/models/commit_spec.rb index e760c501bd7..91301029e89 100644 --- a/spec/models/commit_spec.rb +++ b/spec/models/commit_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe Commit do - let(:commit) { create(:project).commit } + let(:commit) { create(:project).repository.commit } describe CommitDecorator do let(:decorator) { CommitDecorator.new(commit) } diff --git a/spec/support/stubbed_repository.rb b/spec/support/stubbed_repository.rb index 0e5628d05ff..e6e194d70f5 100644 --- a/spec/support/stubbed_repository.rb +++ b/spec/support/stubbed_repository.rb @@ -1,6 +1,17 @@ +require "repository" +require "project" + # Stubs out all Git repository access done by models so that specs can run # against fake repositories without Grit complaining that they don't exist. class Project + def repository + if path == "empty" || !path + nil + else + GitLabTestRepo.new(path_with_namespace) + end + end + def satellite FakeSatellite.new end @@ -16,7 +27,7 @@ class Project end end -class Repository +class GitLabTestRepo < Repository def repo @repo ||= Grit::Repo.new(Rails.root.join('tmp', 'repositories', 'gitlabhq')) end |