Skip to content

Instantly share code, notes, and snippets.

@lmiller1990
Created September 28, 2018 04:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lmiller1990/ffbfb83863cbfdd909fd3161d743a3a3 to your computer and use it in GitHub Desktop.
Save lmiller1990/ffbfb83863cbfdd909fd3161d743a3a3 to your computer and use it in GitHub Desktop.
require 'rails_helper'
feature 'Posts', type: :system, js: true do
let!(:category) { create(:category) }
context 'the post is valid' do
it 'creates a post' do
visit new_post_url
fill_in 'post_title', with: 'my great post'
fill_in 'post_body', with: 'body'
select category.name, from: 'post[category_id]'
click_on 'Create Post'
Post.all.reload
expect(Post.count).to eq 1
expect(Post.first.title).to eq 'my great post'
expect(page).to have_content('my great post')
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment