Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-01-04 23:45:30 +0400
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-01-04 23:45:30 +0400
commitef5b36eaaf92db19ae90cc599c3f64b865bdc4d5 (patch)
tree4dd03fbf865b82a93cdec1f5d9d44c6b1d211d02 /spec
parentafbdbb0c959affbdb8725eafb8169025a8aede1e (diff)
Fixed protected branches and file edit
Diffstat (limited to 'spec')
-rw-r--r--spec/models/commit_spec.rb2
-rw-r--r--spec/support/stubbed_repository.rb13
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