Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Martin Markech
refinerycms-news
Commits
e3390d29
Commit
e3390d29
authored
Jul 11, 2012
by
Garrett Heinlen
Committed by
Uģis Ozols
Jul 12, 2012
Browse files
adding archive specs and fixing code in .live method
parent
2db113a2
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/models/refinery/news/item.rb
View file @
e3390d29
...
...
@@ -69,7 +69,7 @@ module Refinery
end
def
live
not_expired
.
where
(
"publish_date <= ?"
,
Time
.
now
)
not_expired
.
where
(
"publish_date <= ?"
,
Time
.
now
)
end
# rejects any page that has not been translated to the current locale.
...
...
spec/models/refinery/news/item_spec.rb
View file @
e3390d29
...
...
@@ -7,6 +7,19 @@ module Refinery
let
(
:time_now
)
{
Time
.
now
}
let
(
:news_item
)
{
Factory
(
:news_item
)
}
describe
"#archive"
do
let
(
:publish_date
)
{
Time
.
new
(
2012
,
1
,
15
)
}
let
(
:future_date
)
{
Time
.
new
(
2012
,
2
,
15
)
}
let
(
:archive_range
)
{
Time
.
parse
(
"01/12"
)
}
it
"should show 5 news items with publish dates in same month"
do
5
.
times
{
Factory
(
:news_item
,
:publish_date
=>
publish_date
)
}
5
.
times
{
Factory
(
:news_item
,
:publish_date
=>
future_date
)
}
Refinery
::
News
::
Item
.
by_archive
(
archive_range
).
length
.
should
==
5
end
end
describe
"validations"
do
subject
do
news_item
=
Refinery
::
News
::
Item
.
create!
:title
=>
"Refinery CMS"
,
...
...
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