Add "empty_repo?" method to Repository role

Replaces two calls that this method simplifies
This commit is contained in:
Robert Speicher 2012-09-04 11:37:38 -04:00
parent 7e76610d0a
commit a463353773
4 changed files with 32 additions and 6 deletions

View file

@ -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