Merge branch 'master' of https://github.com/CactusPuppy/snapcon into 176895124-happening-now-json-api-endpoint

This commit is contained in:
Jimmy 2021-03-19 17:23:47 +08:00
commit 1ab580e7e6
27 changed files with 356 additions and 467 deletions

View file

@ -49,6 +49,7 @@ FactoryBot.define do
ticket_layout { 'portrait' }
description { Faker::Hipster.paragraph }
organization
color { '#FFFFFF' }
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)')
Role.where(name: 'cfp', resource: conference).first_or_create(description: 'For the members of the CfP team')

View file

@ -7,7 +7,6 @@
# id :bigint not null, primary key
# abstract :text
# comments_count :integer default(0), not null
# committee_review :text
# description :text
# guid :string not null
# is_highlight :boolean default(FALSE)

View file

@ -67,4 +67,36 @@ describe ConferenceHelper, type: :helper do
expect(sponsorship_mailto(conference)).to match conference.short_title
end
end
describe '#conference_logo_url' do
let(:organization) { create(:organization) }
let(:conference2) { create(:conference, organization: organization) }
it 'gives the correct logo url' do
expect(conference_logo_url(conference2)).to eq('snapcon_logo.png')
File.open('spec/support/logos/1.png') do |file|
organization.picture = file
end
expect(conference_logo_url(conference2)).to include('1.png')
File.open('spec/support/logos/2.png') do |file|
conference2.picture = file
end
expect(conference_logo_url(conference2)).to include('2.png')
end
end
describe '#conference_color' do
let(:conference2) { create(:conference, color: '#000000') }
it 'gives the correct conference color' do
expect(conference_color(conference2)).to eq('#000000')
conference2.color = ''
expect(conference_color(conference2)).to eq('#0B3559')
end
end
end

View file

@ -26,6 +26,14 @@ describe Mailbot do
expect(mail.body).to include 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit'
end
it 'assigns the email body with the correct color' do
expect(mail.body).to include('background-color: ' + conference.color)
end
it 'assigns the email body with the correct logo' do
expect(mail.body).to include 'snapcon_logo'
end
it 'delivers the email' do
expect(ActionMailer::Base.deliveries).to include(mail)
end

View file

@ -7,7 +7,6 @@
# id :bigint not null, primary key
# abstract :text
# comments_count :integer default(0), not null
# committee_review :text
# description :text
# guid :string not null
# is_highlight :boolean default(FALSE)

View file

@ -7,7 +7,6 @@
# id :bigint not null, primary key
# abstract :text
# comments_count :integer default(0), not null
# committee_review :text
# description :text
# guid :string not null
# is_highlight :boolean default(FALSE)

View file

@ -3,7 +3,7 @@
# This file is copied to spec/ when you run 'rails generate rspec:install'
require 'simplecov'
if ENV['GITHUB_ACTIONS']
if ENV['GITHUB_ACTIONS'] || ENV['TRAVIS']
require 'simplecov-cobertura'
SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
end