-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathnewsletter_settings_spec.rb
More file actions
52 lines (47 loc) · 1.84 KB
/
Copy pathnewsletter_settings_spec.rb
File metadata and controls
52 lines (47 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# frozen_string_literal: true
require "rails_helper"
describe "Newsletter settings" do
let(:organization_logo) { Decidim::Dev.test_file("avatar.jpg", "image/jpeg") }
let(:footer_logo) { Decidim::Dev.test_file("avatar.jpg", "image/jpeg") }
let(:organization) { create(:organization, logo: organization_logo, official_img_footer: footer_logo, twitter_handler: "twitter", facebook_handler: "") }
let!(:admin) { create(:user, :admin, :confirmed, organization:) }
let!(:newsletter) { create(:newsletter, :sent, total_recipients: 1) }
let!(:content_block) do
create(:content_block,
organization:,
manifest_name: :basic_only_text,
scope_name: :newsletter_template,
scoped_resource_id: newsletter.id,
settings:)
end
let(:settings) do
{
header_background_color: "#1a181d",
body_background_color: "#ffffff",
body_font_color: "#000000"
}
end
before do
Rails.application.config.action_mailer.default_url_options = { port: Capybara.server_port }
switch_to_host(organization.host)
login_as admin, scope: :user
end
describe "new newsletter" do
before do
visit decidim_admin.root_path(locale: :ca)
click_on "Butlletins"
page.all(:link, "Nou butlletí").first.click
within("div.card-section div.card", match: :first) do
click_on "Utilitzar aquesta plantilla"
end
end
context "and show settings" do
it "renders the correct settings form" do
expect(page).to have_content("Color de la capçalera")
expect(page).to have_field("newsletter[settings][header_background_color]", with: "#1a181d")
expect(page).to have_field("newsletter[settings][body_background_color]", with: "#fefefe")
expect(page).to have_field("newsletter[settings][body_font_color]", with: "#000000")
end
end
end
end