mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-03-24 09:43:24 -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
38 lines
881 B
Ruby
38 lines
881 B
Ruby
require 'rails_helper'
|
|
|
|
describe "forums/show" do
|
|
before(:each) do
|
|
controller.stub(:current_user) { nil }
|
|
@forum = assign(:forum, FactoryBot.create(:forum))
|
|
end
|
|
|
|
it "renders attributes" do
|
|
render
|
|
rendered.should have_content "Everything about permaculture"
|
|
rendered.should have_content @forum.owner.to_s
|
|
end
|
|
|
|
it "parses markdown description into html" do
|
|
render
|
|
assert_select "em", "Everything"
|
|
end
|
|
|
|
it 'links to new post with the forum id' do
|
|
render
|
|
assert_select "a[href='#{new_post_path(forum_id: @forum.id)}']"
|
|
end
|
|
|
|
it 'has no posts' do
|
|
render
|
|
rendered.should have_content "No posts yet."
|
|
end
|
|
|
|
it 'shows posts' do
|
|
@post = FactoryBot.create(:post, forum: @forum)
|
|
render
|
|
assert_select "table"
|
|
rendered.should have_content @post.subject
|
|
rendered.should have_content @post.author.to_s
|
|
end
|
|
end
|