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
c339ce73
Commit
c339ce73
authored
Apr 22, 2014
by
tady
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rspec修正:通過
parent
ad76c651
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
161 additions
and
127 deletions
+161
-127
Guardfile
+4
-4
app/controllers/application_controller.rb
+3
-1
app/controllers/flow_controller.rb
+0
-1
app/controllers/posts_controller.rb
+2
-9
app/controllers/search_controller.rb
+0
-1
app/controllers/stock_controller.rb
+0
-1
app/controllers/users/omniauth_callbacks_controller.rb
+3
-0
app/controllers/welcome_controller.rb
+2
-1
app/views/posts/_show_fragment.html.slim
+0
-93
app/views/posts/show.html.slim
+91
-3
spec/controllers/apis_controller_spec.rb
+10
-1
spec/controllers/application_controller_spec.rb
+1
-1
spec/controllers/flow_controller_spec.rb
+10
-2
spec/controllers/search_controller_spec.rb
+10
-2
spec/controllers/stock_controller_spec.rb
+10
-2
spec/controllers/tags_controller_spec.rb
+14
-4
spec/spec_helper.rb
+1
-1
No files found.
Guardfile
View file @
c339ce73
...
...
@@ -16,7 +16,7 @@ guard :rspec do
watch
(
%r{^spec/steps/(.+)_steps
\.
rb$}
)
{
|
m
|
Dir
[
File
.
join
(
"**/
#{
m
[
1
]
}
.feature"
)][
0
]
||
'spec/acceptance'
}
end
guard
:teaspoon
do
watch
(
%r{^app/assets/javascripts/(.+).js}
)
{
|
m
|
"spec/javascripts/
#{
m
[
1
]
}
_spec.js.coffee"
}
watch
(
%r{^spec/javascripts/(.*)}
)
end
#
guard :teaspoon do
#
watch(%r{^app/assets/javascripts/(.+).js}) { |m| "spec/javascripts/#{m[1]}_spec.js.coffee" }
#
watch(%r{^spec/javascripts/(.*)})
#
end
app/controllers/application_controller.rb
View file @
c339ce73
...
...
@@ -5,7 +5,9 @@ class ApplicationController < ActionController::Base
add_breadcrumb
(
"Rendezvous"
,
'/'
)
def
require_login
before_action
:redirect_unless_signed_in
def
redirect_unless_signed_in
unless
user_signed_in?
flash
[
:alert
]
=
'You need Login!'
session
[
:login_redirect_to
]
=
request
.
url
...
...
app/controllers/flow_controller.rb
View file @
c339ce73
class
FlowController
<
ApplicationController
before_action
:require_login
def
show
@posts
=
Post
.
includes
(
:tags
,
:author
).
where
(
is_draft:
false
).
order
(
updated_at: :desc
).
limit
(
20
).
decorate
...
...
app/controllers/posts_controller.rb
View file @
c339ce73
...
...
@@ -2,7 +2,6 @@ require 'nkf'
class
PostsController
<
ApplicationController
before_action
:set_post
,
only:
[
:show
,
:edit
,
:update
,
:destroy
,
:slideshow
]
before_action
:require_login
include
RV
::
Mailer
...
...
@@ -23,12 +22,6 @@ class PostsController < ApplicationController
add_breadcrumb
(
"#
#{
_tag
.
name
}
"
,
_tag
.
decorate
.
show_path
)
end
add_breadcrumb
(
@post
.
title
)
if
params
[
:fragment
].
present?
render
layout:
false
,
partial:
'posts/show_fragment'
else
render
end
end
# GET /posts/new
...
...
@@ -67,7 +60,7 @@ class PostsController < ApplicationController
respond_to
do
|
format
|
if
@post
.
save
format
.
html
{
redirect_to
roo
t_path
(
id:
@post
.
id
),
flash:
{
notice:
'Post was successfully created.'
}
}
format
.
html
{
redirect_to
pos
t_path
(
id:
@post
.
id
),
flash:
{
notice:
'Post was successfully created.'
}
}
format
.
json
{
render
action:
'show'
,
status: :created
,
location:
@post
}
else
format
.
html
{
render
action:
'new'
}
...
...
@@ -83,7 +76,7 @@ class PostsController < ApplicationController
respond_to
do
|
format
|
if
@post
.
update
(
post_params
)
format
.
html
{
redirect_to
roo
t_path
(
id:
@post
.
id
),
flash:
{
notice:
'Post was successfully updated.'
}
}
format
.
html
{
redirect_to
pos
t_path
(
id:
@post
.
id
),
flash:
{
notice:
'Post was successfully updated.'
}
}
format
.
json
{
head
:no_content
}
else
format
.
html
{
render
action:
'edit'
}
...
...
app/controllers/search_controller.rb
View file @
c339ce73
class
SearchController
<
ApplicationController
before_action
:require_login
def
show
if
params
[
:q
].
present?
...
...
app/controllers/stock_controller.rb
View file @
c339ce73
class
StockController
<
ApplicationController
before_action
:require_login
def
show
end
...
...
app/controllers/users/omniauth_callbacks_controller.rb
View file @
c339ce73
class
Users
::
OmniauthCallbacksController
<
Devise
::
OmniauthCallbacksController
skip_before_action
:redirect_unless_signed_in
def
google_oauth2
email
=
request
.
env
[
'omniauth.auth'
].
info
[
'email'
]
...
...
app/controllers/welcome_controller.rb
View file @
c339ce73
class
WelcomeController
<
ApplicationController
skip_before_action
:require_login
skip_before_action
:redirect_unless_signed_in
def
top
if
user_signed_in?
...
...
app/views/posts/_show_fragment.html.slim
deleted
100644 → 0
View file @
ad76c651
.panel.panel-default
.panel-heading
h3
.panel-title
a
href
=
post_path
(
@post
)
=
@post
.
title
ul
.list-group
li
.list-group-item
-
@post
.
tags
.
each
do
|
tag
|
span
.label.label-success
a
href
=
tag
.decorate.show_path
|
#
#{
tag
.
name
}
|
span
.label.label-info
a
href
=
(
search_path
(
q:
"@
#{
@post
.
author
.
name
}
"
)
)
|
@
#{
@post
.
author
.
name
}
|
span
.label.label-danger
a
href
=
(
search_path
(
q:
"date:
#{
@post
.
display_date
}
"
)
)
=
@post
.
display_date
.btn-group.pull-right
style
=
(
"margin: -7px -12px 0 0;"
)
a
.btn.btn-primary
href
=
edit_post_path
(
@post
)
span
.glyphicon.glyphicon-pencil
button
.btn.btn-default.dropdown-toggle
data-toggle
=
"dropdown"
type
=
"button"
span
.caret
span
.sr-only
Toggle
Dropdown
ul
.dropdown-menu
role
=
"menu"
li
a
href
=
slideshow_post_path
(
@post
)
target
=
"_blank"
Slideshow
li
a
.small
href
=
"https://github.com/gnab/remark"
target
=
"_blank"
What
is
Slideshow?
li
.divider
li
a
href
=
fork_post_path
(
@post
)
Fork
li
a
data-target
=
"#myModal"
data-toggle
=
"modal"
href
=
"#"
Mail
to
...
li
.divider
li
=
link_to
'Delete'
,
post_path
(
@post
),
method: :delete
,
data:
{
confirm:
'Are you sure?'
}
.panel-body.viewer.github
=
h_application_format_markdown
(
@post
.
body
)
.panel.panel-success
.panel-heading
h3
.panel-title
Comments
.panel-body
ul
.media-list
-
@post
.
comments
.
each
do
|
comment
|
li
.media
a
.pull-left
href
=
"#"
img
.media-object
src
=
comment
.author.image_url
/
.media-body
h4
.media-heading
=
comment
.
author
.
name
=
comment
.
body
=
form_tag
(
comment_post_path
,
method: :post
,
data:
{
'form-id'
=>
"comment_
#{
@post
.
id
}
"
})
do
li
.media
a
.pull-left
href
=
"#"
img
.media-object
src
=
current_user
.image_url
/
.media-body
h4
.media-heading
=
current_user
.
name
=
text_area
:comment
,
:body
,
class:
'form-control'
,
placeholder:
'コメントする...'
=
submit_tag
'Comment'
,
class:
'btn btn-primary'
,
data:
{
'disable-with'
=>
'...'
}
javascript:
$
(
"form[data-form-id='comment_
#{
@post
.
id
}
']"
).
on
(
'ajax:success'
,
function
(
event
,
data
,
xhr
)
{
});
/! Button trigger modal
/!
|
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal"
|
Launch demo modal
|
</button
/! Modal
#myModal
.modal.fade
aria-hidden
=
"true"
aria-labelledby
=
"myModalLabel"
role
=
"dialog"
tabindex
=
"-1"
.modal-dialog
.modal-content
=
form_tag
mail_post_path
(
@post
),
method: :post
,
class:
'form-horizontal'
,
role:
'form'
do
.modal-header
button
.close
aria-hidden
=
"true"
data-dismiss
=
"modal"
type
=
"button"
×
h4
#myModalLabel
.modal-title
Mail
this
post
to
...
.modal-body
.form-group
label
.col-sm-2.control-label
Title
.col-sm-10
input
.form-control
readonly
=
""
type
=
"text"
value
=
@post
.title
/
.form-group
label
.col-sm-2.control-label
for
=
"inputEmail3"
To
.col-sm-10
input
#inputEmail3
.form-control
name
=
"mail[to]"
placeholder
=
"Email"
type
=
"email"
/
.form-group
label
.col-sm-2.control-label
From
.col-sm-10
input
.form-control
readonly
=
""
type
=
"text"
value
=
current_user
.email
/
.modal-footer
button
.btn.btn-default
data-dismiss
=
"modal"
type
=
"button"
Close
button
.btn.btn-primary
data-disable-with
=
"Sending..."
type
=
"submit"
Send
/! /.modal-content
/! /.modal-dialog
/! /.modal
app/views/posts/show.html.slim
View file @
c339ce73
=
render_breadcrumbs
.row
div
=
render
partial:
'posts/show_fragment'
/! /row
.panel.panel-default
.panel-heading
h3
.panel-title
a
href
=
post_path
(
@post
)
=
@post
.
title
ul
.list-group
li
.list-group-item
-
@post
.
tags
.
each
do
|
tag
|
span
.label.label-success
a
href
=
tag
.decorate.show_path
|
#
#{
tag
.
name
}
|
span
.label.label-info
a
href
=
(
search_path
(
q:
"@
#{
@post
.
author
.
name
}
"
)
)
|
@
#{
@post
.
author
.
name
}
|
span
.label.label-danger
a
href
=
(
search_path
(
q:
"date:
#{
@post
.
display_date
}
"
)
)
=
@post
.
display_date
.btn-group.pull-right
style
=
(
"margin: -7px -12px 0 0;"
)
a
.btn.btn-primary
href
=
edit_post_path
(
@post
)
span
.glyphicon.glyphicon-pencil
button
.btn.btn-default.dropdown-toggle
data-toggle
=
"dropdown"
type
=
"button"
span
.caret
span
.sr-only
Toggle
Dropdown
ul
.dropdown-menu
role
=
"menu"
li
a
href
=
slideshow_post_path
(
@post
)
target
=
"_blank"
Slideshow
li
a
.small
href
=
"https://github.com/gnab/remark"
target
=
"_blank"
What
is
Slideshow?
li
.divider
li
a
href
=
fork_post_path
(
@post
)
Fork
li
a
data-target
=
"#myModal"
data-toggle
=
"modal"
href
=
"#"
Mail
to
...
li
.divider
li
=
link_to
'Delete'
,
post_path
(
@post
),
method: :delete
,
data:
{
confirm:
'Are you sure?'
}
.panel-body.viewer.github
=
h_application_format_markdown
(
@post
.
body
)
.panel.panel-success
.panel-heading
h3
.panel-title
Comments
.panel-body
ul
.media-list
-
@post
.
comments
.
each
do
|
comment
|
li
.media
a
.pull-left
href
=
"#"
img
.media-object
src
=
comment
.author.image_url
/
.media-body
h4
.media-heading
=
comment
.
author
.
name
=
comment
.
body
=
form_tag
(
comment_post_path
,
method: :post
,
data:
{
'form-id'
=>
"comment_
#{
@post
.
id
}
"
})
do
li
.media
a
.pull-left
href
=
"#"
img
.media-object
src
=
current_user
.image_url
/
.media-body
h4
.media-heading
=
current_user
.
name
=
text_area
:comment
,
:body
,
class:
'form-control'
,
placeholder:
'コメントする...'
=
submit_tag
'Comment'
,
class:
'btn btn-primary'
,
data:
{
'disable-with'
=>
'...'
}
javascript:
$
(
"form[data-form-id='comment_
#{
@post
.
id
}
']"
).
on
(
'ajax:success'
,
function
(
event
,
data
,
xhr
)
{
});
/! Button trigger modal
/!
/! Modal
#myModal
.modal.fade
aria-hidden
=
"true"
aria-labelledby
=
"myModalLabel"
role
=
"dialog"
tabindex
=
"-1"
.modal-dialog
.modal-content
=
form_tag
mail_post_path
(
@post
),
method: :post
,
class:
'form-horizontal'
,
role:
'form'
do
.modal-header
button
.close
aria-hidden
=
"true"
data-dismiss
=
"modal"
type
=
"button"
×
h4
#myModalLabel
.modal-title
Mail
this
post
to
...
.modal-body
.form-group
label
.col-sm-2.control-label
Title
.col-sm-10
input
.form-control
readonly
=
""
type
=
"text"
value
=
@post
.title
/
.form-group
label
.col-sm-2.control-label
for
=
"inputEmail3"
To
.col-sm-10
input
#inputEmail3
.form-control
name
=
"mail[to]"
placeholder
=
"Email"
type
=
"email"
/
.form-group
label
.col-sm-2.control-label
From
.col-sm-10
input
.form-control
readonly
=
""
type
=
"text"
value
=
current_user
.email
/
.modal-footer
button
.btn.btn-default
data-dismiss
=
"modal"
type
=
"button"
Close
button
.btn.btn-primary
data-disable-with
=
"Sending..."
type
=
"submit"
Send
/! /.modal-content
/! /.modal-dialog
/! /.modal
spec/controllers/apis_controller_spec.rb
View file @
c339ce73
...
...
@@ -3,9 +3,18 @@ require 'spec_helper'
describe
ApisController
do
describe
"GET 'markdown_preview'"
do
it
"returns http redirect"
do
get
'markdown_preview'
expect
(
response
).
to
redirect_to
(
'/'
)
end
end
describe
"GET 'markdown_preview'"
do
login_user
it
"returns http success"
do
get
'markdown_preview'
response
.
should
be_success
expect
(
response
).
to
be_success
end
end
...
...
spec/controllers/application_controller_spec.rb
View file @
c339ce73
...
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
ApplicationController
do
pending
'#re
quire_log
in'
pending
'#re
direct_unless_signed_
in'
pending
'#after_sign_in_path_for'
...
...
spec/controllers/flow_controller_spec.rb
View file @
c339ce73
...
...
@@ -2,11 +2,19 @@ require 'spec_helper'
describe
FlowController
do
describe
"GET 'show'"
do
describe
"GET 'show' without login"
do
it
"returns http redirect"
do
get
'show'
expect
(
response
).
to
redirect_to
(
'/'
)
end
end
describe
"GET 'show' with login"
do
login_user
it
"returns http success"
do
get
'show'
response
.
should
be_success
expect
(
response
).
to
be_success
end
end
...
...
spec/controllers/search_controller_spec.rb
View file @
c339ce73
...
...
@@ -2,11 +2,19 @@ require 'spec_helper'
describe
SearchController
do
describe
"GET 'show'"
do
describe
"GET 'show' without login"
do
it
"returns http redirect"
do
get
'show'
expect
(
response
).
to
redirect_to
(
'/'
)
end
end
describe
"GET 'show' with login"
do
login_user
it
"returns http success"
do
get
'show'
response
.
should
be_success
expect
(
response
).
to
be_success
end
end
...
...
spec/controllers/stock_controller_spec.rb
View file @
c339ce73
...
...
@@ -2,11 +2,19 @@ require 'spec_helper'
describe
StockController
do
describe
"GET 'show'"
do
describe
"GET 'show' without login"
do
it
"returns http redirect"
do
get
'show'
expect
(
response
).
to
redirect_to
(
'/'
)
end
end
describe
"GET 'show' with login"
do
login_user
it
"returns http success"
do
get
'show'
response
.
should
be_success
expect
(
response
).
to
be_success
end
end
...
...
spec/controllers/tags_controller_spec.rb
View file @
c339ce73
...
...
@@ -2,12 +2,22 @@ require 'spec_helper'
describe
TagsController
do
describe
"GET 'show'"
do
pending
'...'
let
(
:tag
)
{
FactoryGirl
.
create
(
:tag_ruby
)
}
describe
"GET 'show' without login"
do
it
"returns http redirect"
do
get
'show'
,
name:
tag
.
name
expect
(
response
).
to
redirect_to
(
'/'
)
end
end
describe
"GET 'events'"
do
pending
'...'
describe
"GET 'show' with login"
do
login_user
it
"returns http success"
do
get
'show'
,
name:
tag
.
name
expect
(
response
).
to
be_success
end
end
end
spec/spec_helper.rb
View file @
c339ce73
...
...
@@ -22,7 +22,7 @@ require 'capybara/poltergeist'
def
register_poltergeist
(
config
)
Capybara
.
register_driver
:poltergeist
do
|
app
|
Capybara
::
Poltergeist
::
Driver
.
new
(
app
,
timeout:
60
)
Capybara
::
Poltergeist
::
Driver
.
new
(
app
,
timeout:
60
,
js_errors:
false
)
end
# Capybara.run_server = true
# Capybara.default_driver = :poltergeist
...
...
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