Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
rendezvous
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
VeNtura
rendezvous
Commits
6abd709c
Commit
6abd709c
authored
May 08, 2014
by
tady
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fork時に日付を今日にする
fix #87
parent
e4b41f69
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
5 deletions
+12
-5
Gemfile.lock
+3
-3
app/models/post.rb
+3
-2
spec/factories/posts.rb
+1
-0
spec/models/post_spec.rb
+5
-0
No files found.
Gemfile.lock
View file @
6abd709c
GIT
GIT
remote: git://github.com/amatsuda/kaminari.git
remote: git://github.com/amatsuda/kaminari.git
revision:
754808dacaa84496faf8a79377d8076bdb3fd05c
revision:
3cfffc11be813ddca9311d3b3e2f1e74bc5ca347
specs:
specs:
kaminari (0.15.1)
kaminari (0.15.1)
actionpack (>= 3.0.0)
actionpack (>= 3.0.0)
...
@@ -106,7 +106,7 @@ GEM
...
@@ -106,7 +106,7 @@ GEM
css_parser (1.3.5)
css_parser (1.3.5)
addressable
addressable
daemons (1.1.9)
daemons (1.1.9)
database_rewinder (0.
0.3
)
database_rewinder (0.
1.0
)
debug_inspector (0.0.2)
debug_inspector (0.0.2)
devise (3.2.4)
devise (3.2.4)
bcrypt (~> 3.0)
bcrypt (~> 3.0)
...
@@ -143,7 +143,7 @@ GEM
...
@@ -143,7 +143,7 @@ GEM
github-markdown (0.6.5)
github-markdown (0.6.5)
gmail_xoauth (0.4.1)
gmail_xoauth (0.4.1)
oauth (>= 0.3.6)
oauth (>= 0.3.6)
guard (2.6.
0
)
guard (2.6.
1
)
formatador (>= 0.2.4)
formatador (>= 0.2.4)
listen (~> 2.7)
listen (~> 2.7)
lumberjack (~> 1.0)
lumberjack (~> 1.0)
...
...
app/models/post.rb
View file @
6abd709c
...
@@ -13,6 +13,8 @@
...
@@ -13,6 +13,8 @@
#
#
# specified_dateは特定の日付を指定したい場合に使用
# specified_dateは特定の日付を指定したい場合に使用
require
'date'
class
Post
<
ActiveRecord
::
Base
class
Post
<
ActiveRecord
::
Base
has_many
:post_tags
has_many
:post_tags
has_many
:tags
,
through: :post_tags
has_many
:tags
,
through: :post_tags
...
@@ -74,14 +76,13 @@ class Post < ActiveRecord::Base
...
@@ -74,14 +76,13 @@ class Post < ActiveRecord::Base
# `%Name`をユーザー名に置換
# `%Name`をユーザー名に置換
_forked_post
.
title
=
_forked_post
.
title
.
gsub
(
/%Name/
,
user
.
name
)
_forked_post
.
title
=
_forked_post
.
title
.
gsub
(
/%Name/
,
user
.
name
)
# `%Y`などを日付に変換
# `%Y`などを日付に変換
_forked_post
.
title
=
Time
.
now
.
strftime
(
_forked_post
.
title
)
# TODO
_forked_post
.
title
=
Time
.
now
.
strftime
(
_forked_post
.
title
)
# TODO
_forked_post
.
title
=
_forked_post
.
title
+
' のコピー'
_forked_post
.
title
=
_forked_post
.
title
+
' のコピー'
_forked_post
.
tag_ids
=
self
.
tag_ids
_forked_post
.
tag_ids
=
self
.
tag_ids
_forked_post
.
author
=
user
_forked_post
.
author
=
user
_forked_post
.
specified_date
=
Date
.
today
_forked_post
_forked_post
end
end
...
...
spec/factories/posts.rb
View file @
6abd709c
...
@@ -19,6 +19,7 @@ FactoryGirl.define do
...
@@ -19,6 +19,7 @@ FactoryGirl.define do
factory
:post
do
factory
:post
do
title
'sample title'
title
'sample title'
body
'sample body'
body
'sample body'
specified_date
Date
.
new
(
2014
,
4
,
1
)
after
(
:create
)
do
|
post
|
after
(
:create
)
do
|
post
|
create
(
:post_tag
,
post:
post
,
tag:
create
(
:tag_ruby
))
create
(
:post_tag
,
post:
post
,
tag:
create
(
:tag_ruby
))
...
...
spec/models/post_spec.rb
View file @
6abd709c
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
#
#
require
'spec_helper'
require
'spec_helper'
require
'date'
describe
Post
do
describe
Post
do
...
@@ -50,6 +51,10 @@ describe Post do
...
@@ -50,6 +51,10 @@ describe Post do
expect
(
@new_post
.
tags
).
to
include
(
@post
.
tags
.
first
)
expect
(
@new_post
.
tags
).
to
include
(
@post
.
tags
.
first
)
end
end
it
'valid specified_date'
do
expect
(
@new_post
.
specified_date
).
to
eq
(
Date
.
today
)
end
end
end
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