docbrown/spec/system/admin/admin_creates_new_page.rb
Ridhwana 6a7b78e4a0
Allow admins to turn "some" hardcoded pages into a "Page" (#10877)
* feat: allow a page to override the code_of_conduct, terms and privacy page

* feat: let privacy policy also use a partial for its contents like coc and terms

* feat: show the defaults or the pages

* specs: add tests for the overrides

* feat: update some styles and make use crayons buttons

* fix: update order of test items

* spec: fix

* reactor: move this whole section in the if

* feat: updates

* fix: code climate + travis

* more codeeclimate
2020-10-16 12:37:06 -04:00

20 lines
716 B
Ruby

require "rails_helper"
RSpec.describe "Admin creates new page", type: :system do
let(:admin) { create(:user, :super_admin) }
context "when we pass through a slug param" do
before do
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[body_html]").value).to include "All participants of the #{community_qualified_name} are expected to abide by our Code of Conduct,"
end
end
end