Files
growstuff/spec/views/posts/index.rss.haml_spec.rb
milesgould bb6e9e32e6 De-deprecate controller and view specs
We deprecated controller and view specs on the grounds that they were
brittle, and were a poorer measure of user experience than feature
specs. However, feature specs have their own problems: they're much
slower to run, and flakier (see #901). We also ran into a few cases
where feature specs erroneously passed because they were checking for
the presence of a string that occurred in the error page!

Hence, we're cautiously un-deprecating controller and view specs.

Fixes #1132
2017-11-24 19:02:54 +13:00

25 lines
677 B
Ruby

require 'rails_helper'
describe 'posts/index.rss.haml', type: "view" do
before(:each) do
controller.stub(:current_user) { nil }
author = FactoryBot.create(:member)
@post1 = FactoryBot.create(:post, id: 1, author: author)
@post2 = FactoryBot.create(:post, id: 2, author: author)
assign(:posts, [@post1, @post2])
render
end
it 'shows RSS feed title' do
rendered.should have_content "Recent posts from all members"
end
it 'shows content of posts' do
rendered.should have_content "This is some text."
end
it 'gives the author in the item title' do
rendered.should have_content "#{@post1.subject} by #{@post1.author}"
end
end