Created
August 5, 2016 04:11
-
-
Save hebuliang/3f2bcccbcc34c4fa299f50cc193fdb4b to your computer and use it in GitHub Desktop.
home work of feature test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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