summaryrefslogtreecommitdiff
path: root/spec/roles
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2012-09-04 11:37:38 -0400
committerRobert Speicher <rspeicher@gmail.com>2012-09-04 12:05:21 -0400
commita4633537737d1ea85c74b2089fa1c82e407c0cfa (patch)
tree610dc24638303ec1e6c33b81e7981f8dca24ee80 /spec/roles
parent7e76610d0a521af73459ffc2ba7b3956ab9da34c (diff)
downloadgitlab-ce-a4633537737d1ea85c74b2089fa1c82e407c0cfa.tar.gz
Add "empty_repo?" method to Repository role
Replaces two calls that this method simplifies
Diffstat (limited to 'spec/roles')
-rw-r--r--spec/roles/repository_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/roles/repository_spec.rb b/spec/roles/repository_spec.rb
new file mode 100644
index 00000000000..62aecc1341f
--- /dev/null
+++ b/spec/roles/repository_spec.rb
@@ -0,0 +1,22 @@
+require 'spec_helper'
+
+describe Project, "Repository" do
+ let(:project) { build(:project) }
+
+ describe "#empty_repo?" do
+ it "should return true if the repo doesn't exist" do
+ project.stub(repo_exists?: false, has_commits?: true)
+ project.should be_empty_repo
+ end
+
+ it "should return true if the repo has commits" do
+ project.stub(repo_exists?: true, has_commits?: false)
+ project.should be_empty_repo
+ end
+
+ it "should return false if the repo exists and has commits" do
+ project.stub(repo_exists?: true, has_commits?: true)
+ project.should_not be_empty_repo
+ end
+ end
+end