Commit 27d0d706 by tady

feature spec修正

parent c000d282
......@@ -32,3 +32,4 @@
/script/backup.sh
.rbenv-gemsets
.ruby-version
......@@ -91,10 +91,10 @@ class PostsController < ApplicationController
@comment = @post.comments.build(comment_params.merge(author: current_user))
respond_to do |format|
if @comment.save
format.html { redirect_to posts_path(id: @post.id) }
format.html { redirect_to post_path(id: @post.id) }
format.json { render json: { status: 'ok', comment: @comment }, status: :created }
else
format.html { redirect_to posts_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 }
end
end
......
......@@ -6,7 +6,7 @@ Feature: アクセス制限
Then response includes '<!--view:welcome/login-->'
Scenario: 非ログイン --> postsページ
When visit '/posts'
When visit '/flow'
Then response code is 200
Then response includes '<!--view:welcome/login-->'
......
......@@ -15,18 +15,12 @@ describe 'Request via js', js: true do
before :each do
login_as user, scope: :user
visit '/posts'
visit '/flow'
end
it 'show first post' do
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')
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')
expect(page.find('.post-list:first-child h4').text).to include('java java')
end
after :each do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment