Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
gitlab-ce
Commits
36738897
Commit
36738897
authored
Sep 04, 2012
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for Project#discover_default_branch
parent
42032956
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
spec/roles/repository_spec.rb
spec/roles/repository_spec.rb
+26
-0
No files found.
spec/roles/repository_spec.rb
View file @
36738897
...
@@ -19,4 +19,30 @@ describe Project, "Repository" do
...
@@ -19,4 +19,30 @@ describe Project, "Repository" do
project
.
should_not
be_empty_repo
project
.
should_not
be_empty_repo
end
end
end
end
describe
"#discover_default_branch"
do
let
(
:master
)
{
double
(
name:
'master'
)
}
let
(
:stable
)
{
double
(
name:
'stable'
)
}
it
"returns 'master' when master exists"
do
project
.
should_receive
(
:heads
).
and_return
([
stable
,
master
])
project
.
discover_default_branch
.
should
==
'master'
end
it
"returns non-master when master exists but default branch is set to something else"
do
project
.
default_branch
=
'stable'
project
.
should_receive
(
:heads
).
and_return
([
stable
,
master
])
project
.
discover_default_branch
.
should
==
'stable'
end
it
"returns a non-master branch when only one exists"
do
project
.
should_receive
(
:heads
).
and_return
([
stable
])
project
.
discover_default_branch
.
should
==
'stable'
end
it
"returns nil when no branch exists"
do
project
.
should_receive
(
:heads
).
and_return
([])
project
.
discover_default_branch
.
should
be_nil
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment