Fix banners in user pages
Banners were not been shown in certain pages; now they are. Spec to check if the banner is been shown correctly added. Before it was in admins specs, now it has it's own spec out of admins folder.
This commit is contained in:
@@ -74,6 +74,8 @@ feature 'Admin banners magement' do
|
||||
end
|
||||
|
||||
scenario 'Publish a banner' do
|
||||
section = create(:web_section, name: 'proposals')
|
||||
|
||||
visit admin_root_path
|
||||
|
||||
within('#side_menu') do
|
||||
@@ -91,6 +93,7 @@ feature 'Admin banners magement' do
|
||||
fill_in 'post_ended_at', with: next_week.strftime("%d/%m/%Y")
|
||||
fill_in 'banner_background_color', with: '#850000'
|
||||
fill_in 'banner_font_color', with: '#ffb2b2'
|
||||
check "banner_web_section_ids_#{section.id}"
|
||||
|
||||
click_button 'Save changes'
|
||||
|
||||
@@ -120,19 +123,6 @@ feature 'Admin banners magement' do
|
||||
expect(page.find_field("banner_font_color_picker").value).to eq('#ffb2b2')
|
||||
end
|
||||
|
||||
scenario "Created banner is correctly shown in the web" do
|
||||
banner = create(:banner, title: 'My banner', description: 'My description of the banner', target_url: '/debates', background_color: '#00FF00')
|
||||
|
||||
visit proposals_path
|
||||
|
||||
expect(find('.banner')[:style]).to eq("background-color:#00FF00")
|
||||
|
||||
within('.banner') do
|
||||
expect(find('h2')[:style]).to eq("color:#{banner.font_color}")
|
||||
expect(find('h3')[:style]).to eq("color:#{banner.font_color}")
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'Edit banner with live refresh', :js do
|
||||
banner1 = create(:banner, title: 'Hello',
|
||||
description: 'Wrong text',
|
||||
|
||||
29
spec/features/banners_spec.rb
Normal file
29
spec/features/banners_spec.rb
Normal file
@@ -0,0 +1,29 @@
|
||||
require 'rails_helper'
|
||||
|
||||
feature 'Banner' do
|
||||
|
||||
scenario "The banner is shown correctly" do
|
||||
create(:web_section, name: 'homepage')
|
||||
banner = create(:banner, title: 'Hello',
|
||||
description: 'Banner description',
|
||||
target_url: 'http://www.url.com',
|
||||
post_started_at: (Time.current - 4.days),
|
||||
post_ended_at: (Time.current + 10.days),
|
||||
background_color: '#FF0000',
|
||||
font_color: '#FFFFFF')
|
||||
section = WebSection.where(name: 'homepage').last
|
||||
create(:banner_section, web_section: section, banner_id: banner.id)
|
||||
|
||||
visit root_path
|
||||
|
||||
within('.banner') do
|
||||
expect(page).to have_content('Banner description')
|
||||
expect(find('h2')[:style]).to eq("color:#{banner.font_color}")
|
||||
expect(find('h3')[:style]).to eq("color:#{banner.font_color}")
|
||||
end
|
||||
|
||||
visit debates_path
|
||||
|
||||
expect(page).not_to have_content('Banner description')
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user