Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ jobs:
# with:
# project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
# coverage-reports: coverage/coverage.xml
- name: Upload Capybara Failure Screenshots
uses: actions/upload-artifact@v3
if: always()
with:
name: capybara-screenshots
path: tmp/capybara/
retention-days: 7
# - name: Upload Capybara Failure Screenshots
# uses: actions/upload-artifact@v4
# if: always()
# with:
# name: capybara-screenshots
# path: tmp/capybara/
# retention-days: 7
# - name: Publish code coverage
# run: |
# export GIT_BRANCH="${GITHUB_REF/refs\/heads\//}"
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def rescheduling_hint(affected_event_count)
# ==== Returns
# class hidden if conference is over
def hidden_if_conference_over(conference)
'hidden' if Date.today > conference.end_date
'hidden' if Time.zone.today > conference.end_date
end

# TODO-SNAPCON: Replace this with a search for a conference logo.
Expand Down
2 changes: 1 addition & 1 deletion app/models/cfp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def end_week
end_date.strftime('%W').to_i
end

def remaining_days(date = Date.today)
def remaining_days(date = Time.zone.today)
result = (end_date - date).to_i
result > 0 ? result : 0
end
Expand Down
6 changes: 3 additions & 3 deletions app/models/conference.rb
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ def get_registration_end_week
# * +false+ -> If the conference start date is in the past.
# * +true+ -> If the conference start date is in the future.
def pending?
start_date > Date.today
start_date > Time.zone.today
end

##
Expand Down Expand Up @@ -686,7 +686,7 @@ def self.get_event_state_line_colors
def self.write_event_distribution_to_db
week = DateTime.now.end_of_week

Conference.where('end_date > ?', Date.today).find_each do |conference|
Conference.where('end_date > ?', Time.zone.today).find_each do |conference|
result = {}
Event.state_machine.states.each do |state|
count = conference.program.events.where('state = ?', state.name).count
Expand Down Expand Up @@ -905,7 +905,7 @@ def get_events_per_week_by_state
end

# Actual week
this_week = Date.today.end_of_week.strftime('%W').to_i
this_week = Time.zone.today.end_of_week.strftime('%W').to_i
result['Confirmed'][this_week] = program.events.where('state = ?', :confirmed).count
result['Unconfirmed'][this_week] = program.events.where('state = ?', :unconfirmed).count
result['Submitted'] = program.events.select(:week).group(:week).count
Expand Down
2 changes: 1 addition & 1 deletion app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ def before_end_of_conference
return if submitter&.is_admin?

if program.conference&.end_date &&
(Date.today > program.conference.end_date)
(Time.zone.today > program.conference.end_date)
errors
.add(:created_at, "can't be after the conference end date!")
end
Expand Down
4 changes: 2 additions & 2 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ def for_registration(conference)

# scopes for user distributions
scope :recent, lambda {
where('last_sign_in_at > ?', Date.today - 3.months).where(is_disabled: false)
where('last_sign_in_at > ?', Time.zone.today - 3.months).where(is_disabled: false)
}
scope :unconfirmed, -> { where('confirmed_at IS NULL') }
scope :dead, -> { where('last_sign_in_at < ?', Date.today - 1.year) }
scope :dead, -> { where('last_sign_in_at < ?', Time.zone.today - 1.year) }

# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable,
Expand Down
6 changes: 3 additions & 3 deletions app/views/conference_registrations/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,13 @@
.col-md-12
- if @registration
.btn-group-vertical.pull-right
= link_to 'Edit your Registration', edit_conference_conference_registration_path(@conference.short_title), class: 'btn btn-success', disabled: @conference.end_date < Date.today
= link_to 'Edit your Registration', edit_conference_conference_registration_path(@conference.short_title), class: 'btn btn-success', disabled: @conference.end_date < Time.zone.today
- if @purchases.any?
= link_to 'Unregister', conference_conference_registration_path(@conference.short_title), method: :delete, class: 'btn btn-danger btn-xs',
data: { confirm: "Your ticket purchases won't be refunded. Are you sure you want to unregister?" }, disabled: @conference.end_date < Date.today
data: { confirm: "Your ticket purchases won't be refunded. Are you sure you want to unregister?" }, disabled: @conference.end_date < Time.zone.today
- else
= link_to 'Unregister', conference_conference_registration_path(@conference.short_title), method: :delete, class: 'btn btn-danger btn-xs',
data: { confirm: "You haven't purchased any ticket. Are you sure you want to unregister?" }, disabled: @conference.end_date < Date.today
data: { confirm: "You haven't purchased any ticket. Are you sure you want to unregister?" }, disabled: @conference.end_date < Time.zone.today
- else
= link_to 'Register', new_conference_conference_registration_path(@conference.short_title), class: 'btn btn-success btn-lg pull-right'

Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/admin/cfps_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'spec_helper'

describe Admin::CfpsController do
let!(:today) { Date.today }
let!(:today) { Time.zone.today }
let!(:conference) { create(:conference, start_date: today + 20.days, end_date: today + 30.days) }
let!(:organizer) { create(:organizer, resource: conference) }
let(:cfp) { create(:cfp, program: conference.program) }
Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/admin/conferences_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
conference.email_settings = create(:email_settings)
patch :update,
params: { id: conference.short_title,
conference: attributes_for(:conference, start_date: Date.today + 2.days,
end_date: Date.today + 4.days) }
conference: attributes_for(:conference, start_date: Time.zone.today + 2.days,
end_date: Time.zone.today + 4.days) }
conference.reload
allow(Mailbot).to receive(:conference_date_update_mail).and_return(mailer)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@
allow(mailer).to receive(:deliver)
conference.email_settings = create(:email_settings)
conference.registration_period = create(:registration_period,
start_date: Date.today,
end_date: Date.today + 2.days)
start_date: Time.zone.today,
end_date: Time.zone.today + 2.days)

patch :update, params: { conference_id: conference.short_title, registration_period:
attributes_for(:registration_period,
start_date: Date.today + 2.days,
end_date: Date.today + 4.days) }
start_date: Time.zone.today + 2.days,
end_date: Time.zone.today + 4.days) }
conference.reload
allow(Mailbot).to receive(:conference_registration_date_update_mail).and_return(mailer)
end
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/conferences.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
title { Faker::Book.title }
short_title { SecureRandom.urlsafe_base64(4) }
timezone { Faker::Address.time_zone }
start_date { Date.today }
start_date { Time.zone.today }
end_date { 6.days.from_now }
start_hour { 9 }
end_hour { 20 }
Expand Down
4 changes: 2 additions & 2 deletions spec/factories/tracks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
association :submitter, factory: :user
state { 'new' }
cfp_active { false }
start_date { Date.today }
end_date { Date.today }
start_date { Time.zone.today }
end_date { Time.zone.today }
room
relevance { Faker::Hipster.paragraph(sentence_count: 2) }
end
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
Quisque cursus facilisis consequat. Etiam volutpat ligula turpis, at
gravida.
EOS
last_sign_in_at { Date.today }
last_sign_in_at { Time.zone.today }
is_disabled { false }

# Called by every user creation
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/vdays.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#
FactoryBot.define do
factory :vday do
day { Date.today }
day { Time.zone.today }
description { 'Lorem Ipsum dolsum' }
conference
end
Expand Down
4 changes: 2 additions & 2 deletions spec/features/conference_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

select('(GMT+01:00) Berlin', from: 'conference[timezone]')

today = Date.today - 1
today = Time.zone.today - 1
page
.execute_script("$('#conference-start-datepicker').val('" +
"#{today.strftime('%d/%m/%Y')}')")
Expand Down Expand Up @@ -50,7 +50,7 @@
fill_in 'conference_title', with: 'New Con'
fill_in 'conference_short_title', with: 'NewCon'

day = Date.today + 10
day = Time.zone.today + 10
page
.execute_script("$('#conference-start-datepicker').val('" +
"#{day.strftime('%d/%m/%Y')}')")
Expand Down
4 changes: 2 additions & 2 deletions spec/features/registration_periods_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
# It is necessary to use bang version of let to build roles before user
let!(:conference) { create(:conference) }
let!(:organizer) { create(:organizer, email: 'admin@example.com', resource: conference) }
let(:start_date) { Date.today }
let(:end_date) { Date.today + 5 }
let(:start_date) { Time.zone.today }
let(:end_date) { Time.zone.today + 5 }

context 'as organizer' do
before do
Expand Down
8 changes: 4 additions & 4 deletions spec/features/versions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
end

it 'display changes in cfp', feature: true, versioning: true, js: true do
cfp.update(start_date: (Date.today + 1).strftime('%d/%m/%Y'),
end_date: (Date.today + 3).strftime('%d/%m/%Y'))
cfp.update(start_date: (Time.zone.today + 1).strftime('%d/%m/%Y'),
end_date: (Time.zone.today + 3).strftime('%d/%m/%Y'))
cfp_id = cfp.id
cfp.destroy

Expand All @@ -48,8 +48,8 @@

it 'display changes in registration_period', feature: true, versioning: true, js: true do
registration_period = create(:registration_period, conference: conference)
registration_period.update(start_date: (Date.today + 1).strftime('%d/%m/%Y'),
end_date: (Date.today + 3).strftime('%d/%m/%Y'))
registration_period.update(start_date: (Time.zone.today + 1).strftime('%d/%m/%Y'),
end_date: (Time.zone.today + 3).strftime('%d/%m/%Y'))
registration_period_id = registration_period.id
registration_period.destroy

Expand Down
22 changes: 11 additions & 11 deletions spec/models/cfp_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
describe Cfp do
subject { create(:cfp) }

let!(:conference) { create(:conference, end_date: Date.today) }
let!(:conference) { create(:conference, end_date: Time.zone.today) }
let!(:cfp) do
create(:cfp, cfp_type: 'events', start_date: Date.today - 2, end_date: Date.today - 1,
create(:cfp, cfp_type: 'events', start_date: Time.zone.today - 2, end_date: Time.zone.today - 1,
program_id: conference.program.id)
end

Expand All @@ -45,7 +45,7 @@

describe '.for_tracks' do
it 'returns the cfp for tracks when it exists' do
call_for_tracks = create(:cfp, cfp_type: 'tracks', program: conference.program, end_date: Date.today)
call_for_tracks = create(:cfp, cfp_type: 'tracks', program: conference.program, end_date: Time.zone.today)
expect(conference.program.cfps.for_tracks).to eq call_for_tracks
end

Expand All @@ -57,12 +57,12 @@
describe '#before_end_of_conference' do
describe 'fails to save cfp' do
it 'when cfp end_date is after conference end_date' do
cfp.end_date = Date.today + 1
cfp.end_date = Time.zone.today + 1
expect(cfp.valid?).to be false
end

it 'when cfp start_date is after conference end_date' do
cfp.start_date = Date.today + 1
cfp.start_date = Time.zone.today + 1
expect(cfp.valid?).to be false
end
end
Expand All @@ -80,7 +80,7 @@
end

it 'fails when cfp start_date is after cfp end_date' do
cfp.start_date = Date.today
cfp.start_date = Time.zone.today
expect(cfp.valid?).to be false
end
end
Expand All @@ -98,14 +98,14 @@

describe 'returns true' do
it 'when end_date changed' do
cfp.end_date = Date.today
cfp.end_date = Time.zone.today
expect(cfp.start_date_changed?).to be false
expect(cfp.end_date_changed?).to be true
expect(cfp.notify_on_cfp_date_update?).to be true
end

it 'when start_date changed' do
cfp.start_date = Date.today
cfp.start_date = Time.zone.today
expect(cfp.end_date_changed?).to be false
expect(cfp.start_date_changed?).to be true
expect(cfp.notify_on_cfp_date_update?).to be true
Expand All @@ -122,7 +122,7 @@
it 'when send_on_cfp_dates_updates is not set' do
conference.email_settings.send_on_cfp_dates_updated = false
conference.email_settings.save!
cfp.end_date = Date.today
cfp.end_date = Time.zone.today

expect(cfp.end_date_changed?).to be true
expect(cfp.notify_on_cfp_date_update?).to be false
Expand All @@ -131,7 +131,7 @@
it 'when cfp_dates_updates_subject is not set' do
conference.email_settings.cfp_dates_updated_subject = ''
conference.email_settings.save!
cfp.end_date = Date.today
cfp.end_date = Time.zone.today

expect(cfp.end_date_changed?).to be true
expect(cfp.notify_on_cfp_date_update?).to be false
Expand All @@ -140,7 +140,7 @@
it 'when cfp_dates_updates_template is not set' do
conference.email_settings.cfp_dates_updated_body = ''
conference.email_settings.save!
cfp.end_date = Date.today
cfp.end_date = Time.zone.today

expect(cfp.end_date_changed?).to be true
expect(cfp.notify_on_cfp_date_update?).to be false
Expand Down
Loading
Loading