From 507fe96094dad1b8f823d701fe01d9d84c47bca4 Mon Sep 17 00:00:00 2001 From: Zee Spencer <50284+zspencer@users.noreply.github.com> Date: Sun, 28 Jan 2024 18:58:52 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=A5=97=20`Journal`:=20Test=20adding=20`En?= =?UTF-8?q?try#summary`=20when=20Writing=20`Entries`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - https://github.com/zinc-collective/convene-journal/issues/10 - https://github.com/zinc-collective/convene-journal/issues/2 This is a quick line-of-action end-to-end test for setting an `Entry#summary`. --- .../journal/writing_entries_system_spec.rb | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 spec/furniture/journal/writing_entries_system_spec.rb diff --git a/spec/furniture/journal/writing_entries_system_spec.rb b/spec/furniture/journal/writing_entries_system_spec.rb new file mode 100644 index 000000000..bd4be88d4 --- /dev/null +++ b/spec/furniture/journal/writing_entries_system_spec.rb @@ -0,0 +1,30 @@ +require "rails_helper" + +# @see https://github.com/zinc-collective/convene-journal/issues/2 +RSpec.describe "Writing Entries", type: :system do + let(:space) { create(:space, :with_entrance, :with_members) } + let(:journal) { create(:journal, room: space.entrance) } + + before do + sign_in(space.members.first, space) + end + + it "saves the headline, summary and body" do # rubocop:disable RSpec/ExampleLength + visit(polymorphic_path(journal.location(:new, child: :entry))) + + body = 1000.times.map { Faker::Books::Dune.quote }.join("\n\n") + fill_in("Headline", with: "1000 Dune Quotes") + fill_in("Body", with: body) + summary = %( + So you thought you wanted 1000 Dune Quotes? + Well, you were wrong. But here they are anyway! + ) + fill_in("Summary", with: summary) + + click_button("Create") + entry = journal.entries.last + expect(entry.headline).to eq("1000 Dune Quotes") + expect(entry.body).to eq(body) + expect(entry.summary).to eq(summary) + end +end