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
8ee0993f
Commit
8ee0993f
authored
Mar 28, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Event & Wiki models specs
parent
ef32e01b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
78 additions
and
2 deletions
+78
-2
app/models/wiki.rb
app/models/wiki.rb
+0
-1
spec/factories.rb
spec/factories.rb
+3
-1
spec/models/event_spec.rb
spec/models/event_spec.rb
+44
-0
spec/models/wiki_spec.rb
spec/models/wiki_spec.rb
+31
-0
No files found.
app/models/wiki.rb
View file @
8ee0993f
...
@@ -7,7 +7,6 @@ class Wiki < ActiveRecord::Base
...
@@ -7,7 +7,6 @@ class Wiki < ActiveRecord::Base
before_update
:set_slug
before_update
:set_slug
def
to_param
def
to_param
slug
slug
end
end
...
...
spec/factories.rb
View file @
8ee0993f
...
@@ -64,9 +64,11 @@ Factory.add(:web_hook, WebHook) do |obj|
...
@@ -64,9 +64,11 @@ Factory.add(:web_hook, WebHook) do |obj|
obj
.
url
=
Faker
::
Internet
.
url
obj
.
url
=
Faker
::
Internet
.
url
end
end
Factory
.
add
(
:wiki
s
,
WebHook
)
do
|
obj
|
Factory
.
add
(
:wiki
,
Wiki
)
do
|
obj
|
obj
.
title
=
Faker
::
Lorem
.
sentence
obj
.
title
=
Faker
::
Lorem
.
sentence
obj
.
content
=
Faker
::
Lorem
.
sentence
obj
.
content
=
Faker
::
Lorem
.
sentence
obj
.
user
=
Factory
(
:user
)
obj
.
project
=
Factory
(
:project
)
end
end
Factory
.
add
(
:event
,
Event
)
do
|
obj
|
Factory
.
add
(
:event
,
Event
)
do
|
obj
|
...
...
spec/models/event_spec.rb
View file @
8ee0993f
...
@@ -20,6 +20,14 @@ describe Event do
...
@@ -20,6 +20,14 @@ describe Event do
it
{
should
belong_to
(
:project
)
}
it
{
should
belong_to
(
:project
)
}
end
end
describe
"Respond to"
do
it
{
should
respond_to
(
:author_name
)
}
it
{
should
respond_to
(
:author_email
)
}
it
{
should
respond_to
(
:issue_title
)
}
it
{
should
respond_to
(
:merge_request_title
)
}
it
{
should
respond_to
(
:commits
)
}
end
describe
"Creation"
do
describe
"Creation"
do
before
do
before
do
@event
=
Factory
:event
@event
=
Factory
:event
...
@@ -29,4 +37,40 @@ describe Event do
...
@@ -29,4 +37,40 @@ describe Event do
@event
.
should
be_valid
@event
.
should
be_valid
end
end
end
end
describe
"Push event"
do
before
do
project
=
Factory
:project
@user
=
project
.
owner
data
=
{
:before
=>
"0000000000000000000000000000000000000000"
,
:after
=>
"0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e"
,
:ref
=>
"refs/heads/master"
,
:user_id
=>
@user
.
id
,
:user_name
=>
@user
.
name
,
:repository
=>
{
:name
=>
project
.
name
,
:url
=>
"localhost/rubinius"
,
:description
=>
""
,
:homepage
=>
"localhost/rubinius"
,
:private
=>
true
}
}
@event
=
Event
.
create
(
:project
=>
project
,
:action
=>
Event
::
Pushed
,
:data
=>
data
,
:author_id
=>
@user
.
id
)
end
it
{
@event
.
push?
.
should
be_true
}
it
{
@event
.
allowed?
.
should
be_true
}
it
{
@event
.
new_branch?
.
should
be_true
}
it
{
@event
.
new_tag?
.
should
be_false
}
it
{
@event
.
branch_name
.
should
==
"master"
}
it
{
@event
.
author
.
should
==
@user
}
end
end
end
spec/models/wiki_spec.rb
0 → 100644
View file @
8ee0993f
require
'spec_helper'
describe
Wiki
do
describe
"Associations"
do
it
{
should
belong_to
(
:project
)
}
it
{
should
belong_to
(
:user
)
}
end
describe
"Validation"
do
it
{
should
validate_presence_of
(
:title
)
}
it
{
should
validate_presence_of
(
:content
)
}
it
{
should
validate_presence_of
(
:user_id
)
}
end
it
{
Factory
(
:wiki
).
should
be_valid
}
end
# == Schema Information
#
# Table name: snippets
#
# id :integer not null, primary key
# title :string(255)
# content :text
# author_id :integer not null
# project_id :integer not null
# created_at :datetime
# updated_at :datetime
# file_name :string(255)
# expires_at :datetime
#
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