Merge master, resolve schema conflicts

This commit is contained in:
Michael Ball 2021-03-02 22:35:01 -08:00
commit 04154020a5
42 changed files with 757 additions and 131 deletions

View file

@ -19,6 +19,7 @@
# require_registration :boolean
# start_time :datetime
# state :string default("new"), not null
# submission_text :text
# subtitle :string
# title :string not null
# week :integer

View file

@ -13,6 +13,10 @@ feature 'BaseController' do
describe 'GET #verify_user_admin' do
context 'when user is a guest' do
before(:each) do
sign_out
end
it 'redirects to sign in page' do
visit admin_conferences_path
expect(current_path).to eq new_user_session_path

View file

@ -27,6 +27,21 @@ feature Event do
sign_in organizer
end
scenario 'can preview a proposal if it is public', feature: true, js: true do
visit admin_conference_program_event_path(conference.short_title, @event)
expect(page).to have_selector(:link_or_button, 'Preview')
click_link 'Preview'
expect(current_path).to eq(conference_program_proposal_path(conference.short_title, @event.id))
end
scenario 'cannot preview a proposal if it is not public', feature: true, js: true do
event = create(:event, program: conference.program, title: 'Example Proposal')
event.public = false
event.save!
visit admin_conference_program_event_path(conference.short_title, event)
expect(page).to_not have_selector(:link_or_button, 'Preview')
end
scenario 'rejects a proposal', feature: true, js: true do
visit admin_conference_program_events_path(conference.short_title)
expect(page).to have_content 'Example Proposal'
@ -82,6 +97,7 @@ feature Event do
fill_in 'event_title', with: 'Example Proposal'
select('Example Event Type', from: 'event[event_type_id]')
fill_in 'event_abstract', with: 'Lorem ipsum abstract'
fill_in 'event_submission_text', with: 'Lorem ipsum submission'
click_button 'Submit Proposal'
page.find('#flash')
@ -123,6 +139,9 @@ feature Event do
fill_in 'event_abstract', with: 'Lorem ipsum abstract'
expect(page).to have_text('You have used 3 words')
fill_in 'event_submission_text', with: 'Lorem ipsum submission_text'
expect(page).to have_text('Submission description')
click_link 'Do you require something special?'
fill_in 'event_description', with: 'Lorem ipsum description'

View file

@ -79,7 +79,7 @@ describe ApplicationHelper, type: :helper do
end
end
describe 'navigation link titke text' do
describe 'navigation link title text' do
it 'should default to OSEM' do
ENV.delete('OSEM_NAME')
expect(nav_link_text(nil)).to match 'OSEM'

View file

@ -5,6 +5,7 @@ require 'spec_helper'
describe EventsHelper, type: :helper do
let(:conference) { create(:conference) }
let(:event) { create(:event_full, program: conference.program) }
let(:event_schedule) { create(:event_schedule) }
let(:my_vote) { 3 }
let(:max_rating) { 5 }
let(:fraction) { my_vote.to_s + '/' + max_rating.to_s }
@ -28,6 +29,27 @@ describe EventsHelper, type: :helper do
end
end
describe '#canceled_replacement_event_label' do
describe 'returns nothing' do
it "when the event isn't cancelled and is not a replacement" do
event.state = 'confirmed'
expect(canceled_replacement_event_label(event, nil, 'text-class')).to eq nil
end
it 'when the event is canceled' do
event.state = 'canceled'
expect(canceled_replacement_event_label(event, nil, 'test-class')).to eq '<span class="label label-danger test-class">CANCELED</span>'
end
it 'when the event is a replacement but is not canceled' do
event.state = 'confirmed'
allow(event_schedule).to receive(:replacement?) { true }
expect(canceled_replacement_event_label(event, event_schedule, 'tent-class')).to eq '<span class="label label-info tent-class">REPLACEMENT</span>'
end
end
end
describe '#rating_tooltip' do
let(:vote_count) { pluralize(event.voters.length, 'vote') }

View file

@ -23,7 +23,7 @@ describe Mailbot do
end
it 'assigns the email body' do
expect(mail.body).to eq 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit'
expect(mail.body).to include 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit'
end
it 'delivers the email' do

View file

@ -19,6 +19,7 @@
# require_registration :boolean
# start_time :datetime
# state :string default("new"), not null
# submission_text :text
# subtitle :string
# title :string not null
# week :integer
@ -110,6 +111,35 @@ describe Event do
end
end
describe '#submission_limit' do
before :each do
event.event_type.maximum_abstract_length = 3
event.event_type.minimum_abstract_length = 2
end
context 'is invalid' do
it 'when submission text is too long' do
event.submission_text = 'four too many words'
expect(event.valid?).to eq false
expect(event.errors[:submission_text]).to eq ['cannot have more than 3 words']
end
it 'when submission text is too short' do
event.submission_text = 'word'
expect(event.valid?).to eq false
expect(event.errors[:submission_text]).to eq ['cannot have less than 2 words']
end
end
context 'is valid' do
it 'when submission text is within limts' do
event.abstract = 'the magic three'
expect(event.valid?).to eq true
expect(event.errors.size).to eq 0
end
end
end
describe '#before_end_of_conference' do
context 'is invalid' do
it 'when event is created after the conference end_date, and returns an error message' do

View file

@ -19,6 +19,7 @@
# require_registration :boolean
# start_time :datetime
# state :string default("new"), not null
# submission_text :text
# subtitle :string
# title :string not null
# week :integer

View file

@ -88,6 +88,10 @@ module OmniauthMacros
# account is available for every supported omniauth provider.
# These must be identical to the ones in /config/environments/development.rb
# Remember to keep them in sync with development.rb
#
# Note that the method length check is disabled to allow for better formatting
# of the user params.
# rubocop:disable Metrics/MethodLength
def mock_auth_accounts
OmniAuth.config.mock_auth[:facebook] =
OmniAuth::AuthHash.new(
@ -164,4 +168,5 @@ module OmniauthMacros
}
)
end
# rubocop:enable Metrics/MethodLength
end