Escape HTML some factory strings

This commit is contained in:
Henne Vogelsang 2016-05-02 17:39:06 +02:00
parent ad0a8eecf2
commit 45bd31fad0
12 changed files with 21 additions and 22 deletions

View file

@ -8,7 +8,7 @@ FactoryGirl.define do
start_date { Date.today }
end_date { 6.days.from_now }
registration_limit 0
description { CGI.escapeHTML(Faker::Hipster.paragraph) }
description { Faker::Hipster.paragraph }
after(:create) do |conference|
Role.where(name: 'organizer', resource: conference).first_or_create(description: 'For the organizers of the conference (who shall have full access)')

View file

@ -30,6 +30,5 @@ FactoryGirl.define do
event.comment_threads << build(:comment, commentable: event)
end
end
end
end

View file

@ -3,7 +3,7 @@
FactoryGirl.define do
factory :lodging do
name { "#{Faker::App.name} Hotel" }
description { CGI.escapeHTML(Faker::Lorem.paragraph) }
description { Faker::Lorem.paragraph }
website_link { Faker::Internet.url }
end
end

View file

@ -4,7 +4,7 @@ FactoryGirl.define do
factory :sponsor do
name { Faker::Company.name }
website_url { Faker::Internet.url }
description { CGI.escapeHTML(Faker::Lorem.paragraph) }
description { Faker::Lorem.paragraph }
sponsorship_level

View file

@ -2,7 +2,7 @@
FactoryGirl.define do
factory :sponsorship_level do
title { Faker::Hipster.word }
title { Faker::Lorem.word }
conference
end

View file

@ -15,7 +15,7 @@ feature Lodging do
click_link 'Add Lodging'
fill_in 'lodging_name', with: 'New lodging'
fill_in 'lodging_website_link', with: 'http:\\www.google.com'
fill_in 'lodging_website_link', with: 'http://www.google.com'
attach_file 'Picture', path
click_button 'Create Lodging'
@ -35,7 +35,7 @@ feature Lodging do
visit admin_conference_lodgings_path(
conference_id: conference.short_title)
expect(page.has_content?(lodging.name)).to be true
expect(page.has_content?(CGI.escapeHTML(lodging.name))).to be true
# Add lodging
click_link 'Edit'
@ -51,7 +51,7 @@ feature Lodging do
expect(page.has_content?('New lodging')).to be true
lodging.reload
expect(lodging.name).to eq('New lodging')
expect(lodging.description).to eq(lodging.description)
expect(lodging.description).to eq(CGI.escapeHTML(lodging.description))
expect(lodging.website_link).to eq('http://www.google.com')
expect(Lodging.count).to eq(1)
end
@ -70,7 +70,7 @@ feature Lodging do
# Validations
expect(flash).to eq('Lodging successfully deleted.')
expect(page.has_content?(lodging.name)).to be false
expect(page.has_content?(CGI.escapeHTML(lodging.name))).to be false
expect(Lodging.count).to eq(0)
end
end

View file

@ -8,6 +8,6 @@ describe 'admin/conference/index' do
assign(:conferences, [conference, second_conference])
render
expect(rendered).to include('openSUSE Conference 2016')
expect(rendered).to include(second_conference.title)
expect(rendered).to include(CGI.escapeHTML(second_conference.title))
end
end

View file

@ -9,6 +9,6 @@ describe 'admin/conference/new' do
expect(rendered).to include('Basic Information')
assign(:conference, conference)
render
expect(rendered).to include(conference.title)
expect(rendered).to include(CGI.escapeHTML(conference.title))
end
end

View file

@ -7,6 +7,6 @@ describe 'admin/lodgings/index' do
@conference.lodgings << create(:lodging)
assign :venue, @conference.venue
render
expect(rendered).to include(@conference.lodgings.first.name)
expect(rendered).to include(CGI.escapeHTML(@conference.lodgings.first.name))
end
end

View file

@ -9,9 +9,9 @@ describe 'admin/sponsors/index' do
)
assign :conference, @conference
render
expect(rendered).to include(@conference.sponsors.first.name)
expect(rendered).to include(CGI.escapeHTML(@conference.sponsors.first.name))
expect(rendered).to include(@conference.sponsors.first.website_url)
expect(rendered).to include(truncate(@conference.sponsors.first.description))
expect(rendered).to include(@conference.sponsorship_levels.first.title)
expect(rendered).to include(truncate(CGI.escapeHTML(@conference.sponsors.first.description)))
expect(rendered).to include(CGI.escapeHTML(@conference.sponsorship_levels.first.title))
end
end

View file

@ -5,6 +5,6 @@ describe 'admin/sponsorship_levels/index' do
@sponsorship_level = create(:sponsorship_level)
assign :conference, @sponsorship_level.conference
render
expect(rendered).to include(@sponsorship_level.title)
expect(rendered).to include(CGI.escapeHTML(@sponsorship_level.title))
end
end

View file

@ -9,7 +9,7 @@ describe 'conference/show.html.haml' do
end
it 'renders banner component' do
expect(rendered).to match(conference.description)
expect(rendered).to match(CGI.escapeHTML(conference.description))
end
it 'renders program partial' do
@ -28,7 +28,7 @@ describe 'conference/show.html.haml' do
expect(view).to render_template(partial: 'conference/_sponsors')
expect(rendered).to match(conference.contact.email)
expect(rendered).to match(conference.sponsors.first.website_url)
expect(rendered).to match(conference.sponsors.first.description)
expect(rendered).to match(CGI.escapeHTML(conference.sponsors.first.description))
expect(rendered).to match(conference.sponsors.first.logo_file_name)
end
@ -42,16 +42,16 @@ describe 'conference/show.html.haml' do
it 'renders venue partial' do
expect(view).to render_template(partial: 'conference/_venue')
expect(rendered).to match(conference.venue.name)
expect(rendered).to match(CGI.escapeHTML(conference.venue.name))
expect(rendered).to match(conference.venue.street)
expect(rendered).to match(conference.venue.website)
expect(rendered).to match(conference.venue.description)
expect(rendered).to match(CGI.escapeHTML(conference.venue.description))
end
it 'renders lodging partial' do
expect(view).to render_template(partial: 'conference/_lodging')
expect(rendered).to match(conference.lodgings.first.name)
expect(rendered).to match(conference.lodgings.first.description)
expect(rendered).to match(CGI.escapeHTML(conference.lodgings.first.name))
expect(rendered).to match(CGI.escapeHTML(conference.lodgings.first.description))
# FIXME: Lodging without image doesn't show link
# expect(rendered).to match(conference.lodgings.first.website_link)
end