Add default site customization pages
From now on these static pages: `/privacy' `/conditions' `/accesibility' `/help/faq' `/welcome' have been moved to the DB and can be modified easily by any administrator in `/admin/site_customization/pages'
This commit is contained in:
@@ -4,9 +4,30 @@ describe AdminWYSIWYGSanitizer do
|
||||
let(:sanitizer) { AdminWYSIWYGSanitizer.new }
|
||||
|
||||
describe "#sanitize" do
|
||||
|
||||
it "allows images" do
|
||||
html = 'Dangerous<img src="/smile.png" alt="Smile" style="width: 10px;"> image'
|
||||
expect(sanitizer.sanitize(html)).to eq(html)
|
||||
end
|
||||
|
||||
it "allows tables" do
|
||||
html = '<table align="center" border="2" cellpadding="2" cellspacing="2" dir="ltr" ' \
|
||||
'id="table_id" class="stylesheet_classes" style="height:200px;width:500px;" ' \
|
||||
'summary="summary">
|
||||
<caption>caption</caption>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">header 1</th>
|
||||
<td>cell 1</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">header 2</th>
|
||||
<td>cell 2</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>'
|
||||
expect(sanitizer.sanitize(html)).to eq(html)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
15
spec/lib/tasks/db_spec.rb
Normal file
15
spec/lib/tasks/db_spec.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "rake db:pages" do
|
||||
let :run_rake_task do
|
||||
Rake.application.invoke_task("db:pages")
|
||||
end
|
||||
|
||||
it "seeds the database with the default custom pages" do
|
||||
SiteCustomization::Page.destroy_all
|
||||
expect(SiteCustomization::Page.count).to be 0
|
||||
|
||||
run_rake_task
|
||||
expect(SiteCustomization::Page.count).to be 7
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user