Commit 861a51488a44eac143ac4f44802fdf05fbd8f4c1
1 parent
443e23e6
Exists in
master
and in
4 other branches
Add specs for a couple more Repository methods used by discover_default_branch
Showing
1 changed file
with
24 additions
and
0 deletions
Show diff stats
spec/roles/repository_spec.rb
| @@ -45,4 +45,28 @@ describe Project, "Repository" do | @@ -45,4 +45,28 @@ describe Project, "Repository" do | ||
| 45 | project.discover_default_branch.should be_nil | 45 | project.discover_default_branch.should be_nil |
| 46 | end | 46 | end |
| 47 | end | 47 | end |
| 48 | + | ||
| 49 | + describe "#root_ref" do | ||
| 50 | + it "returns default_branch when set" do | ||
| 51 | + project.default_branch = 'stable' | ||
| 52 | + project.root_ref.should == 'stable' | ||
| 53 | + end | ||
| 54 | + | ||
| 55 | + it "returns 'master' when default_branch is nil" do | ||
| 56 | + project.default_branch = nil | ||
| 57 | + project.root_ref.should == 'master' | ||
| 58 | + end | ||
| 59 | + end | ||
| 60 | + | ||
| 61 | + describe "#root_ref?" do | ||
| 62 | + it "returns true when branch is root_ref" do | ||
| 63 | + project.default_branch = 'stable' | ||
| 64 | + project.root_ref?('stable').should be_true | ||
| 65 | + end | ||
| 66 | + | ||
| 67 | + it "returns false when branch is not root_ref" do | ||
| 68 | + project.default_branch = nil | ||
| 69 | + project.root_ref?('stable').should be_false | ||
| 70 | + end | ||
| 71 | + end | ||
| 48 | end | 72 | end |