From 7e5889545e536b682d2f60366bf7cd5e512da556 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Wed, 24 Feb 2021 02:50:03 -0800 Subject: [PATCH 01/16] add pronto to the gemfile --- Gemfile | 11 ++++++++--- Gemfile.lock | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 3fa33ff0..1cd982f1 100644 --- a/Gemfile +++ b/Gemfile @@ -115,8 +115,8 @@ end gem 'bootstrap3-datetimepicker-rails', '~> 4.17.47' # data tables -gem 'jquery-datatables' gem 'ajax-datatables-rails' +gem 'jquery-datatables' # for charts gem 'chartkick' @@ -141,9 +141,9 @@ gem 'rqrcode' gem 'axlsx', git: 'https://github.com/randym/axlsx.git' gem 'axlsx_rails' -gem 'sentry-ruby' -gem 'sentry-rails' gem 'sentry-delayed_job' +gem 'sentry-rails' +gem 'sentry-ruby' # to make links faster gem 'turbolinks' @@ -275,4 +275,9 @@ end group :development, :test do # as debugger gem 'byebug' + gem 'pry' + + gem 'pronto' + gem 'pronto-rubocop', require: false + gem 'pronto-flay', require: false end diff --git a/Gemfile.lock b/Gemfile.lock index fb64fb9b..574948c4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -184,6 +184,11 @@ GEM fastimage (2.1.4) feature (1.4.0) ffi (1.10.0) + flay (2.12.1) + erubis (~> 2.7.0) + path_expander (~> 1.0) + ruby_parser (~> 3.0) + sexp_processor (~> 4.0) font-awesome-rails (4.7.0.5) railties (>= 3.2, < 6.1) formatador (0.2.5) @@ -193,6 +198,9 @@ GEM formtastic (>= 3.0) geckodriver-helper (0.23.0) archive-zip (~> 0.7) + gitlab (4.17.0) + httparty (~> 0.18) + terminal-table (~> 1.5, >= 1.5.1) globalid (0.4.2) activesupport (>= 4.2.0) gravtastic (3.2.6) @@ -236,6 +244,9 @@ GEM htmlentities (4.3.4) http-cookie (1.0.3) domain_name (~> 0.5) + httparty (0.18.1) + mime-types (~> 3.0) + multi_xml (>= 0.5.2) i18n (1.8.9) concurrent-ruby (~> 1.0) i18n_data (0.8.0) @@ -320,6 +331,9 @@ GEM multi_json (~> 1.3) multi_xml (~> 0.5) rack (>= 1.2, < 3) + octokit (4.20.0) + faraday (>= 0.9) + sawyer (~> 0.8.0, >= 0.5.3) omniauth (1.9.1) hashie (>= 3.4.6) rack (>= 1.6.2, < 3) @@ -349,6 +363,7 @@ GEM parallel (1.18.0) parser (2.6.5.0) ast (~> 2.4.0) + path_expander (1.1.0) pdf-core (0.7.0) pdf-inspector (1.3.0) pdf-reader (>= 1.0, < 3.0.a) @@ -375,6 +390,20 @@ GEM rails (>= 3.1.0) prawn-table (0.2.2) prawn (>= 1.3.0, < 3.0.0) + pronto (0.11.0) + gitlab (~> 4.4, >= 4.4.0) + httparty (>= 0.13.7) + octokit (~> 4.7, >= 4.7.0) + rainbow (>= 2.2, < 4.0) + rexml (~> 3.2) + rugged (>= 0.23.0, < 1.1.0) + thor (>= 0.20.3, < 2.0) + pronto-flay (0.11.0) + flay (~> 2.8) + pronto (~> 0.11.0) + pronto-rubocop (0.11.1) + pronto (~> 0.11.0) + rubocop (>= 0.63.1, < 2.0) pry (0.10.4) coderay (~> 1.1.0) method_source (~> 0.8.1) @@ -463,6 +492,7 @@ GEM http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) + rexml (3.2.4) rolify (5.2.0) rqrcode (0.10.1) chunky_png (~> 1.0) @@ -509,6 +539,7 @@ GEM ruby_parser (3.11.0) sexp_processor (~> 4.9) rubyzip (1.3.0) + rugged (1.0.1) safe_yaml (1.0.4) sass (3.7.2) sass-listen (~> 4.0.0) @@ -524,6 +555,9 @@ GEM sassc (2.0.1) ffi (~> 1.9) rake + sawyer (0.8.2) + addressable (>= 2.3.5) + faraday (> 0.8, < 2.0) selectize-rails (0.12.6) selenium-webdriver (3.142.6) childprocess (>= 0.5, < 4.0) @@ -575,6 +609,8 @@ GEM stripe (> 5, < 6) sysexits (1.2.0) temple (0.8.0) + terminal-table (1.8.0) + unicode-display_width (~> 1.1, >= 1.1.1) thor (1.1.0) thread_safe (0.3.6) tilt (2.0.9) @@ -689,6 +725,10 @@ DEPENDENCIES piwik_analytics (~> 1.0.1) prawn-qrcode prawn-rails + pronto + pronto-flay + pronto-rubocop + pry puma (~> 3.0) rails (~> 5.2) rails-assets-bootstrap-markdown! From bdc4c454277f6b2536d256c8d9b97de870684002 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Wed, 24 Feb 2021 02:50:29 -0800 Subject: [PATCH 02/16] Try running rubocop via pronto in gh actions --- .github/workflows/pronto.yml | 22 ++++++++++++++++++++++ .rubocop.yml | 8 ++++++++ 2 files changed, 30 insertions(+) create mode 100644 .github/workflows/pronto.yml diff --git a/.github/workflows/pronto.yml b/.github/workflows/pronto.yml new file mode 100644 index 00000000..f4fee6a0 --- /dev/null +++ b/.github/workflows/pronto.yml @@ -0,0 +1,22 @@ +name: Pronto +on: [pull_request] + +jobs: + pronto: + + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + - run: | + git fetch --no-tags --prune --depth=10 origin +refs/heads/*:refs/remotes/origin/* + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + - name: Setup pronto + run: gem install pronto pronto-rubocop + - name: Run Pronto + run: pronto run -f github_status github_pr -c origin/${{ github.base_ref }} + env: + PRONTO_PULL_REQUEST_ID: ${{ github.event.pull_request.number }} + PRONTO_GITHUB_ACCESS_TOKEN: "${{ github.token }}" diff --git a/.rubocop.yml b/.rubocop.yml index bdb72694..552f3f78 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -15,6 +15,14 @@ AllCops: #################### Style ########################### +Style/CommentAnnotation: + keywords: + - TODO + - TODO (snapcon) + - OPTIMIZE + - HACK + - REVIEW + ##################### Metrics ################################## ##################### Rails ################################## From abe89ff130cae30d42dd687847fedbecff7caac3 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Wed, 24 Feb 2021 03:06:28 -0800 Subject: [PATCH 03/16] Pronto-haml and no linting in travis --- .github/workflows/pronto.yml | 4 ++-- .travis.yml | 1 - Gemfile | 3 ++- Gemfile.lock | 5 +++++ 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pronto.yml b/.github/workflows/pronto.yml index f4fee6a0..c835da94 100644 --- a/.github/workflows/pronto.yml +++ b/.github/workflows/pronto.yml @@ -10,11 +10,11 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - run: | - git fetch --no-tags --prune --depth=10 origin +refs/heads/*:refs/remotes/origin/* + git fetch --no-tags --prune --depth=150 origin +refs/heads/*:refs/remotes/origin/* - name: Setup Ruby uses: ruby/setup-ruby@v1 - name: Setup pronto - run: gem install pronto pronto-rubocop + run: gem install pronto pronto-rubocop pronto-haml pronto-flay - name: Run Pronto run: pronto run -f github_status github_pr -c origin/${{ github.base_ref }} env: diff --git a/.travis.yml b/.travis.yml index cd6683e6..6d3ac828 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,7 +39,6 @@ env: matrix: - TEST_SUITE=ability - TEST_SUITE=features - - TEST_SUITE=linters - TEST_SUITE=models - TEST_SUITE=controllers - TEST_SUITE=rest diff --git a/Gemfile b/Gemfile index 1cd982f1..c6da1286 100644 --- a/Gemfile +++ b/Gemfile @@ -278,6 +278,7 @@ group :development, :test do gem 'pry' gem 'pronto' - gem 'pronto-rubocop', require: false + gem 'pronto-haml', require: false gem 'pronto-flay', require: false + gem 'pronto-rubocop', require: false end diff --git a/Gemfile.lock b/Gemfile.lock index 574948c4..48194b80 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -401,6 +401,10 @@ GEM pronto-flay (0.11.0) flay (~> 2.8) pronto (~> 0.11.0) + pronto-haml (0.11.0) + haml_lint (~> 0.23) + pronto (~> 0.11.0) + rubocop (< 1.0) pronto-rubocop (0.11.1) pronto (~> 0.11.0) rubocop (>= 0.63.1, < 2.0) @@ -727,6 +731,7 @@ DEPENDENCIES prawn-rails pronto pronto-flay + pronto-haml pronto-rubocop pry puma (~> 3.0) From 004aeb7ab8453b379d9cffc64e3a05877d0685c0 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Wed, 24 Feb 2021 03:19:54 -0800 Subject: [PATCH 04/16] Attempt to fix workflow --- .github/workflows/pronto.yml | 6 ++++-- .rubocop.yml | 2 +- Gemfile | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pronto.yml b/.github/workflows/pronto.yml index c835da94..509dd017 100644 --- a/.github/workflows/pronto.yml +++ b/.github/workflows/pronto.yml @@ -13,8 +13,10 @@ jobs: git fetch --no-tags --prune --depth=150 origin +refs/heads/*:refs/remotes/origin/* - name: Setup Ruby uses: ruby/setup-ruby@v1 - - name: Setup pronto - run: gem install pronto pronto-rubocop pronto-haml pronto-flay + - name: Setup bundler # Install only the linters group. + run: bundle config --local set without default development test staging production + - name: Install pronto + run: bundle install - name: Run Pronto run: pronto run -f github_status github_pr -c origin/${{ github.base_ref }} env: diff --git a/.rubocop.yml b/.rubocop.yml index 552f3f78..0c3179a5 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -16,7 +16,7 @@ AllCops: #################### Style ########################### Style/CommentAnnotation: - keywords: + Keywords: - TODO - TODO (snapcon) - OPTIMIZE diff --git a/Gemfile b/Gemfile index c6da1286..fbb19a05 100644 --- a/Gemfile +++ b/Gemfile @@ -272,7 +272,7 @@ group :test do gem 'pdf-inspector', require: "pdf/inspector" end -group :development, :test do +group :development, :test, :linters do # as debugger gem 'byebug' gem 'pry' @@ -281,4 +281,5 @@ group :development, :test do gem 'pronto-haml', require: false gem 'pronto-flay', require: false gem 'pronto-rubocop', require: false + gem 'rubocop-rspec', require: false end From c6ebe0f0bf6521d0fec668210775e1a8d3745d09 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Wed, 24 Feb 2021 03:23:14 -0800 Subject: [PATCH 05/16] ugh, try to fix github actions install --- .github/workflows/pronto.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pronto.yml b/.github/workflows/pronto.yml index 509dd017..7b68e7d9 100644 --- a/.github/workflows/pronto.yml +++ b/.github/workflows/pronto.yml @@ -14,9 +14,9 @@ jobs: - name: Setup Ruby uses: ruby/setup-ruby@v1 - name: Setup bundler # Install only the linters group. - run: bundle config --local set without default development test staging production + run: bundle config --global set without default development test staging production - name: Install pronto - run: bundle install + run: bundle install --without default development test staging production - name: Run Pronto run: pronto run -f github_status github_pr -c origin/${{ github.base_ref }} env: From 13aa7db90d00b174f42b96139405424a246209ec Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Wed, 24 Feb 2021 03:32:19 -0800 Subject: [PATCH 06/16] use TODO-SNAPCON for the comment tag since rubocop is not flexible enough --- .rubocop.yml | 2 +- config/initializers/devise.rb | 2 +- spec/controllers/admin/conferences_controller_spec.rb | 6 +++--- spec/features/commercials_spec.rb | 2 +- spec/features/organizer_ability_spec.rb | 2 +- spec/features/versions_spec.rb | 4 ++-- spec/models/registration_spec.rb | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 0c3179a5..bb2c0778 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -17,8 +17,8 @@ AllCops: Style/CommentAnnotation: Keywords: + - TODO-SNAPCON - TODO - - TODO (snapcon) - OPTIMIZE - HACK - REVIEW diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index ab9a2636..0ddb8415 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -14,7 +14,7 @@ Devise.setup do |config| name: 'google', scope: 'email' - # TODO (snapcon): This ought to be configurable. Use OSEM_DISCOURSE_KEY? + # TODO-SNAPCON: This ought to be configurable. Use OSEM_DISCOURSE_KEY? config.omniauth :discourse, sso_url: 'https://forum.snap.berkeley.edu/session/sso_provider', sso_secret: ENV['OSEM_DISCOURSE_SECRET'] diff --git a/spec/controllers/admin/conferences_controller_spec.rb b/spec/controllers/admin/conferences_controller_spec.rb index 9c317476..43d45573 100644 --- a/spec/controllers/admin/conferences_controller_spec.rb +++ b/spec/controllers/admin/conferences_controller_spec.rb @@ -98,7 +98,7 @@ describe Admin::ConferencesController do expect(response).to render_template :show end - # TODO (snapcon): This is currently disabled due to slow performance. + # TODO-SNAPCON: This is currently disabled due to slow performance. skip 'assigns conference withdrawn events distribution to event_type_distribution_withdrawn' do conference create(:event, program: conference.program) @@ -122,7 +122,7 @@ describe Admin::ConferencesController do expect(assigns(:event_type_distribution_withdrawn)).to eq(result) end - # TODO (snapcon): This is currently disabled due to slow performance. + # TODO-SNAPCON: This is currently disabled due to slow performance. skip 'assigns conference withdrawn difficulty level distribution to difficulty_levels_distribution_withdrawn' do conference create(:event, program: conference.program) @@ -146,7 +146,7 @@ describe Admin::ConferencesController do expect(assigns(:difficulty_levels_distribution_withdrawn)).to eq(result) end - # TODO (snapcon): This is currently disabled due to slow performance. + # TODO-SNAPCON: This is currently disabled due to slow performance. skip 'assigns conference withdrawn track distribution to tracks_distribution_withdrawn' do conference create(:event, program: conference.program) diff --git a/spec/features/commercials_spec.rb b/spec/features/commercials_spec.rb index 46cf8906..13c46f3b 100644 --- a/spec/features/commercials_spec.rb +++ b/spec/features/commercials_spec.rb @@ -68,7 +68,7 @@ feature Commercial do end scenario 'does not add an invalid commercial of an event', feature: true, js: true do - # TODO (snapcon) + # TODO-SNAPCON skip("Snap!Con allows all materials to be saved.") visit edit_conference_program_proposal_path(conference.short_title, event.id) click_link 'Materials' diff --git a/spec/features/organizer_ability_spec.rb b/spec/features/organizer_ability_spec.rb index 701d7446..3ddc4203 100644 --- a/spec/features/organizer_ability_spec.rb +++ b/spec/features/organizer_ability_spec.rb @@ -61,7 +61,7 @@ feature 'Has correct abilities' do expect(page).to_not have_link('New Conference', href: '/admin/conferences/new') visit admin_conference_path(other_conference.short_title) - # TODO (snapcon): This conference already seems to have a venue. + # TODO-SNAPCON: This conference already seems to have a venue. # expect(page).to have_link('Add venue', href: "/admin/conferences/#{other_conference.short_title}/venue/new") visit edit_admin_conference_path(conference.short_title) diff --git a/spec/features/versions_spec.rb b/spec/features/versions_spec.rb index 4b786326..17820104 100644 --- a/spec/features/versions_spec.rb +++ b/spec/features/versions_spec.rb @@ -231,7 +231,7 @@ feature 'Version' do expect(page).to have_text("Someone (probably via the console) deleted difficulty level Expert with ID #{difficulty_level_id} in conference #{conference.short_title}") end - # TODO (snapcon): Figure out why this is failing!! + # TODO-SNAPCON: Figure out why this is failing!! skip 'display changes in splashpages', feature: true, versioning: true, js: true do visit admin_conference_splashpage_path(conference.short_title) click_link 'Create Splashpage' @@ -300,7 +300,7 @@ feature 'Version' do visit admin_conference_program_event_path(conference.short_title, event_with_commercial) click_link 'History' - # TODO (snapcon): Figure out why this is here... + # TODO-SNAPCON: Figure out why this is here... # expect(page).to have_text('Someone (probably via the console) created new commercial') visit admin_conference_program_event_path(conference.short_title, event_without_commercial) click_link 'History' diff --git a/spec/models/registration_spec.rb b/spec/models/registration_spec.rb index 9d6273ce..45813810 100644 --- a/spec/models/registration_spec.rb +++ b/spec/models/registration_spec.rb @@ -45,7 +45,7 @@ describe Registration do describe 'association' do it { is_expected.to belong_to(:user) } - # TODO (snapcon): This fails because conference is nil, but obviously this works... + # TODO-SNAPCON: This fails because conference is nil, but obviously this works... # it { is_expected.to belong_to(:conference) } it { is_expected.to have_and_belong_to_many(:qanswers) } it { is_expected.to have_and_belong_to_many(:vchoices) } From 90ebb4fd76737f517fb4896d19a25546a68e629a Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Wed, 24 Feb 2021 03:36:41 -0800 Subject: [PATCH 07/16] gem file notes --- Gemfile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Gemfile b/Gemfile index fbb19a05..77ac5a7e 100644 --- a/Gemfile +++ b/Gemfile @@ -225,11 +225,7 @@ gem 'dalli' group :development do # to launch specs when files are modified gem 'guard-rspec' - gem 'haml_lint' gem 'spring-commands-rspec' - # for static code analisys - gem 'rubocop', require: false - gem 'rubocop-rspec' # to open mails gem 'letter_opener' # view mail at /letter_opener/ @@ -240,6 +236,7 @@ group :development do gem 'web-console' # as development database gem 'sqlite3' + # prepend models with db schema gem 'annotate' end @@ -277,9 +274,12 @@ group :development, :test, :linters do gem 'byebug' gem 'pry' - gem 'pronto' - gem 'pronto-haml', require: false + # Linters and static analysis. + gem 'pronto', require: false gem 'pronto-flay', require: false + gem 'pronto-haml', require: false gem 'pronto-rubocop', require: false gem 'rubocop-rspec', require: false + + gem 'haml-lint', require: false end From 1ca72dcf744536dad6135122b264dfd84ba0dd68 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Wed, 24 Feb 2021 09:34:04 -0800 Subject: [PATCH 08/16] Attempt to fixup logo specs --- Gemfile.lock | 5 +++-- spec/helpers/application_helper_spec.rb | 9 +++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 48194b80..241cbb00 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -221,6 +221,8 @@ GEM haml (5.0.4) temple (>= 0.8.0) tilt + haml-lint (0.999.999) + haml_lint haml-rails (1.0.0) actionpack (>= 4.0.1) activesupport (>= 4.0.1) @@ -703,8 +705,8 @@ DEPENDENCIES geckodriver-helper gravtastic guard-rspec + haml-lint haml-rails - haml_lint iso-639 jquery-datatables jquery-rails @@ -758,7 +760,6 @@ DEPENDENCIES rqrcode rspec-activemodel-mocks rspec-rails - rubocop rubocop-rspec ruby-oembed sass-rails (>= 4.0.2) diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index edadc869..403c797d 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -65,19 +65,16 @@ describe ApplicationHelper, type: :helper do describe 'navigation title link' do it 'should default to OSEM' do ENV.delete('OSEM_NAME') - # TODO:Snap!Con: expect(nav_root_link_for(nil)).to match 'OSEM' - expect(nav_root_link_for(nil)).to match image_tag('snapcon_logo.png') + expect(nav_root_link_for(nil)).to include image_tag('snapcon_logo.png', alt: 'OSEM') end it 'should use the environment variable' do ENV['OSEM_NAME'] = Faker::Company.name + "'" - # expect(nav_root_link_for(nil)).to match h(ENV['OSEM_NAME']) - expect(nav_root_link_for(nil)).to match image_tag('snapcon_logo.png') + expect(nav_root_link_for(nil)).to include image_tag('snapcon_logo.png', alt: ENV['OSEM_NAME']) end it 'should use the conference organization name' do - # expect(nav_root_link_for(conference)).to match h(conference.organization.name) - expect(nav_root_link_for(nil)).to match image_tag('snapcon_logo.png') + expect(nav_root_link_for(nil)).to include image_tag('snapcon_logo.png', alt: conference.title) end end end From 2b2745ade926ee5f4924e7373394c96fd3b8eb88 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Wed, 24 Feb 2021 09:47:56 -0800 Subject: [PATCH 09/16] run rubocp --fix --- app/controllers/admin/reports_controller.rb | 2 +- app/controllers/application_controller.rb | 28 +++--- .../conference_registrations_controller.rb | 2 +- app/controllers/users_controller.rb | 2 +- app/datatables/user_datatable.rb | 1 - app/helpers/application_helper.rb | 4 +- app/helpers/conference_helper.rb | 1 + app/helpers/events_helper.rb | 24 ++--- app/helpers/format_helper.rb | 10 +-- app/models/conference.rb | 2 +- app/models/event.rb | 1 - app/models/event_user.rb | 2 +- app/models/payment.rb | 2 +- app/models/registration.rb | 2 +- app/models/ticket_purchase.rb | 1 + app/models/user.rb | 5 +- config/initializers/devise.rb | 2 +- config/puma.rb | 4 +- lib/tasks/auto_annotate_models.rake | 90 +++++++++---------- .../admin/tickets_controller_spec.rb | 4 +- .../organization_admin_ability_spec.rb | 2 +- spec/features/organizer_ability_spec.rb | 2 +- spec/helpers/format_helper_spec.rb | 10 +-- spec/models/conference_spec.rb | 2 +- spec/support/external_request.rb | 4 +- spec/support/omniauth_macros.rb | 2 - 26 files changed, 104 insertions(+), 107 deletions(-) diff --git a/app/controllers/admin/reports_controller.rb b/app/controllers/admin/reports_controller.rb index 5d9eabf4..a4eb9f60 100644 --- a/app/controllers/admin/reports_controller.rb +++ b/app/controllers/admin/reports_controller.rb @@ -9,7 +9,7 @@ module Admin def index @events = Event.accessible_by(current_ability).where(program: @program, - state: [:confirmed, :unconfirmed]) + state: [:confirmed, :unconfirmed]) @events_commercials = Commercial.where(commercialable_type: 'Event', commercialable_id: @events.pluck(:id)) @events_missing_commercial = @events.where.not(id: @events_commercials.pluck(:commercialable_id)) @events_with_requirements = @events.where.not(description: ['', nil]) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 7b868e83..0a4eca46 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -10,21 +10,21 @@ class ApplicationController < ActionController::Base check_authorization unless: :devise_controller? skip_authorization_check if: - def store_location - # store last url - this is needed for post-login redirect to whatever the user last visited. - return unless request.get? + def store_location + # store last url - this is needed for post-login redirect to whatever the user last visited. + return unless request.get? - if (request.path != '/accounts/sign_in' && - request.path != '/accounts/sign_up' && - request.path != '/accounts/password/new' && - request.path != '/accounts/password/edit' && - request.path != '/accounts/confirmation' && - request.path != '/accounts/sign_out' && - request.path != '/users/ichain_registration/ichain_sign_up' && - !request.path.starts_with?(Devise.ichain_base_url) && - !request.xhr?) # don't store ajax calls - session[:return_to] = request.fullpath - end + if (request.path != '/accounts/sign_in' && + request.path != '/accounts/sign_up' && + request.path != '/accounts/password/new' && + request.path != '/accounts/password/edit' && + request.path != '/accounts/confirmation' && + request.path != '/accounts/sign_out' && + request.path != '/users/ichain_registration/ichain_sign_up' && + !request.path.starts_with?(Devise.ichain_base_url) && + !request.xhr?) # don't store ajax calls + session[:return_to] = request.fullpath + end end def after_sign_in_path_for(_resource) diff --git a/app/controllers/conference_registrations_controller.rb b/app/controllers/conference_registrations_controller.rb index fd6dd14c..8d4ae8a1 100644 --- a/app/controllers/conference_registrations_controller.rb +++ b/app/controllers/conference_registrations_controller.rb @@ -66,7 +66,7 @@ class ConferenceRegistrationsController < ApplicationController end elsif @conference.registration_ticket_required? && !current_user.supports?(@conference) redirect_to conference_tickets_path(@conference.short_title), - error: 'You must buy a registration ticket before registering.' + error: 'You must buy a registration ticket before registering.' else flash.now[:error] = "Could not create your registration for #{@conference.title}: "\ "#{@registration.errors.full_messages.join('. ')}." diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index e69a52aa..0bf44f49 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -27,7 +27,7 @@ class UsersController < ApplicationController def user_params params.require(:user).permit(:name, :biography, :nickname, :affiliation, - :picture, :picture_cache) + :picture, :picture_cache) end # Somewhat of a hack: users/current/edit diff --git a/app/datatables/user_datatable.rb b/app/datatables/user_datatable.rb index c21aa2ff..45200ebb 100644 --- a/app/datatables/user_datatable.rb +++ b/app/datatables/user_datatable.rb @@ -1,4 +1,3 @@ - # frozen_string_literal: true class UserDatatable < AjaxDatatablesRails::Base diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 300b91c9..b65fcdd4 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -201,8 +201,8 @@ module ApplicationHelper def nav_link_text(conference) conference.try(:organization).try(:name) || - ENV['OSEM_NAME'] || - 'OSEM' + ENV['OSEM_NAME'] || + 'OSEM' end # returns the url to be used for logo on basis of sponsorship level position diff --git a/app/helpers/conference_helper.rb b/app/helpers/conference_helper.rb index 39316f9f..85ead390 100644 --- a/app/helpers/conference_helper.rb +++ b/app/helpers/conference_helper.rb @@ -24,6 +24,7 @@ module ConferenceHelper def short_ticket_description(ticket) return unless ticket.description + markdown(ticket.description.split("\n").first&.strip) end end diff --git a/app/helpers/events_helper.rb b/app/helpers/events_helper.rb index 0c135c32..c920c16f 100644 --- a/app/helpers/events_helper.rb +++ b/app/helpers/events_helper.rb @@ -164,7 +164,7 @@ module EventsHelper conference_id, event.id, event.send(attribute), - url: admin_conference_program_event_path( + url: admin_conference_program_event_path( conference_id, event, event: { attribute => nil } @@ -183,7 +183,7 @@ module EventsHelper if current_user.roles.where(id: conference.roles).any? # Show Pre-Event links for any memeber of the conference team. link_to("Join Live Event #{'(Admin link)' unless is_now}", - event.url, target: '_blank') + event.url, target: '_blank') elsif current_user.registered_to_event?(conference) if is_now link_to('Join Live Event', event.url, target: '_blank') @@ -206,12 +206,12 @@ module EventsHelper start_timestamp = calendar_timestamp(event_schedule.start_time, conference.timezone) end_timestamp = calendar_timestamp(event_schedule.end_time, conference.timezone) event_details = { - action: 'TEMPLATE', - text: "#{event.title} at #{conference.title}", - details: calendar_event_text(event, event_schedule, conference), + action: 'TEMPLATE', + text: "#{event.title} at #{conference.title}", + details: calendar_event_text(event, event_schedule, conference), location: "#{event.room.name} #{event.url}", - dates: "#{start_timestamp}/#{end_timestamp}", - ctz: event_schedule.timezone + dates: "#{start_timestamp}/#{end_timestamp}", + ctz: event_schedule.timezone } "#{calendar_base}?#{event_details.to_param}" end @@ -220,13 +220,13 @@ module EventsHelper def calendar_event_text(event, event_schedule, conference) <<~TEXT - #{conference.title} - #{event.title} - #{event_schedule.start_time.strftime("%Y %B %e - %H:%M")} #{event_schedule.timezone} + #{conference.title} - #{event.title} + #{event_schedule.start_time.strftime("%Y %B %e - %H:%M")} #{event_schedule.timezone} - More Info: #{conference_program_proposal_url(conference, event)} - Join: #{event.url} + More Info: #{conference_program_proposal_url(conference, event)} + Join: #{event.url} - #{truncate(event.abstract, length: 200)} + #{truncate(event.abstract, length: 200)} TEXT end diff --git a/app/helpers/format_helper.rb b/app/helpers/format_helper.rb index 6aa198d6..418fa93a 100644 --- a/app/helpers/format_helper.rb +++ b/app/helpers/format_helper.rb @@ -184,12 +184,12 @@ module FormatHelper return '' if text.nil? options = { - autolink: true, + autolink: true, space_after_headers: true, - tables: true, - strikethrough: true, - footnotes: true, - superscript: true + tables: true, + strikethrough: true, + footnotes: true, + superscript: true } markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML.new(escape_html: escape_html), options) markdown.render(text).html_safe diff --git a/app/models/conference.rb b/app/models/conference.rb index 3bf67dd2..3e197280 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -86,7 +86,7 @@ class Conference < ApplicationRecord has_many :highlighted_events, -> { where(state: :confirmed, is_highlight: true) }, through: :program, - source: :events + source: :events has_many :event_types, through: :program has_many :surveys, as: :surveyable, dependent: :destroy do diff --git a/app/models/event.rb b/app/models/event.rb index 4978fbf9..0370926b 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -310,7 +310,6 @@ class Event < ApplicationRecord event_schedules.find_by(schedule_id: selected_schedule_id).try(:happening_now?) end - ## # Returns true or false, if the event is already over or not # diff --git a/app/models/event_user.rb b/app/models/event_user.rb index 3bf3cb2b..e468f793 100644 --- a/app/models/event_user.rb +++ b/app/models/event_user.rb @@ -14,7 +14,7 @@ # class EventUser < ApplicationRecord ROLES = [%w[Speaker speaker], %w[Submitter submitter], %w[Moderator moderator], - %w[Volunteer volunteer]] + %w[Volunteer volunteer]] belongs_to :event, touch: true belongs_to :user diff --git a/app/models/payment.rb b/app/models/payment.rb index 559faf54..480e84b2 100644 --- a/app/models/payment.rb +++ b/app/models/payment.rb @@ -37,7 +37,7 @@ class Payment < ApplicationRecord end def stripe_description - #"ticket purchases(#{user.username})" + # "ticket purchases(#{user.username})" "Tickets for #{conference.title} #{user.name} #{user.email}" end diff --git a/app/models/registration.rb b/app/models/registration.rb index 944d0e65..3906f558 100644 --- a/app/models/registration.rb +++ b/app/models/registration.rb @@ -85,7 +85,7 @@ class Registration < ApplicationRecord def user_has_registration_ticket return if conference.registration_ticket_required? && - TicketPurchase.where(user: user, ticket: conference.registration_tickets).paid.any? + TicketPurchase.where(user: user, ticket: conference.registration_tickets).paid.any? errors.add(:base, 'You must purchase a registration ticket before registering') if TicketPurchase.where(user: user, ticket: conference.registration_tickets).unpaid.any? diff --git a/app/models/ticket_purchase.rb b/app/models/ticket_purchase.rb index 6f598c8e..46a5befe 100644 --- a/app/models/ticket_purchase.rb +++ b/app/models/ticket_purchase.rb @@ -122,6 +122,7 @@ end def count_purchased_registration_tickets(conference, purchases) # TODO: WHAT CAUSED THIS??? return 0 unless purchases + conference.tickets.for_registration.inject(0) do |sum, registration_ticket| sum + purchases[registration_ticket.id.to_s].to_i end diff --git a/app/models/user.rb b/app/models/user.rb index a63ebe18..147c2fe6 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -101,9 +101,8 @@ class User < ApplicationRecord [:database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :confirmable, :omniauthable, - omniauth_providers: [:suse, :google, :facebook, :github, :discourse] + omniauth_providers: [:suse, :google, :facebook, :github, :discourse]] # omniauth_providers: [:google, :discourse] - ] end devise(*devise_modules) @@ -206,6 +205,7 @@ class User < ApplicationRecord # Partials should *not* directly call `gravatar_url` def profile_picture(opts = {}) return gravatar_url(opts) unless picture.present? + size = (opts[:size] || 0).to_i if size < 50 picture.tiny.url @@ -346,7 +346,6 @@ class User < ApplicationRecord events.where(program_id: conference.program.id, 'event_users.event_role': 'volunteer') end - def self.empty? User.count == 1 && User.first.email == 'deleted@localhost.osem' end diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 0ddb8415..26fca25b 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -16,7 +16,7 @@ Devise.setup do |config| # TODO-SNAPCON: This ought to be configurable. Use OSEM_DISCOURSE_KEY? config.omniauth :discourse, - sso_url: 'https://forum.snap.berkeley.edu/session/sso_provider', + sso_url: 'https://forum.snap.berkeley.edu/session/sso_provider', sso_secret: ENV['OSEM_DISCOURSE_SECRET'] config.omniauth :facebook, diff --git a/config/puma.rb b/config/puma.rb index ed6fe45b..0d3b583f 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -46,8 +46,8 @@ end lowlevel_error_handler do |ex, env| Sentry.capture_exception( ex, - :message => ex.message, - :extra => { :puma => env }, + :message => ex.message, + :extra => { :puma => env }, :transaction => "Puma" ) # note the below is just a Rack response diff --git a/lib/tasks/auto_annotate_models.rake b/lib/tasks/auto_annotate_models.rake index e96283ea..3f1cf4e1 100644 --- a/lib/tasks/auto_annotate_models.rake +++ b/lib/tasks/auto_annotate_models.rake @@ -7,51 +7,51 @@ if Rails.env.development? # You can override any of these by setting an environment variable of the # same name. Annotate.set_defaults( - 'active_admin' => 'false', - 'additional_file_patterns' => [], - 'routes' => 'false', - 'models' => 'true', - 'position_in_routes' => 'before', - 'position_in_class' => 'before', - 'position_in_test' => 'before', - 'position_in_fixture' => 'before', - 'position_in_factory' => 'before', - 'position_in_serializer' => 'before', - 'show_foreign_keys' => 'true', - 'show_complete_foreign_keys' => 'false', - 'show_indexes' => 'true', - 'simple_indexes' => 'false', - 'model_dir' => 'app/models', - 'root_dir' => '', - 'include_version' => 'false', - 'require' => '', - 'exclude_tests' => 'false', - 'exclude_fixtures' => 'false', - 'exclude_factories' => 'false', - 'exclude_serializers' => 'false', - 'exclude_scaffolds' => 'true', - 'exclude_controllers' => 'true', - 'exclude_helpers' => 'true', - 'exclude_sti_subclasses' => 'false', - 'ignore_model_sub_dir' => 'false', - 'ignore_columns' => nil, - 'ignore_routes' => nil, - 'ignore_unknown_models' => 'false', - 'hide_limit_column_types' => 'integer,bigint,boolean', - 'hide_default_column_types' => 'json,jsonb,hstore', - 'skip_on_db_migrate' => 'false', - 'format_bare' => 'true', - 'format_rdoc' => 'false', - 'format_yard' => 'false', - 'format_markdown' => 'false', - 'sort' => 'false', - 'force' => 'false', - 'frozen' => 'false', - 'classified_sort' => 'true', - 'trace' => 'false', - 'wrapper_open' => nil, - 'wrapper_close' => nil, - 'with_comment' => 'true' + 'active_admin' => 'false', + 'additional_file_patterns' => [], + 'routes' => 'false', + 'models' => 'true', + 'position_in_routes' => 'before', + 'position_in_class' => 'before', + 'position_in_test' => 'before', + 'position_in_fixture' => 'before', + 'position_in_factory' => 'before', + 'position_in_serializer' => 'before', + 'show_foreign_keys' => 'true', + 'show_complete_foreign_keys' => 'false', + 'show_indexes' => 'true', + 'simple_indexes' => 'false', + 'model_dir' => 'app/models', + 'root_dir' => '', + 'include_version' => 'false', + 'require' => '', + 'exclude_tests' => 'false', + 'exclude_fixtures' => 'false', + 'exclude_factories' => 'false', + 'exclude_serializers' => 'false', + 'exclude_scaffolds' => 'true', + 'exclude_controllers' => 'true', + 'exclude_helpers' => 'true', + 'exclude_sti_subclasses' => 'false', + 'ignore_model_sub_dir' => 'false', + 'ignore_columns' => nil, + 'ignore_routes' => nil, + 'ignore_unknown_models' => 'false', + 'hide_limit_column_types' => 'integer,bigint,boolean', + 'hide_default_column_types' => 'json,jsonb,hstore', + 'skip_on_db_migrate' => 'false', + 'format_bare' => 'true', + 'format_rdoc' => 'false', + 'format_yard' => 'false', + 'format_markdown' => 'false', + 'sort' => 'false', + 'force' => 'false', + 'frozen' => 'false', + 'classified_sort' => 'true', + 'trace' => 'false', + 'wrapper_open' => nil, + 'wrapper_close' => nil, + 'with_comment' => 'true' ) end diff --git a/spec/controllers/admin/tickets_controller_spec.rb b/spec/controllers/admin/tickets_controller_spec.rb index 6f09070c..d2efb9ee 100644 --- a/spec/controllers/admin/tickets_controller_spec.rb +++ b/spec/controllers/admin/tickets_controller_spec.rb @@ -69,8 +69,8 @@ describe Admin::TicketsController do it 'creates new ticket' do expect do post :create, params: { - ticket: attributes_for(:ticket), - conference_id: conference + ticket: attributes_for(:ticket), + conference_id: conference } end.to change{ conference.tickets.count }.from(ticket_count).to(ticket_count + 1) end diff --git a/spec/features/organization_admin_ability_spec.rb b/spec/features/organization_admin_ability_spec.rb index 3e36db94..c122f789 100644 --- a/spec/features/organization_admin_ability_spec.rb +++ b/spec/features/organization_admin_ability_spec.rb @@ -193,7 +193,7 @@ feature 'Has correct abilities' do other_user = create(:user) ticket = conference.registration_tickets.first create(:paid_ticket_purchase, - user: other_user, ticket: ticket, quantity: 1, conference: conference) + user: other_user, ticket: ticket, quantity: 1, conference: conference) create(:registration, user: other_user, conference: conference) visit edit_admin_conference_registration_path(conference.short_title, conference.registrations.first) expect(current_path).to eq(edit_admin_conference_registration_path(conference.short_title, conference.registrations.first)) diff --git a/spec/features/organizer_ability_spec.rb b/spec/features/organizer_ability_spec.rb index 3ddc4203..3683a7aa 100644 --- a/spec/features/organizer_ability_spec.rb +++ b/spec/features/organizer_ability_spec.rb @@ -200,7 +200,7 @@ feature 'Has correct abilities' do other_user = create(:user) ticket = conference.registration_tickets.first create(:paid_ticket_purchase, - user: other_user, ticket: ticket, quantity: 1, conference: conference) + user: other_user, ticket: ticket, quantity: 1, conference: conference) create(:registration, user: other_user, conference: conference) visit edit_admin_conference_registration_path(conference.short_title, conference.registrations.first) expect(current_path).to eq(edit_admin_conference_registration_path(conference.short_title, conference.registrations.first)) diff --git a/spec/helpers/format_helper_spec.rb b/spec/helpers/format_helper_spec.rb index 9d611ccb..cd1940e0 100644 --- a/spec/helpers/format_helper_spec.rb +++ b/spec/helpers/format_helper_spec.rb @@ -13,12 +13,12 @@ describe FormatHelper, type: :helper do expect(Redcarpet::Markdown).to receive(:new) .with( Redcarpet::Render::HTML, - autolink: true, + autolink: true, space_after_headers: true, - tables: true, - strikethrough: true, - footnotes: true, - superscript: true + tables: true, + strikethrough: true, + footnotes: true, + superscript: true ) .and_call_original diff --git a/spec/models/conference_spec.rb b/spec/models/conference_spec.rb index 14b396e1..f73bd879 100755 --- a/spec/models/conference_spec.rb +++ b/spec/models/conference_spec.rb @@ -36,7 +36,7 @@ # # index_conferences_on_organization_id (organization_id) # -#!/bin/env ruby +# !/bin/env ruby require 'spec_helper' describe Conference do diff --git a/spec/support/external_request.rb b/spec/support/external_request.rb index 8109a624..b9a61e85 100644 --- a/spec/support/external_request.rb +++ b/spec/support/external_request.rb @@ -35,6 +35,6 @@ def mock_commercial_request end def mock_image_request - WebMock.stub_request(:post, "https://api.cloudinary.com/v1_1/snapcon/image/destroy"). - to_return(status: 200, body: {}.to_json, headers: {}) + WebMock.stub_request(:post, "https://api.cloudinary.com/v1_1/snapcon/image/destroy") + .to_return(status: 200, body: {}.to_json, headers: {}) end diff --git a/spec/support/omniauth_macros.rb b/spec/support/omniauth_macros.rb index 11077f34..25c6f039 100644 --- a/spec/support/omniauth_macros.rb +++ b/spec/support/omniauth_macros.rb @@ -15,8 +15,6 @@ module OmniauthMacros ENV['OSEM_DISCOURSE_KEY'] = 'test key discourse' ENV['OSEM_DISCOURSE_SECRET'] = 'test secret discourse' - - def mock_auth_new_user OmniAuth.config.mock_auth[:google] = OmniAuth::AuthHash.new( From 92f23a519ee5c80daae034665f7ee5a3a4cdffaa Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Wed, 24 Feb 2021 12:53:01 -0800 Subject: [PATCH 10/16] Fix outdated datatables spec --- spec/datatables/user_datatable_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/datatables/user_datatable_spec.rb b/spec/datatables/user_datatable_spec.rb index 8ca12e6a..90327233 100644 --- a/spec/datatables/user_datatable_spec.rb +++ b/spec/datatables/user_datatable_spec.rb @@ -8,7 +8,7 @@ describe UserDatatable do end let(:data_cols) do - [:id, :confirmed_at, :email, :name, :attended, :roles, :view_url, :edit_url, :DT_RowId] + [:id, :confirmed_at, :email, :name, :username, :attended, :roles, :view_url, :edit_url, :DT_RowId] end let(:view) do view = double( From 005aebd936a328a8f010934e874ac1e16b2833d2 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Wed, 24 Feb 2021 20:07:12 -0800 Subject: [PATCH 11/16] Minor app helper tests --- app/helpers/application_helper.rb | 3 ++- spec/helpers/application_helper_spec.rb | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b65fcdd4..90b3fa2b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -188,7 +188,8 @@ module ApplicationHelper 'hidden' if Date.today > conference.end_date end - # TODO:Snap!Con: Replace this with a search for a conference logo. + # TODO-SNAPCON: Replace this with a search for a conference logo. + # TODO: If conference is defined, the alt text should be conference name. def nav_root_link_for(conference = nil) path = conference&.id.present? ? conference_path(conference) : root_path link_to( diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 403c797d..759a8113 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -63,6 +63,11 @@ describe ApplicationHelper, type: :helper do end describe 'navigation title link' do + it 'should default to OSEM' do + ENV.delete('OSEM_NAME') + expect(nav_link_text(nil)).to match 'OSEM' + end + it 'should default to OSEM' do ENV.delete('OSEM_NAME') expect(nav_root_link_for(nil)).to include image_tag('snapcon_logo.png', alt: 'OSEM') From c170221605e6921145088ee62e595a60fd7c9d68 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Wed, 24 Feb 2021 20:10:05 -0800 Subject: [PATCH 12/16] More image/nav tests --- spec/helpers/application_helper_spec.rb | 26 ++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 759a8113..7e209774 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -62,12 +62,7 @@ describe ApplicationHelper, type: :helper do end end - describe 'navigation title link' do - it 'should default to OSEM' do - ENV.delete('OSEM_NAME') - expect(nav_link_text(nil)).to match 'OSEM' - end - + describe 'navigation image link' do it 'should default to OSEM' do ENV.delete('OSEM_NAME') expect(nav_root_link_for(nil)).to include image_tag('snapcon_logo.png', alt: 'OSEM') @@ -78,8 +73,25 @@ describe ApplicationHelper, type: :helper do expect(nav_root_link_for(nil)).to include image_tag('snapcon_logo.png', alt: ENV['OSEM_NAME']) end + # TODO-SNAPCON: This is an indicator in a conference it should be the conference name. it 'should use the conference organization name' do - expect(nav_root_link_for(nil)).to include image_tag('snapcon_logo.png', alt: conference.title) + expect(nav_root_link_for(nil)).to include image_tag('snapcon_logo.png', alt: conference.organization.name) + end + end + + describe 'navigation link titke text' do + it 'should default to OSEM' do + ENV.delete('OSEM_NAME') + expect(nav_link_text(nil)).to match 'OSEM' + end + + it 'should use the environment variable' do + ENV['OSEM_NAME'] = Faker::Company.name + "'" + expect(nav_link_text(nil)).to match ENV['OSEM_NAME'] + end + + it 'should use the conference organization name' do + expect(nav_link_text(nil)).to match conference.organization.name) end end end From 8961cea8499e5967e0a90c3f41923994b1292e21 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Wed, 24 Feb 2021 20:23:59 -0800 Subject: [PATCH 13/16] Bah! Typo.... :sob: --- spec/helpers/application_helper_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 7e209774..10aced29 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -91,7 +91,7 @@ describe ApplicationHelper, type: :helper do end it 'should use the conference organization name' do - expect(nav_link_text(nil)).to match conference.organization.name) + expect(nav_link_text(nil)).to match conference.organization.name end end end From 27873c307be2f23c07ec9bf271b315e8929a60b4 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Wed, 24 Feb 2021 20:36:44 -0800 Subject: [PATCH 14/16] Sigh, actually fix the specs for nav logos --- spec/helpers/application_helper_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 10aced29..b54a0bd2 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -75,7 +75,7 @@ describe ApplicationHelper, type: :helper do # TODO-SNAPCON: This is an indicator in a conference it should be the conference name. it 'should use the conference organization name' do - expect(nav_root_link_for(nil)).to include image_tag('snapcon_logo.png', alt: conference.organization.name) + expect(nav_root_link_for(conference)).to include image_tag('snapcon_logo.png', alt: conference.organization.name) end end @@ -91,7 +91,7 @@ describe ApplicationHelper, type: :helper do end it 'should use the conference organization name' do - expect(nav_link_text(nil)).to match conference.organization.name + expect(nav_link_text(conference)).to match conference.organization.name end end end From 5c902e7e36dd85a0243e57949e8e50b496a074f7 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Wed, 24 Feb 2021 20:53:28 -0800 Subject: [PATCH 15/16] Delint from a local pronto run --- app/helpers/events_helper.rb | 2 +- config/puma.rb | 6 +++--- spec/features/commercials_spec.rb | 2 +- spec/support/external_request.rb | 3 ++- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/helpers/events_helper.rb b/app/helpers/events_helper.rb index c920c16f..95b2d106 100644 --- a/app/helpers/events_helper.rb +++ b/app/helpers/events_helper.rb @@ -221,7 +221,7 @@ module EventsHelper def calendar_event_text(event, event_schedule, conference) <<~TEXT #{conference.title} - #{event.title} - #{event_schedule.start_time.strftime("%Y %B %e - %H:%M")} #{event_schedule.timezone} + #{event_schedule.start_time.strftime('%Y %B %e - %H:%M')} #{event_schedule.timezone} More Info: #{conference_program_proposal_url(conference, event)} Join: #{event.url} diff --git a/config/puma.rb b/config/puma.rb index 0d3b583f..c6f137da 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -46,9 +46,9 @@ end lowlevel_error_handler do |ex, env| Sentry.capture_exception( ex, - :message => ex.message, - :extra => { :puma => env }, - :transaction => "Puma" + message: ex.message, + extra: { puma: env }, + transaction: "Puma" ) # note the below is just a Rack response [500, {}, ["An error has occurred, and engineers have been informed. Please reload the page. If you continue to have problems, contact conference@snap.berkeley.edu\n"]] diff --git a/spec/features/commercials_spec.rb b/spec/features/commercials_spec.rb index 13c46f3b..d6fc7f38 100644 --- a/spec/features/commercials_spec.rb +++ b/spec/features/commercials_spec.rb @@ -69,7 +69,7 @@ feature Commercial do scenario 'does not add an invalid commercial of an event', feature: true, js: true do # TODO-SNAPCON - skip("Snap!Con allows all materials to be saved.") + skip('Snap!Con allows all materials to be saved.') visit edit_conference_program_proposal_path(conference.short_title, event.id) click_link 'Materials' fill_in 'commercial_url', with: 'invalid_commercial_url' diff --git a/spec/support/external_request.rb b/spec/support/external_request.rb index b9a61e85..c968acd3 100644 --- a/spec/support/external_request.rb +++ b/spec/support/external_request.rb @@ -35,6 +35,7 @@ def mock_commercial_request end def mock_image_request - WebMock.stub_request(:post, "https://api.cloudinary.com/v1_1/snapcon/image/destroy") + # TODO-SNAPCON: This needs to be configurable somehow. + WebMock.stub_request(:post, 'https://api.cloudinary.com/v1_1/snapcon/image/destroy') .to_return(status: 200, body: {}.to_json, headers: {}) end From 807fbab3b6431b0b3c8f3a98fff0b0bf0783eae1 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Wed, 24 Feb 2021 20:55:59 -0800 Subject: [PATCH 16/16] Add a flay ignore file --- .flayignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .flayignore diff --git a/.flayignore b/.flayignore new file mode 100644 index 00000000..cbee825d --- /dev/null +++ b/.flayignore @@ -0,0 +1 @@ +spec/**/*.rb