mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-10-31 11:21:06 -04:00
* Bump rails from 8.1.3.1 to 8.1.4 Bumps [rails](https://github.com/rails/rails) from 8.1.3.1 to 8.1.4. - [Release notes](https://github.com/rails/rails/releases) - [Commits](https://github.com/rails/rails/compare/v8.1.3.1...v8.1.4) --- updated-dependencies: - dependency-name: rails dependency-version: 8.1.4 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Drop stale expectation --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Daniel O'Connor <daniel.oconnor@gmail.com>
62 lines
1.5 KiB
Ruby
62 lines
1.5 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require 'rails_helper'
|
|
|
|
describe "posts/new" do
|
|
let(:author) { create(:member) }
|
|
|
|
before do
|
|
assign(:post, create(:post, author:))
|
|
# assign(:forum, Forum.new)
|
|
sign_in author
|
|
controller.stub(:current_user) { author }
|
|
render
|
|
end
|
|
|
|
it "renders new post form" do
|
|
assert_select "form", action: posts_path, method: "post" do
|
|
assert_select "input#post_subject", name: "post[subject]"
|
|
assert_select "textarea#post_body", name: "post[body]"
|
|
end
|
|
end
|
|
|
|
it 'no hidden forum field' do
|
|
assert_select "input#post_forum_id[type=hidden]", false
|
|
end
|
|
|
|
it 'no forum mentioned' do
|
|
expect(rendered).to have_no_content "This post will be posted in the forum"
|
|
end
|
|
|
|
it "asks what's going on in your garden" do
|
|
expect(rendered).to have_content "What's going on in your food garden?"
|
|
end
|
|
|
|
it 'shows markdown help' do
|
|
expect(rendered).to have_content 'Markdown'
|
|
end
|
|
|
|
context "forum specified" do
|
|
let(:forum) { create(:forum) }
|
|
|
|
before do
|
|
assign(:forum, forum)
|
|
assign(:post, create(:post, forum:))
|
|
render
|
|
end
|
|
|
|
it 'creates a hidden field' do
|
|
assert_select "input#post_forum_id[type='hidden'][value='#{forum.id}']"
|
|
end
|
|
|
|
it 'tells the user what forum it will be posted in' do
|
|
expect(rendered).to have_content "This post will be posted in the forum #{forum.name}"
|
|
end
|
|
|
|
it { expect(rendered).to have_link forum.name }
|
|
|
|
describe "asks what's going on generally" do
|
|
it { expect(rendered).to have_content "What's up?" }
|
|
end
|
|
end
|
|
end |