docbrown/spec/system/admin/admin_creates_new_page_spec.rb
Mac Siri 842e6880b8
Routine rubocop fix on /spec (#19217)
* Softrun rubocop

* Hardrun rubocop (-A)

* Change a rubocop rule

* Add missing cops

* Undo & redo rubocop -A
2023-03-21 09:55:26 -04:00

23 lines
838 B
Ruby

require "rails_helper"
RSpec.describe "Admin creates new page" do
let(:admin) { create(:user, :super_admin) }
context "when we pass through a slug param" do
before do
allow(ForemInstance).to receive(:private?).and_return(true)
sign_in admin
visit new_admin_page_path(slug: "code-of-conduct")
end
it "will pre-populate the fields correctly" do
expect(find_field("page[title]").value).to eq("Code of Conduct")
expect(find_field("page[slug]").value).to eq("code-of-conduct")
expect(find_field("page[is_top_level_path]").value).to eq("1")
expect(find_field("page[landing_page]").value).to eq("1")
text = "All participants of #{community_name} are expected to abide by our Code of Conduct"
expect(find_field("page[body_html]").value).to include(text)
end
end
end