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
Boxiang Sun
gitlab-ce
Commits
dd79dba8
Commit
dd79dba8
authored
12 years ago
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #809 from robbkidd/spec_protected_branch
Add spec for ProtectedBranch.
parents
e81ba7b2
d5044608
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
1 deletion
+47
-1
spec/models/protected_branch_spec.rb
spec/models/protected_branch_spec.rb
+47
-1
No files found.
spec/models/protected_branch_spec.rb
View file @
dd79dba8
...
@@ -12,5 +12,51 @@
...
@@ -12,5 +12,51 @@
require
'spec_helper'
require
'spec_helper'
describe
ProtectedBranch
do
describe
ProtectedBranch
do
pending
"add some examples to (or delete)
#{
__FILE__
}
"
let
(
:project
)
{
Factory
(
:project
)
}
describe
'Associations'
do
it
{
should
belong_to
(
:project
)
}
end
describe
'Validation'
do
it
{
should
validate_presence_of
(
:project_id
)
}
it
{
should
validate_presence_of
(
:name
)
}
end
describe
'Callbacks'
do
subject
{
ProtectedBranch
.
new
(
:project
=>
project
,
:name
=>
'branch_name'
)
}
it
'call update_repository after save'
do
subject
.
should_receive
(
:update_repository
)
subject
.
save
end
it
'call update_repository after destroy'
do
subject
.
should_receive
(
:update_repository
)
subject
.
destroy
end
end
describe
'#update_repository'
do
let
(
:gitolite
)
{
mock
}
subject
{
ProtectedBranch
.
new
(
:project
=>
project
)
}
it
"updates the branch's project repo permissions"
do
Gitlabhq
::
GitHost
.
should_receive
(
:system
).
and_return
(
gitolite
)
gitolite
.
should_receive
(
:update_project
).
with
(
project
.
path
,
project
)
subject
.
update_repository
end
end
describe
'#commit'
do
subject
{
ProtectedBranch
.
new
(
:project
=>
project
,
:name
=>
'cant_touch_this'
)
}
it
'commits itself to its project'
do
project
.
should_receive
(
:commit
).
with
(
'cant_touch_this'
)
subject
.
commit
end
end
end
end
This diff is collapsed.
Click to expand it.
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