Skip to content

Instantly share code, notes, and snippets.

@hebuliang
Created August 5, 2016 04:11
Show Gist options
  • Save hebuliang/3f2bcccbcc34c4fa299f50cc193fdb4b to your computer and use it in GitHub Desktop.
Save hebuliang/3f2bcccbcc34c4fa299f50cc193fdb4b to your computer and use it in GitHub Desktop.
home work of feature test
require 'rails_helper'
RSpec.feature 'post feature', type: :feature do
scenario 'create new post' do
visit '/posts'
expect(find('.left > a')).to have_content('New Post')
click_link('New Post')
expect(page).to have_selector('.actions > input')
fill_in('post_title', with: 'New Post 1')
fill_in('post_content', with: 'Content of New Post 1')
click_button('Create Post')
expect(page).to have_content('Post was successfully created.')
click_link('Back')
sleep(5)
expect(find('.top-10-list > li')).to have_content('New Post 1')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment