Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
O
OHR Support
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
97
Issues
97
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
OHR Support
Commits
008a29dc
Commit
008a29dc
authored
Jul 26, 2011
by
Gregor Schmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[#539] removing helper method from tests, adding TODO
parent
8c9034f4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
14 deletions
+11
-14
issues_helper_test.rb
test/unit/helpers/issues_helper_test.rb
+11
-14
No files found.
test/unit/helpers/issues_helper_test.rb
View file @
008a29dc
...
...
@@ -39,33 +39,30 @@ class IssuesHelperTest < HelperTestCase
@request
||=
ActionController
::
TestRequest
.
new
end
# This is probably needed in this test only anymore
def
show_detail
(
journal
,
detail
,
html
=
true
)
journal
.
render_detail
(
detail
,
html
)
end
# TODO: Move test code to Journal class
context
"IssuesHelper#show_detail"
do
context
"with no_html"
do
should
'show a changing attribute'
do
@journal
=
IssueJournal
.
generate!
(
:changes
=>
{
"done_ratio"
=>
[
40
,
100
]},
:journaled
=>
Issue
.
last
)
assert_equal
"% Done changed from 40 to 100"
,
show_detail
(
@journal
,
@journal
.
details
.
to_a
.
first
,
true
)
assert_equal
"% Done changed from 40 to 100"
,
@journal
.
render_detail
(
@journal
.
details
.
to_a
.
first
,
true
)
end
should
'show a new attribute'
do
@journal
=
IssueJournal
.
generate!
(
:changes
=>
{
"done_ratio"
=>
[
nil
,
100
]},
:journaled
=>
Issue
.
last
)
assert_equal
"% Done set to 100"
,
show_detail
(
@journal
,
@journal
.
details
.
to_a
.
first
,
true
)
assert_equal
"% Done set to 100"
,
@journal
.
render_detail
(
@journal
.
details
.
to_a
.
first
,
true
)
end
should
'show a deleted attribute'
do
@journal
=
IssueJournal
.
generate!
(
:changes
=>
{
"done_ratio"
=>
[
50
,
nil
]},
:journaled
=>
Issue
.
last
)
assert_equal
"% Done deleted (50)"
,
show_detail
(
@journal
,
@journal
.
details
.
to_a
.
first
,
true
)
assert_equal
"% Done deleted (50)"
,
@journal
.
render_detail
(
@journal
.
details
.
to_a
.
first
,
true
)
end
end
context
"with html"
do
should
'show a changing attribute with HTML highlights'
do
@journal
=
IssueJournal
.
generate!
(
:changes
=>
{
"done_ratio"
=>
[
40
,
100
]},
:journaled
=>
Issue
.
last
)
@response
.
body
=
show_detail
(
@journal
,
@journal
.
details
.
to_a
.
first
,
false
)
@response
.
body
=
@journal
.
render_detail
(
@journal
.
details
.
to_a
.
first
,
false
)
assert_select
'strong'
,
:text
=>
'% Done'
assert_select
'i'
,
:text
=>
'40'
...
...
@@ -74,7 +71,7 @@ class IssuesHelperTest < HelperTestCase
should
'show a new attribute with HTML highlights'
do
@journal
=
IssueJournal
.
generate!
(
:changes
=>
{
"done_ratio"
=>
[
nil
,
100
]},
:journaled
=>
Issue
.
last
)
@response
.
body
=
show_detail
(
@journal
,
@journal
.
details
.
to_a
.
first
,
false
)
@response
.
body
=
@journal
.
render_detail
(
@journal
.
details
.
to_a
.
first
,
false
)
assert_select
'strong'
,
:text
=>
'% Done'
assert_select
'i'
,
:text
=>
'100'
...
...
@@ -82,7 +79,7 @@ class IssuesHelperTest < HelperTestCase
should
'show a deleted attribute with HTML highlights'
do
@journal
=
IssueJournal
.
generate!
(
:changes
=>
{
"done_ratio"
=>
[
50
,
nil
]},
:journaled
=>
Issue
.
last
)
@response
.
body
=
show_detail
(
@journal
,
@journal
.
details
.
to_a
.
first
,
false
)
@response
.
body
=
@journal
.
render_detail
(
@journal
.
details
.
to_a
.
first
,
false
)
assert_select
'strong'
,
:text
=>
'% Done'
assert_select
'strike'
do
...
...
@@ -94,24 +91,24 @@ class IssuesHelperTest < HelperTestCase
context
"with a start_date attribute"
do
should
"format the current date"
do
@journal
=
IssueJournal
.
generate!
(
:changes
=>
{
"start_date"
=>
[
'2010-01-01'
,
'2010-01-31'
]},
:journaled
=>
Issue
.
last
)
assert_match
"01/31/2010"
,
show_detail
(
@journal
,
@journal
.
details
.
to_a
.
first
,
true
)
assert_match
"01/31/2010"
,
@journal
.
render_detail
(
@journal
.
details
.
to_a
.
first
,
true
)
end
should
"format the old date"
do
@journal
=
IssueJournal
.
generate!
(
:changes
=>
{
"start_date"
=>
[
'2010-01-01'
,
'2010-01-31'
]},
:journaled
=>
Issue
.
last
)
assert_match
"01/01/2010"
,
show_detail
(
@journal
,
@journal
.
details
.
to_a
.
first
,
true
)
assert_match
"01/01/2010"
,
@journal
.
render_detail
(
@journal
.
details
.
to_a
.
first
,
true
)
end
end
context
"with a due_date attribute"
do
should
"format the current date"
do
@journal
=
IssueJournal
.
generate!
(
:changes
=>
{
"due_date"
=>
[
'2010-01-01'
,
'2010-01-31'
]},
:journaled
=>
Issue
.
last
)
assert_match
"01/31/2010"
,
show_detail
(
@journal
,
@journal
.
details
.
to_a
.
first
,
true
)
assert_match
"01/31/2010"
,
@journal
.
render_detail
(
@journal
.
details
.
to_a
.
first
,
true
)
end
should
"format the old date"
do
@journal
=
IssueJournal
.
generate!
(
:changes
=>
{
"due_date"
=>
[
'2010-01-01'
,
'2010-01-31'
]},
:journaled
=>
Issue
.
last
)
assert_match
"01/01/2010"
,
show_detail
(
@journal
,
@journal
.
details
.
to_a
.
first
,
true
)
assert_match
"01/01/2010"
,
@journal
.
render_detail
(
@journal
.
details
.
to_a
.
first
,
true
)
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