diff options
author | Robert Speicher <rspeicher@gmail.com> | 2012-09-04 11:37:38 -0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2012-09-04 12:05:21 -0400 |
commit | a4633537737d1ea85c74b2089fa1c82e407c0cfa (patch) | |
tree | 610dc24638303ec1e6c33b81e7981f8dca24ee80 /spec/roles | |
parent | 7e76610d0a521af73459ffc2ba7b3956ab9da34c (diff) | |
download | gitlab-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.rb | 22 |
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 |