creddit/spec/features/posts/lists_posts_spec.rb

16 lines
417 B
Ruby
Raw Normal View History

2015-07-14 16:29:22 -04:00
require 'rails_helper'
describe 'List Posts', type: :feature do
let!(:subcreddit) { create(:subcreddit) }
let!(:posts) { 10.times.collect { create(:post, subcreddit: subcreddit) } }
it 'should list all posts for a subcreddit' do
visit subcreddit_path(subcreddit)
posts.each do |post|
expect(page)
2015-07-16 11:57:27 -04:00
.to have_link(post.title, subcreddit_post_path(post.subcreddit, post))
2015-07-14 16:29:22 -04:00
end
end
end