Add "empty_repo?" method to Repository role
Replaces two calls that this method simplifies
This commit is contained in:
parent
7e76610d0a
commit
a463353773
4 changed files with 32 additions and 6 deletions
22
spec/roles/repository_spec.rb
Normal file
22
spec/roles/repository_spec.rb
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue