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
27d0d706
Commit
27d0d706
authored
Apr 30, 2014
by
tady
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feature spec修正
parent
c000d282
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
11 deletions
+6
-11
.gitignore
+1
-0
app/controllers/posts_controller.rb
+2
-2
spec/acceptance/access.feature
+1
-1
spec/features/posts_spec.rb
+2
-8
No files found.
.gitignore
View file @
27d0d706
...
@@ -32,3 +32,4 @@
...
@@ -32,3 +32,4 @@
/script/backup.sh
/script/backup.sh
.rbenv-gemsets
.rbenv-gemsets
.ruby-version
app/controllers/posts_controller.rb
View file @
27d0d706
...
@@ -91,10 +91,10 @@ class PostsController < ApplicationController
...
@@ -91,10 +91,10 @@ class PostsController < ApplicationController
@comment
=
@post
.
comments
.
build
(
comment_params
.
merge
(
author:
current_user
))
@comment
=
@post
.
comments
.
build
(
comment_params
.
merge
(
author:
current_user
))
respond_to
do
|
format
|
respond_to
do
|
format
|
if
@comment
.
save
if
@comment
.
save
format
.
html
{
redirect_to
post
s
_path
(
id:
@post
.
id
)
}
format
.
html
{
redirect_to
post_path
(
id:
@post
.
id
)
}
format
.
json
{
render
json:
{
status:
'ok'
,
comment:
@comment
},
status: :created
}
format
.
json
{
render
json:
{
status:
'ok'
,
comment:
@comment
},
status: :created
}
else
else
format
.
html
{
redirect_to
post
s
_path
(
id:
@post
.
id
),
flash:
{
alert:
'Comment is not saved.'
}
}
format
.
html
{
redirect_to
post_path
(
id:
@post
.
id
),
flash:
{
alert:
'Comment is not saved.'
}
}
format
.
json
{
render
json:
@comment
.
errors
,
status: :unprocessable_entity
}
format
.
json
{
render
json:
@comment
.
errors
,
status: :unprocessable_entity
}
end
end
end
end
...
...
spec/acceptance/access.feature
View file @
27d0d706
...
@@ -6,7 +6,7 @@ Feature: アクセス制限
...
@@ -6,7 +6,7 @@ Feature: アクセス制限
Then response includes '<!--view
:
welcome/login-->'
Then response includes '<!--view
:
welcome/login-->'
Scenario
:
非ログイン --> postsページ
Scenario
:
非ログイン --> postsページ
When
visit '/
posts
'
When
visit '/
flow
'
Then
response code is 200
Then
response code is 200
Then response includes '<!--view
:
welcome/login-->'
Then response includes '<!--view
:
welcome/login-->'
...
...
spec/features/posts_spec.rb
View file @
27d0d706
...
@@ -15,18 +15,12 @@ describe 'Request via js', js: true do
...
@@ -15,18 +15,12 @@ describe 'Request via js', js: true do
before
:each
do
before
:each
do
login_as
user
,
scope: :user
login_as
user
,
scope: :user
visit
'/
posts
'
visit
'/
flow
'
end
end
it
'show first post'
do
it
'show first post'
do
page
.
save_screenshot
(
Rails
.
root
.
join
(
'tmp'
,
'screenshots'
,
"a-
#{
Time
.
now
.
strftime
(
'%Y-%m-%d %H%M%S'
)
}
.png"
))
page
.
save_screenshot
(
Rails
.
root
.
join
(
'tmp'
,
'screenshots'
,
"a-
#{
Time
.
now
.
strftime
(
'%Y-%m-%d %H%M%S'
)
}
.png"
))
expect
(
page
.
find
(
'.panel-title a'
).
text
).
to
include
(
'java java'
)
expect
(
page
.
find
(
'.post-list:first-child h4'
).
text
).
to
include
(
'java java'
)
end
it
'click post and show'
do
find
(
'.post-list:nth-child(3)'
).
click
page
.
save_screenshot
(
Rails
.
root
.
join
(
'tmp'
,
'screenshots'
,
"b-
#{
Time
.
now
.
strftime
(
'%Y-%m-%d %H%M%S'
)
}
.png"
))
expect
(
page
.
find
(
'.panel-title a'
).
text
).
to
include
(
'ruby rspec'
)
end
end
after
:each
do
after
:each
do
...
...
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