mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-16 13:14:03 +00:00
The single query was producing a tremendously large ActiveRecord allocation. While this isn't nearly as cool as one query, it's still a significant reduction in SQL trips, and now has the bonus of only loading what is actually going to be displayed.
68 lines
1.8 KiB
Ruby
68 lines
1.8 KiB
Ruby
require 'spec_helper'
|
|
|
|
describe ConferenceHelper, type: :helper do
|
|
let!(:conference) { create(:conference) }
|
|
let!(:contact) { create(:contact, conference: conference) }
|
|
|
|
describe '#one_call_open' do
|
|
it 'is falsey if neither call is open' do
|
|
expect(one_call_open(*conference.program.cfps)).to be_falsey
|
|
end
|
|
|
|
it 'is truthy if call_for_papers is open' do
|
|
create(
|
|
:cfp,
|
|
program: conference.program,
|
|
cfp_type: 'events',
|
|
start_date: conference.start_date,
|
|
end_date: conference.end_date
|
|
)
|
|
expect(one_call_open(*conference.program.cfps)).to be_truthy
|
|
end
|
|
|
|
it 'is truthy if call_for_tracks is open' do
|
|
create(
|
|
:cfp,
|
|
program: conference.program,
|
|
cfp_type: 'tracks',
|
|
start_date: conference.start_date,
|
|
end_date: conference.end_date
|
|
)
|
|
|
|
expect(one_call_open(*conference.program.cfps)).to be_truthy
|
|
end
|
|
|
|
it 'is falsey if both calls are open' do
|
|
create(
|
|
:cfp,
|
|
program: conference.program,
|
|
cfp_type: 'events',
|
|
start_date: conference.start_date,
|
|
end_date: conference.end_date
|
|
)
|
|
create(
|
|
:cfp,
|
|
program: conference.program,
|
|
cfp_type: 'tracks',
|
|
start_date: conference.start_date,
|
|
end_date: conference.end_date
|
|
)
|
|
|
|
expect(one_call_open(*conference.program.cfps)).to be_falsey
|
|
end
|
|
end
|
|
|
|
describe '#sponsorship_mailto' do
|
|
it 'constructs a mailto URL' do
|
|
expect(sponsorship_mailto(conference)).to match 'mailto:'
|
|
end
|
|
|
|
it 'points to the conference sponsor address' do
|
|
expect(sponsorship_mailto(conference)).to match contact.sponsor_email
|
|
end
|
|
|
|
it 'includes a conference identifier' do
|
|
expect(sponsorship_mailto(conference)).to match conference.short_title
|
|
end
|
|
end
|
|
end
|