Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
projects.thm.de
GitLab
Commits
26f37310
Commit
26f37310
authored
Jun 28, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ProjectWiki#ensure_repository
parent
2a64607b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
+22
-0
app/models/project_wiki.rb
app/models/project_wiki.rb
+4
-0
spec/models/project_wiki_spec.rb
spec/models/project_wiki_spec.rb
+18
-0
No files found.
app/models/project_wiki.rb
View file @
26f37310
...
...
@@ -149,6 +149,10 @@ def create_repo!
wiki
end
def
ensure_repository
create_repo!
unless
repository_exists?
end
def
hook_attrs
{
web_url:
web_url
,
...
...
spec/models/project_wiki_spec.rb
View file @
26f37310
...
...
@@ -278,6 +278,24 @@
end
end
describe
'#ensure_repository'
do
it
'creates the repository if it not exist'
do
allow
(
subject
).
to
receive
(
:repository_exists?
).
and_return
(
false
)
expect
(
subject
).
to
receive
(
:create_repo!
)
subject
.
ensure_repository
end
it
'does not create the repository if it exists'
do
allow
(
subject
).
to
receive
(
:repository_exists?
).
and_return
(
true
)
expect
(
subject
).
not_to
receive
(
:create_repo!
)
subject
.
ensure_repository
end
end
describe
'#hook_attrs'
do
it
'returns a hash with values'
do
expect
(
subject
.
hook_attrs
).
to
be_a
Hash
...
...
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