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
Tatuya Kamada
gitlab-ce
Commits
d98b1833
Commit
d98b1833
authored
Apr 09, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first pack of tests for milestones
parent
23d95085
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
145 additions
and
48 deletions
+145
-48
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+0
-38
app/helpers/tab_helper.rb
app/helpers/tab_helper.rb
+43
-0
app/views/layouts/_project_menu.html.haml
app/views/layouts/_project_menu.html.haml
+2
-2
db/schema.rb
db/schema.rb
+6
-6
spec/factories.rb
spec/factories.rb
+5
-0
spec/models/issue_spec.rb
spec/models/issue_spec.rb
+2
-1
spec/models/milestone_spec.rb
spec/models/milestone_spec.rb
+36
-1
spec/requests/milestones_spec.rb
spec/requests/milestones_spec.rb
+51
-0
No files found.
app/helpers/projects_helper.rb
View file @
d98b1833
...
@@ -16,45 +16,7 @@ module ProjectsHelper
...
@@ -16,45 +16,7 @@ module ProjectsHelper
nil
nil
end
end
def
project_tab_class
[
:show
,
:files
,
:team
,
:edit
,
:update
].
each
do
|
action
|
return
"current"
if
current_page?
(
:controller
=>
"projects"
,
:action
=>
action
,
:id
=>
@project
)
end
if
controller
.
controller_name
==
"snippets"
||
controller
.
controller_name
==
"hooks"
||
controller
.
controller_name
==
"deploy_keys"
||
controller
.
controller_name
==
"team_members"
"current"
end
end
def
tree_tab_class
controller
.
controller_name
==
"refs"
?
"current"
:
nil
end
def
repository_tab_class
def
repository_tab_class
#if controller.controller_name == "repositories" ||
#controller.controller_name == "hooks" ||
#controller.controller_name == "deploy_keys"
#"current"
#end
end
def
commit_tab_class
if
controller
.
controller_name
==
"commits"
||
controller
.
controller_name
==
"repositories"
||
controller
.
controller_name
==
"protected_branches"
"current"
end
end
end
def
branches_tab_class
if
current_page?
(
branches_project_repository_path
(
@project
))
||
controller
.
controller_name
==
"protected_branches"
||
current_page?
(
project_repository_path
(
@project
))
'active'
end
end
end
end
app/helpers/tab_helper.rb
0 → 100644
View file @
d98b1833
module
TabHelper
def
issues_tab?
controller
.
controller_name
==
"issues"
||
controller
.
controller_name
==
"milestones"
end
def
wall_tab?
current_page?
(
:controller
=>
"projects"
,
:action
=>
"wall"
,
:id
=>
@project
)
end
def
project_tab_class
[
:show
,
:files
,
:team
,
:edit
,
:update
].
each
do
|
action
|
return
"current"
if
current_page?
(
:controller
=>
"projects"
,
:action
=>
action
,
:id
=>
@project
)
end
if
controller
.
controller_name
==
"snippets"
||
controller
.
controller_name
==
"hooks"
||
controller
.
controller_name
==
"deploy_keys"
||
controller
.
controller_name
==
"team_members"
"current"
end
end
def
tree_tab_class
controller
.
controller_name
==
"refs"
?
"current"
:
nil
end
def
commit_tab_class
if
controller
.
controller_name
==
"commits"
||
controller
.
controller_name
==
"repositories"
||
controller
.
controller_name
==
"protected_branches"
"current"
end
end
def
branches_tab_class
if
current_page?
(
branches_project_repository_path
(
@project
))
||
controller
.
controller_name
==
"protected_branches"
||
current_page?
(
project_repository_path
(
@project
))
'active'
end
end
end
app/views/layouts/_project_menu.html.haml
View file @
d98b1833
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
=
link_to
"Network"
,
graph_project_path
(
@project
),
:class
=>
current_page?
(
:controller
=>
"projects"
,
:action
=>
"graph"
,
:id
=>
@project
)
?
"current"
:
nil
=
link_to
"Network"
,
graph_project_path
(
@project
),
:class
=>
current_page?
(
:controller
=>
"projects"
,
:action
=>
"graph"
,
:id
=>
@project
)
?
"current"
:
nil
-
if
@project
.
issues_enabled
-
if
@project
.
issues_enabled
=
link_to
project_issues_filter_path
(
@project
),
:class
=>
(
controller
.
controller_name
==
"issues"
)
?
"current"
:
nil
do
=
link_to
project_issues_filter_path
(
@project
),
:class
=>
issues_tab?
?
"current"
:
nil
do
Issues
Issues
%span
.count
=
@project
.
issues
.
opened
.
count
%span
.count
=
@project
.
issues
.
opened
.
count
-
if
@project
.
merge_requests_enabled
-
if
@project
.
merge_requests_enabled
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
%span
.count
=
@project
.
merge_requests
.
opened
.
count
%span
.count
=
@project
.
merge_requests
.
opened
.
count
-
if
@project
.
wall_enabled
-
if
@project
.
wall_enabled
=
link_to
wall_project_path
(
@project
),
:class
=>
current_page?
(
:controller
=>
"projects"
,
:action
=>
"wall"
,
:id
=>
@project
)
?
"current"
:
nil
do
=
link_to
wall_project_path
(
@project
),
:class
=>
wall_tab?
?
"current"
:
nil
do
Wall
Wall
-
if
@project
.
wiki_enabled
-
if
@project
.
wiki_enabled
...
...
db/schema.rb
View file @
d98b1833
...
@@ -65,16 +65,16 @@ ActiveRecord::Schema.define(:version => 20120408181910) do
...
@@ -65,16 +65,16 @@ ActiveRecord::Schema.define(:version => 20120408181910) do
t
.
text
"st_commits"
,
:limit
=>
2147483647
t
.
text
"st_commits"
,
:limit
=>
2147483647
t
.
text
"st_diffs"
,
:limit
=>
2147483647
t
.
text
"st_diffs"
,
:limit
=>
2147483647
t
.
boolean
"merged"
,
:default
=>
false
,
:null
=>
false
t
.
boolean
"merged"
,
:default
=>
false
,
:null
=>
false
t
.
boolean
"auto_merge"
,
:default
=>
true
,
:null
=>
false
end
end
add_index
"merge_requests"
,
[
"project_id"
],
:name
=>
"index_merge_requests_on_project_id"
add_index
"merge_requests"
,
[
"project_id"
],
:name
=>
"index_merge_requests_on_project_id"
create_table
"milestones"
,
:force
=>
true
do
|
t
|
create_table
"milestones"
,
:force
=>
true
do
|
t
|
t
.
string
"title"
,
:null
=>
false
t
.
string
"title"
,
:null
=>
false
t
.
text
"description"
t
.
date
"due_date"
,
:null
=>
false
t
.
integer
"project_id"
,
:null
=>
false
t
.
integer
"project_id"
,
:null
=>
false
t
.
text
"description"
t
.
date
"due_date"
t
.
boolean
"closed"
,
:default
=>
false
,
:null
=>
false
t
.
datetime
"created_at"
,
:null
=>
false
t
.
datetime
"created_at"
,
:null
=>
false
t
.
datetime
"updated_at"
,
:null
=>
false
t
.
datetime
"updated_at"
,
:null
=>
false
end
end
...
...
spec/factories.rb
View file @
d98b1833
...
@@ -75,3 +75,8 @@ Factory.add(:event, Event) do |obj|
...
@@ -75,3 +75,8 @@ Factory.add(:event, Event) do |obj|
obj
.
title
=
Faker
::
Lorem
.
sentence
obj
.
title
=
Faker
::
Lorem
.
sentence
obj
.
project
=
Factory
(
:project
)
obj
.
project
=
Factory
(
:project
)
end
end
Factory
.
add
(
:milestone
,
Milestone
)
do
|
obj
|
obj
.
title
=
Faker
::
Lorem
.
sentence
obj
.
due_date
=
Date
.
today
+
1
.
month
end
spec/models/issue_spec.rb
View file @
d98b1833
...
@@ -5,6 +5,7 @@ describe Issue do
...
@@ -5,6 +5,7 @@ describe Issue do
it
{
should
belong_to
(
:project
)
}
it
{
should
belong_to
(
:project
)
}
it
{
should
belong_to
(
:author
)
}
it
{
should
belong_to
(
:author
)
}
it
{
should
belong_to
(
:assignee
)
}
it
{
should
belong_to
(
:assignee
)
}
it
{
should
belong_to
(
:milestone
)
}
end
end
describe
"Validation"
do
describe
"Validation"
do
...
@@ -22,7 +23,7 @@ describe Issue do
...
@@ -22,7 +23,7 @@ describe Issue do
it
{
Factory
.
create
(
:issue
,
it
{
Factory
.
create
(
:issue
,
:author
=>
Factory
(
:user
),
:author
=>
Factory
(
:user
),
:assignee
=>
Factory
(
:user
),
:assignee
=>
Factory
(
:user
),
:proje
c
t
=>
Factory
.
create
(
:project
)).
should
be_valid
}
:projet
=>
Factory
.
create
(
:project
)).
should
be_valid
}
describe
"plus 1"
do
describe
"plus 1"
do
let
(
:project
)
{
Factory
(
:project
)
}
let
(
:project
)
{
Factory
(
:project
)
}
...
...
spec/models/milestone_spec.rb
View file @
d98b1833
require
'spec_helper'
require
'spec_helper'
describe
Milestone
do
describe
Milestone
do
pending
"add some examples to (or delete)
#{
__FILE__
}
"
describe
"Associations"
do
it
{
should
belong_to
(
:project
)
}
it
{
should
have_many
(
:issues
)
}
end
describe
"Validation"
do
it
{
should
validate_presence_of
(
:title
)
}
it
{
should
validate_presence_of
(
:project_id
)
}
end
let
(
:project
)
{
Factory
:project
}
let
(
:milestone
)
{
Factory
:milestone
,
:project
=>
project
}
let
(
:issue
)
{
Factory
:issue
,
:project
=>
project
}
it
{
milestone
.
should
be_valid
}
describe
"Issues"
do
before
do
milestone
.
issues
<<
issue
end
it
{
milestone
.
percent_complete
.
should
==
0
}
it
do
issue
.
update_attributes
:closed
=>
true
milestone
.
percent_complete
.
should
==
100
end
end
describe
:expires_at
do
before
do
milestone
.
update_attributes
:due_date
=>
Date
.
today
+
1
.
day
end
it
{
milestone
.
expires_at
.
should_not
be_nil
}
end
end
end
spec/requests/milestones_spec.rb
0 → 100644
View file @
d98b1833
require
'spec_helper'
describe
"Milestones"
do
let
(
:project
)
{
Factory
:project
}
before
do
login_as
:user
project
.
add_access
(
@user
,
:admin
)
@milestone
=
Factory
:milestone
,
:project
=>
project
@issue
=
Factory
:issue
,
:project
=>
project
@milestone
.
issues
<<
@issue
end
describe
"GET /milestones"
do
before
do
visit
project_milestones_path
(
project
)
end
subject
{
page
}
it
{
should
have_content
(
@milestone
.
title
[
0
..
10
])
}
it
{
should
have_content
(
@milestone
.
expires_at
)
}
it
{
should
have_content
(
"Browse Issues"
)
}
end
describe
"GET /milestone/:id"
do
before
do
visit
project_milestone_path
(
project
,
@milestone
)
end
subject
{
page
}
it
{
should
have_content
(
@milestone
.
title
[
0
..
10
])
}
it
{
should
have_content
(
@milestone
.
expires_at
)
}
it
{
should
have_content
(
"Browse Issues"
)
}
end
describe
"GET /milestones/new"
do
before
do
visit
new_project_milestone_path
(
project
)
fill_in
"milestone_title"
,
:with
=>
"v2.3"
click_button
"Create milestone"
end
it
{
current_path
.
should
==
project_milestone_path
(
project
,
project
.
milestones
.
last
)
}
it
{
should
have_content
(
@milestone
.
title
[
0
..
10
])
}
it
{
should
have_content
(
@milestone
.
expires_at
)
}
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