mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-03-24 17:54:59 -04:00
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
31 lines
829 B
Ruby
31 lines
829 B
Ruby
require 'rails_helper'
|
|
|
|
describe 'posts/show.rss.haml' do
|
|
before(:each) do
|
|
controller.stub(:current_user) { nil }
|
|
@author = FactoryBot.create(:member)
|
|
@post = FactoryBot.create(:post)
|
|
FactoryBot.create(:comment, author: @author, post: @post)
|
|
FactoryBot.create(:comment, author: @author, post: @post)
|
|
assign(:post, @post)
|
|
render
|
|
end
|
|
|
|
it 'shows RSS feed title' do
|
|
rendered.should have_content "Recent comments on #{@post.subject}"
|
|
end
|
|
|
|
it 'shows item title' do
|
|
rendered.should have_content "Comment by #{@author.login_name}"
|
|
end
|
|
|
|
it 'escapes html for link to post' do
|
|
# it's then unescaped by 'render' so we don't actually look for <
|
|
rendered.should have_content '<a href='
|
|
end
|
|
|
|
it 'shows content of comments' do
|
|
rendered.should have_content "OMG LOL"
|
|
end
|
|
end
|