diff --git a/.dockerignore b/.dockerignore index 7e7192a0b..add2862b6 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,7 +1,6 @@ .bundle/cache .git/ coverage/ -db/*.sqlite3 Dockerfile docker-compose.* log/ diff --git a/.github/workflows/next-rails.yml b/.github/workflows/next-rails.yml index 87d34a7df..5342dab15 100644 --- a/.github/workflows/next-rails.yml +++ b/.github/workflows/next-rails.yml @@ -12,25 +12,23 @@ jobs: runs-on: ubuntu-latest name: next-rails env: - OSEM_DB_ADAPTER: sqlite3 + OSEM_DB_HOST: localhost RAILS_ENV: test strategy: matrix: suite: [models, features, controllers, ability, leftovers] fail-fast: false steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Sets env vars for next-rails run: | echo "BUNDLE_GEMFILE=Gemfile.next" >> $GITHUB_ENV echo "BUNDLE_CACHE_PATH=vendor/cache.next" >> $GITHUB_ENV - uses: ruby/setup-ruby@v1 with: - ruby-version: 3.3.0 bundler-cache: true - name: Prepare spec run: | - rm -f osem_test osem_development bundle exec rake db:setup --trace bundle exec bin/rails webdrivers:chromedriver:update - name: spec/${{ matrix.suite }} @@ -41,3 +39,15 @@ jobs: with: project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} coverage-reports: coverage/coverage.xml + services: + postgres: + image: postgres:16-alpine + env: + POSTGRES_PASSWORD: mysecretpassword + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 5432:5432 diff --git a/.github/workflows/spec.yml b/.github/workflows/spec.yml index 9a360e10d..df7367032 100644 --- a/.github/workflows/spec.yml +++ b/.github/workflows/spec.yml @@ -13,7 +13,7 @@ jobs: PRONTO_PULL_REQUEST_ID: "${{ github.event.pull_request.number }}" PRONTO_GITHUB_ACCESS_TOKEN: "${{ github.token }}" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 with: bundler-cache: true @@ -27,7 +27,7 @@ jobs: runs-on: ubuntu-latest name: spec env: - OSEM_DB_ADAPTER: sqlite3 + OSEM_DB_HOST: localhost RAILS_ENV: test CCTR: ./cc-test-reporter CCTR_ID: ${{ secrets.CC_TEST_REPORTER_ID }} @@ -35,7 +35,7 @@ jobs: matrix: suite: [models, features, controllers, ability, leftovers, cucumber] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 with: bundler-cache: true @@ -53,7 +53,6 @@ jobs: $CCTR before-build - name: Prepare spec run: | - rm -f osem_test osem_development bundle exec rake db:setup --trace bundle exec bin/rails webdrivers:chromedriver:update bundle exec rake factory_bot:lint RAILS_ENV=test @@ -70,7 +69,7 @@ jobs: # with: # project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} # coverage-reports: coverage/coverage.xml - - name: Upload Capybara Failure Screenshots + - name: Upload Capybara Failure Screenshots uses: actions/upload-artifact@v3 if: always() with: @@ -83,3 +82,16 @@ jobs: # $CCTR sum-coverage coverage/codeclimate.*.json # $CCTR upload-coverage --id "6d21ff1a59b134f3741779d50325f7bd5183cbe6b205051573d955705148960f" # $CCTR after-build --id "6d21ff1a59b134f3741779d50325f7bd5183cbe6b205051573d955705148960f" + + services: + postgres: + image: postgres:16-alpine + env: + POSTGRES_PASSWORD: mysecretpassword + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 5432:5432 diff --git a/.gitignore b/.gitignore index 551ac3e65..650c3fa39 100644 --- a/.gitignore +++ b/.gitignore @@ -12,13 +12,6 @@ Desktop.ini ._* Thumbs.db -# Files that might appear on external disks -.Spotlight-V100 -.Trashes - - -# Legacy from before Feb 2021 -/db/test.sqlite3-journal config/application.rb config/config.yml config/local_env.yml @@ -39,7 +32,6 @@ capybara-*.html /vendor/bundle /log/* /tmp/* -/db/*.sqlite3 /public/system/* /coverage/ /spec/tmp/* diff --git a/.haml-lint_todo.yml b/.haml-lint_todo.yml index 93b401d76..004f46db2 100644 --- a/.haml-lint_todo.yml +++ b/.haml-lint_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `haml-lint --auto-gen-config` -# on 2021-08-13 13:00:39 +0000 using Haml-Lint version 0.28.0. +# on 2024-03-26 11:01:18 +0000 using Haml-Lint version 0.57.0. # The point is for the user to remove these configuration records # one by one as the lints are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -8,7 +8,11 @@ linters: - # Offense count: 1141 + # Offense count: 401 + InstanceVariables: + enabled: false + + # Offense count: 1378 RuboCop: enabled: false @@ -28,15 +32,11 @@ linters: - "app/views/admin/versions/_object_desc_and_link.html.haml" - "app/views/booths/index.html.haml" - # Offense count: 981 + # Offense count: 967 LineLength: enabled: false - # Offense count: 206 - InstanceVariables: - enabled: false - - # Offense count: 12 + # Offense count: 13 ViewLength: exclude: - "app/views/admin/booths/index.html.haml" @@ -50,9 +50,9 @@ linters: - "app/views/admin/versions/_object_desc_and_link.html.haml" - "app/views/conference_registrations/show.html.haml" - "app/views/layouts/_admin_sidebar.html.haml" + - "app/views/proposals/_form.html.haml" - "app/views/proposals/index.html.haml" - "app/views/proposals/show.html.haml" - - "app/views/proposals/_form.html.haml" # Offense count: 28 IdNames: @@ -70,21 +70,34 @@ linters: - "app/views/admin/users/show.html.haml" - "app/views/users/edit.html.haml" - # Offense count: 38 + # Offense count: 37 InlineStyles: enabled: false - # Offense count: 3 + # Offense count: 378 + SpaceInsideHashAttributes: + enabled: false + + # Offense count: 10 + TrailingEmptyLines: + exclude: + - "app/views/admin/conferences/_form_fields.html.haml" + - "app/views/admin/events/_all_with_comments.csv.haml" + - "app/views/admin/events/_form.html.haml" + - "app/views/admin/events/_proposal.html.haml" + - "app/views/admin/schedules/_form.html.haml" + - "app/views/admin/sponsorship_levels/_form.html.haml" + - "app/views/application/_big_statistic.haml" + - "app/views/booths/_form.html.haml" + - "app/views/schedules/_schedule_item.html.haml" + - "app/views/users/edit.html.haml" + + # Offense count: 1 UnnecessaryInterpolation: exclude: - "app/views/admin/conferences/_recent_submissions.html.haml" - - "app/views/proposals/new.html.haml" - - # Offense count: 262 - SpaceInsideHashAttributes: - enabled: false - # Offense count: 24 + # Offense count: 21 ClassesBeforeIds: exclude: - "app/views/admin/emails/index.html.haml" @@ -94,11 +107,9 @@ linters: - "app/views/admin/venues/_form.html.haml" - "app/views/conferences/index.html.haml" - "app/views/devise/shared/_help.html.haml" - - "app/views/devise/shared/_sign_in_form_embedded.html.haml" - "app/views/layouts/_navigation.html.haml" - - "app/views/proposals/_form.html.haml" - # Offense count: 19 + # Offense count: 16 UnnecessaryStringOutput: exclude: - "app/views/admin/event_types/index.html.haml" @@ -108,15 +119,13 @@ linters: - "app/views/admin/versions/_object_desc_and_link.html.haml" - "app/views/admin/volunteers/show.html.haml" - "app/views/conference_registrations/show.html.haml" - - "app/views/conferences/_conference_details.html.haml" - "app/views/proposals/_encouragement_text.html.haml" - - "app/views/proposals/_form.html.haml" - - "app/views/users/edit.html.haml" - "app/views/users/show.html.haml" - # Offense count: 31 - SpaceBeforeScript: - enabled: false + # Offense count: 1 + ImplicitDiv: + exclude: + - "app/views/admin/registrations/index.html.haml" # Offense count: 9 MultilinePipe: @@ -134,10 +143,13 @@ linters: - "app/views/layouts/_navigation.html.haml" - "app/views/schedules/events.html.haml" - # Offense count: 7 + # Offense count: 30 + SpaceBeforeScript: + enabled: false + + # Offense count: 5 TrailingWhitespace: exclude: - - "app/views/admin/volunteers/index.html.haml" - "app/views/admin/volunteers/show.html.haml" - "app/views/conference_registrations/_volunteer.html.haml" - "app/views/devise/passwords/new.html.haml" diff --git a/.rubocop.yml b/.rubocop.yml index 53babd565..809f8429a 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,5 +1,6 @@ require: - rubocop-rspec + - rubocop-rspec_rails - rubocop-rails - rubocop-capybara - rubocop-performance diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index be9e93e84..28c83b446 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,12 +1,12 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2024-03-12 05:45:42 UTC using RuboCop version 1.61.0. +# on 2024-06-07 15:38:52 UTC using RuboCop version 1.64.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 3 +# Offense count: 4 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include. # Include: **/*.gemfile, **/Gemfile, **/gems.rb @@ -14,42 +14,42 @@ Bundler/OrderedGems: Exclude: - 'Gemfile' -# Offense count: 180 +# Offense count: 151 # Configuration parameters: EnforcedStyle. # SupportedStyles: link_or_button, strict Capybara/ClickLinkOrButtonStyle: Enabled: false -# Offense count: 77 +# Offense count: 280 # This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: have_no, not_to -Capybara/NegationMatcher: +Capybara/CurrentPathExpectation: Exclude: + - 'spec/features/base_controller_spec.rb' - 'spec/features/cfp_ability_spec.rb' - - 'spec/features/code_of_conduct_spec.rb' + - 'spec/features/conference_registration_spec.rb' - 'spec/features/info_desk_ability_spec.rb' - 'spec/features/organizer_ability_spec.rb' - 'spec/features/proposals_spec.rb' + - 'spec/features/registration_periods_spec.rb' - 'spec/features/splashpage_spec.rb' - - 'spec/features/sponsor_spec.rb' + - 'spec/features/ticket_purchases_spec.rb' - 'spec/features/track_organizer_ability_spec.rb' + - 'spec/features/user_ability_spec.rb' -# Offense count: 10 +# Offense count: 13 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: DefaultSelector. Capybara/RSpec/HaveSelector: Exclude: - 'spec/features/cfp_ability_spec.rb' - 'spec/features/info_desk_ability_spec.rb' - - 'spec/features/organization_admin_ability_spec.rb' - 'spec/features/organizer_ability_spec.rb' - 'spec/features/proposals_spec.rb' - 'spec/features/sponsor_spec.rb' - 'spec/features/track_organizer_ability_spec.rb' - 'spec/features/voting_spec.rb' -# Offense count: 101 +# Offense count: 78 # This cop supports safe autocorrection (--autocorrect). Capybara/SpecificFinders: Enabled: false @@ -66,7 +66,21 @@ FactoryBot/AssociationStyle: - 'spec/factories/surveys.rb' - 'spec/factories/tracks.rb' -# Offense count: 4 +# Offense count: 11 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: Include, EnforcedStyle, ExplicitOnly. +# Include: **/*_spec.rb, **/spec/**/*, **/test/**/*, **/features/support/factories/**/*.rb +# SupportedStyles: require_parentheses, omit_parentheses +FactoryBot/ConsistentParenthesesStyle: + Exclude: + - 'spec/controllers/proposals_controller_spec.rb' + - 'spec/features/proposals_spec.rb' + - 'spec/features/roles_spec.rb' + - 'spec/features/surveys_spec.rb' + - 'spec/models/resource_spec.rb' + - 'spec/models/ticket_spec.rb' + +# Offense count: 3 # Configuration parameters: Include. # Include: **/*_spec.rb, **/spec/**/*, **/test/**/*, **/features/support/factories/**/*.rb FactoryBot/FactoryAssociationWithStrategy: @@ -74,12 +88,354 @@ FactoryBot/FactoryAssociationWithStrategy: - 'spec/factories/booths.rb' - 'spec/factories/users.rb' -# Offense count: 13 +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: IndentationWidth. +Layout/AssignmentIndentation: + Exclude: + - 'app/helpers/format_helper.rb' + +# Offense count: 4 +# This cop supports safe autocorrection (--autocorrect). +Layout/ClosingParenthesisIndentation: + Exclude: + - 'app/controllers/conference_registrations_controller.rb' + - 'app/controllers/proposals_controller.rb' + - 'app/models/commercial.rb' + - 'spec/controllers/users/omniauth_callbacks_controller_spec.rb' + +# Offense count: 5 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowForAlignment. +Layout/CommentIndentation: + Exclude: + - 'app/controllers/admin/comments_controller.rb' + - 'app/controllers/admin/difficulty_levels_controller.rb' + - 'app/models/conference.rb' + - 'app/models/program.rb' + - 'app/models/track.rb' + +# Offense count: 3 +# This cop supports safe autocorrection (--autocorrect). +Layout/EmptyLineAfterGuardClause: + Exclude: + - 'app/controllers/subscriptions_controller.rb' + - 'app/models/program.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Layout/EmptyLineAfterMagicComment: + Exclude: + - 'spec/models/conference_spec.rb' + +# Offense count: 100 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: empty_lines, no_empty_lines +Layout/EmptyLinesAroundBlockBody: + Enabled: false + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Layout/EmptyLinesAroundExceptionHandlingKeywords: + Exclude: + - 'app/models/payment.rb' + +# Offense count: 6 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment. +Layout/ExtraSpacing: + Exclude: + - 'app/controllers/application_controller.rb' + - 'app/views/admin/events/_all_with_comments.xlsx.axlsx' + - 'db/migrate/20140623101032_create_ahoy_events.rb' + - 'db/migrate/20140701123203_add_events_per_week_to_conference.rb' + - 'db/migrate/20140719160903_create_delayed_jobs.rb' + - 'spec/models/conference_spec.rb' + +# Offense count: 42 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses +Layout/FirstArgumentIndentation: + Enabled: false + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: special_inside_parentheses, consistent, align_brackets +Layout/FirstArrayElementIndentation: + Exclude: + - 'app/models/conference.rb' + +# Offense count: 4 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: special_inside_parentheses, consistent, align_braces +Layout/FirstHashElementIndentation: + Exclude: + - 'app/models/user.rb' + - 'config/routes.rb' + - 'db/migrate/20140701123203_add_events_per_week_to_conference.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: normal, indented_internal_methods +Layout/IndentationConsistency: + Exclude: + - 'app/controllers/users_controller.rb' + - 'app/models/event.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: IndentationWidth, EnforcedStyle. +# SupportedStyles: spaces, tabs +Layout/IndentationStyle: + Exclude: + - 'app/controllers/admin/resources_controller.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: Width, AllowedPatterns. +Layout/IndentationWidth: + Exclude: + - 'app/controllers/users_controller.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment. +Layout/LeadingCommentSpace: + Exclude: + - 'app/models/comment.rb' + +# Offense count: 18 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: space, no_space +Layout/LineContinuationSpacing: + Exclude: + - 'app/controllers/admin/booths_controller.rb' + - 'app/controllers/admin/cfps_controller.rb' + - 'app/controllers/admin/commercials_controller.rb' + - 'app/controllers/admin/difficulty_levels_controller.rb' + - 'app/controllers/admin/event_types_controller.rb' + - 'app/controllers/admin/registrations_controller.rb' + - 'app/controllers/admin/splashpages_controller.rb' + - 'app/controllers/admin/venue_commercials_controller.rb' + - 'app/controllers/admin/venues_controller.rb' + - 'app/controllers/conference_registrations_controller.rb' + - 'app/models/cfp.rb' + +# Offense count: 31 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: aligned, indented +Layout/LineEndStringConcatenationIndentation: + Enabled: false + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: symmetrical, new_line, same_line +Layout/MultilineArrayBraceLayout: + Exclude: + - 'app/controllers/conference_registrations_controller.rb' + +# Offense count: 5 +# This cop supports safe autocorrection (--autocorrect). +Layout/MultilineBlockLayout: + Exclude: + - 'app/serializers/conference_serializer.rb' + +# Offense count: 7 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: symmetrical, new_line, same_line +Layout/MultilineHashBraceLayout: + Exclude: + - 'app/serializers/conference_serializer.rb' + - 'config/routes.rb' + - 'spec/models/event_spec.rb' + +# Offense count: 32 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: symmetrical, new_line, same_line +Layout/MultilineMethodCallBraceLayout: + Enabled: false + +# Offense count: 38 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: aligned, indented, indented_relative_to_receiver +Layout/MultilineMethodCallIndentation: + Enabled: false + +# Offense count: 18 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: aligned, indented +Layout/MultilineOperationIndentation: + Exclude: + - 'app/controllers/application_controller.rb' + - 'app/models/conference.rb' + - 'app/models/event.rb' + - 'db/migrate/20140701123203_add_events_per_week_to_conference.rb' + +# Offense count: 64 +# This cop supports safe autocorrection (--autocorrect). +Layout/SpaceAfterComma: + Exclude: + - 'app/views/admin/booths/_all_booths.xlsx.axlsx' + - 'app/views/admin/booths/_confirmed_booths.xlsx.axlsx' + - 'app/views/admin/events/_all_events.xlsx.axlsx' + - 'app/views/admin/events/_all_with_comments.xlsx.axlsx' + - 'app/views/admin/events/_confirmed_events.xlsx.axlsx' + - 'app/views/admin/tracks/_all_tracks.xlsx.axlsx' + - 'app/views/admin/tracks/_confirmed_tracks.xlsx.axlsx' + - 'lib/tasks/data_demo.rake' + +# Offense count: 3 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: space, no_space +Layout/SpaceAroundEqualsInParameterDefault: + Exclude: + - 'app/helpers/format_helper.rb' + - 'app/models/event.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Layout/SpaceAroundKeyword: + Exclude: + - 'config/initializers/feature.rb' + +# Offense count: 3 +# This cop supports safe autocorrection (--autocorrect). +Layout/SpaceAroundMethodCallOperator: + Exclude: + - 'spec/features/cfp_ability_spec.rb' + - 'spec/features/organizer_ability_spec.rb' + - 'spec/models/program_spec.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator, EnforcedStyleForRationalLiterals. +# SupportedStylesForExponentOperator: space, no_space +# SupportedStylesForRationalLiterals: space, no_space +Layout/SpaceAroundOperators: + Exclude: + - 'app/views/admin/events/_all_with_comments.xlsx.axlsx' + - 'lib/tasks/data.rake' + +# Offense count: 138 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces. +# SupportedStyles: space, no_space +# SupportedStylesForEmptyBraces: space, no_space +Layout/SpaceBeforeBlockBraces: + Enabled: false + +# Offense count: 7 +# This cop supports safe autocorrection (--autocorrect). +Layout/SpaceBeforeComma: + Exclude: + - 'app/views/admin/booths/_all_booths.xlsx.axlsx' + - 'app/views/admin/booths/_confirmed_booths.xlsx.axlsx' + - 'app/views/admin/events/_all_events.xlsx.axlsx' + - 'app/views/admin/events/_confirmed_events.xlsx.axlsx' + - 'app/views/admin/tracks/_all_tracks.xlsx.axlsx' + - 'app/views/admin/tracks/_confirmed_tracks.xlsx.axlsx' + - 'lib/tasks/data_demo.rake' + +# Offense count: 5 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowForAlignment. +Layout/SpaceBeforeFirstArg: + Exclude: + - 'app/controllers/admin/booths_controller.rb' + +# Offense count: 8 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBrackets. +# SupportedStyles: space, no_space, compact +# SupportedStylesForEmptyBrackets: space, no_space +Layout/SpaceInsideArrayLiteralBrackets: + Exclude: + - 'config/initializers/devise.rb' + - 'config/routes.rb' + +# Offense count: 42 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters. +# SupportedStyles: space, no_space +# SupportedStylesForEmptyBraces: space, no_space +Layout/SpaceInsideBlockBraces: + Exclude: + - 'app/controllers/admin/comments_controller.rb' + - 'app/controllers/admin/questions_controller.rb' + - 'app/helpers/application_helper.rb' + - 'app/models/program.rb' + - 'app/models/ticket.rb' + - 'app/models/user.rb' + - 'lib/tasks/events_registrations.rake' + - 'spec/ability/ability_spec.rb' + - 'spec/controllers/admin/event_schedules_controller_spec.rb' + - 'spec/controllers/admin/schedules_controller_spec.rb' + - 'spec/features/splashpage_spec.rb' + - 'spec/models/user_spec.rb' + +# Offense count: 37 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces. +# SupportedStyles: space, no_space, compact +# SupportedStylesForEmptyBraces: space, no_space +Layout/SpaceInsideHashLiteralBraces: + Exclude: + - 'app/controllers/api/v1/speakers_controller.rb' + - 'app/models/conference.rb' + - 'app/models/event_type.rb' + - 'app/models/user.rb' + - 'app/views/admin/booths/_all_booths.xlsx.axlsx' + - 'app/views/admin/booths/_confirmed_booths.xlsx.axlsx' + - 'app/views/admin/events/_all_events.xlsx.axlsx' + - 'app/views/admin/events/_confirmed_events.xlsx.axlsx' + - 'app/views/admin/events/events.xlsx.axlsx' + - 'app/views/admin/tracks/_all_tracks.xlsx.axlsx' + - 'app/views/admin/tracks/_confirmed_tracks.xlsx.axlsx' + - 'config/routes.rb' + - 'spec/models/event_spec.rb' + - 'spec/models/payment_spec.rb' + +# Offense count: 4 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: space, compact, no_space +Layout/SpaceInsideParens: + Exclude: + - 'app/views/admin/registrations/index.xlsx.axlsx' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Layout/SpaceInsidePercentLiteralDelimiters: + Exclude: + - 'Gemfile' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: final_newline, final_blank_line +Layout/TrailingEmptyLines: + Exclude: + - 'lib/tasks/event_attatchments.rake' + - 'lib/tasks/roles.rake' + +# Offense count: 11 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowedMethods, AllowedPatterns. Lint/AmbiguousBlockAssociation: Exclude: - - 'spec/controllers/admin/conferences_controller_spec.rb' - 'spec/controllers/admin/event_schedules_controller_spec.rb' - 'spec/controllers/admin/registration_periods_controller_spec.rb' - 'spec/controllers/admin/users_controller_spec.rb' @@ -100,23 +456,51 @@ Lint/IneffectiveAccessModifier: - 'app/models/commercial.rb' - 'app/models/conference.rb' -# Offense count: 110 +# Offense count: 4 +# This cop supports unsafe autocorrection (--autocorrect-all). +Lint/NonAtomicFileOperation: + Exclude: + - 'spec/support/save_feature_failures.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AutoCorrect, IgnoreEmptyBlocks, AllowUnusedKeywordArguments. +Lint/UnusedBlockArgument: + Exclude: + - 'lib/tasks/user.rake' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AutoCorrect, AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods. +Lint/UnusedMethodArgument: + Exclude: + - 'app/helpers/application_helper.rb' + - 'config/initializers/fuckups.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Lint/UriRegexp: + Exclude: + - 'app/models/commercial.rb' + - 'app/models/contact.rb' + +# Offense count: 125 # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes. Metrics/AbcSize: - Max: 72 + Max: 70 # Offense count: 14 # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode. # AllowedMethods: refine Metrics/BlockLength: - Max: 99 + Max: 202 # Offense count: 13 # Configuration parameters: CountComments, CountAsOne. Metrics/ClassLength: - Max: 270 + Max: 649 -# Offense count: 28 +# Offense count: 25 # Configuration parameters: AllowedMethods, AllowedPatterns. Metrics/CyclomaticComplexity: Max: 15 @@ -131,7 +515,7 @@ Metrics/MethodLength: Metrics/ModuleLength: Max: 158 -# Offense count: 27 +# Offense count: 21 # Configuration parameters: AllowedMethods, AllowedPatterns. Metrics/PerceivedComplexity: Max: 17 @@ -229,7 +613,7 @@ RSpec/BeEmpty: - 'spec/controllers/conference_registration_controller_spec.rb' - 'spec/models/conference_spec.rb' -# Offense count: 12 +# Offense count: 143 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnabledMethods. RSpec/Capybara/FeatureMethods: @@ -238,7 +622,7 @@ RSpec/Capybara/FeatureMethods: - 'spec/features/user_spec.rb' - 'spec/features/voting_spec.rb' -# Offense count: 339 +# Offense count: 302 # Configuration parameters: Prefixes, AllowedPatterns. # Prefixes: when, with, without RSpec/ContextWording: @@ -246,40 +630,110 @@ RSpec/ContextWording: # Offense count: 141 # This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: SkipBlocks, EnforcedStyle. +# Configuration parameters: SkipBlocks, EnforcedStyle, OnlyStaticConstants. # SupportedStyles: described_class, explicit RSpec/DescribedClass: Enabled: false -# Offense count: 251 -# Configuration parameters: CountAsOne. -RSpec/ExampleLength: - Max: 222 - -# Offense count: 37 -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: method_call, block -RSpec/ExpectChange: +# Offense count: 11 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowConsecutiveOneLiners. +RSpec/EmptyLineAfterExample: Exclude: - - 'spec/controllers/admin/booths_controller_spec.rb' - - 'spec/controllers/admin/conferences_controller_spec.rb' - - 'spec/controllers/admin/event_schedules_controller_spec.rb' - - 'spec/controllers/admin/organizations_controller_spec.rb' + - 'spec/ability/ability_spec.rb' + - 'spec/controllers/admin/comments_controller_spec.rb' - 'spec/controllers/admin/registration_periods_controller_spec.rb' - - 'spec/controllers/admin/schedules_controller_spec.rb' - - 'spec/controllers/admin/ticket_scannings_controller_spec.rb' - 'spec/controllers/admin/users_controller_spec.rb' - - 'spec/controllers/conference_registration_controller_spec.rb' - - 'spec/controllers/proposals_controller_spec.rb' - - 'spec/features/tracks_spec.rb' - - 'spec/models/conference_spec.rb' + - 'spec/helpers/events_helper_spec.rb' - 'spec/models/event_spec.rb' - - 'spec/models/user_spec.rb' + - 'spec/models/survey_spec.rb' -# Offense count: 9 -# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly. -# Include: **/*_spec*rb*, **/spec/**/* +# Offense count: 3 +# This cop supports safe autocorrection (--autocorrect). +RSpec/EmptyLineAfterExampleGroup: + Exclude: + - 'spec/controllers/admin/users_controller_spec.rb' + +# Offense count: 10 +# This cop supports safe autocorrection (--autocorrect). +RSpec/EmptyLineAfterFinalLet: + Exclude: + - 'spec/controllers/admin/event_schedules_controller_spec.rb' + - 'spec/controllers/admin/users_controller_spec.rb' + - 'spec/controllers/application_controller_spec.rb' + - 'spec/models/conference_spec.rb' + - 'spec/models/payment_spec.rb' + - 'spec/models/ticket_spec.rb' + +# Offense count: 12 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowConsecutiveOneLiners. +RSpec/EmptyLineAfterHook: + Exclude: + - 'spec/controllers/admin/booths_controller_spec.rb' + - 'spec/controllers/admin/comments_controller_spec.rb' + - 'spec/controllers/admin/ticket_scannings_controller_spec.rb' + - 'spec/controllers/admin/users_controller_spec.rb' + - 'spec/features/roles_spec.rb' + - 'spec/models/conference_spec.rb' + - 'spec/models/payment_spec.rb' + - 'spec/models/program_spec.rb' + +# Offense count: 8 +# This cop supports safe autocorrection (--autocorrect). +RSpec/EmptyLineAfterSubject: + Exclude: + - 'spec/ability/ability_spec.rb' + - 'spec/models/booth_spec.rb' + - 'spec/models/cfp_spec.rb' + - 'spec/models/event_spec.rb' + - 'spec/models/program_spec.rb' + - 'spec/models/registration_spec.rb' + - 'spec/models/survey_spec.rb' + - 'spec/models/track_spec.rb' + +# Offense count: 202 +# Configuration parameters: CountAsOne. +RSpec/ExampleLength: + Max: 181 + +# Offense count: 13 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: CustomTransform, IgnoredWords, DisallowedExamples. +# DisallowedExamples: works +RSpec/ExampleWording: + Exclude: + - 'spec/controllers/admin/registration_periods_controller_spec.rb' + - 'spec/helpers/application_helper_spec.rb' + - 'spec/helpers/events_helper_spec.rb' + - 'spec/helpers/format_helper_spec.rb' + - 'spec/models/conference_spec.rb' + - 'spec/models/event_spec.rb' + - 'spec/models/ticket_purchase_spec.rb' + - 'spec/models/ticket_spec.rb' + +# Offense count: 32 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: method_call, block +RSpec/ExpectChange: + Exclude: + - 'spec/controllers/admin/booths_controller_spec.rb' + - 'spec/controllers/admin/event_schedules_controller_spec.rb' + - 'spec/controllers/admin/registration_periods_controller_spec.rb' + - 'spec/controllers/admin/schedules_controller_spec.rb' + - 'spec/controllers/admin/ticket_scannings_controller_spec.rb' + - 'spec/controllers/admin/users_controller_spec.rb' + - 'spec/controllers/conference_registration_controller_spec.rb' + - 'spec/controllers/proposals_controller_spec.rb' + - 'spec/features/tracks_spec.rb' + - 'spec/models/conference_spec.rb' + - 'spec/models/event_spec.rb' + - 'spec/models/user_spec.rb' + +# Offense count: 9 +# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly. +# Include: **/*_spec*rb*, **/spec/**/* RSpec/FilePath: Exclude: - 'spec/controllers/conference_registration_controller_spec.rb' @@ -292,7 +746,7 @@ RSpec/FilePath: - 'spec/models/comment_spec.rb' - 'spec/models/openid.rb' -# Offense count: 1 +# Offense count: 166 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: implicit, each, example @@ -305,7 +759,43 @@ RSpec/IdenticalEqualityAssertion: Exclude: - 'spec/controllers/admin/conferences_controller_spec.rb' -# Offense count: 53 +# Offense count: 137 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: is_expected, should +RSpec/ImplicitExpect: + Exclude: + - 'spec/ability/ability_spec.rb' + - 'spec/models/commercial_spec.rb' + - 'spec/models/conference_spec.rb' + - 'spec/models/event_schedule_spec.rb' + - 'spec/models/event_type_spec.rb' + - 'spec/models/registration_period_spec.rb' + - 'spec/models/room_spec.rb' + - 'spec/models/schedule_spec.rb' + - 'spec/models/sponsor_spec.rb' + - 'spec/models/sponsorship_level_spec.rb' + - 'spec/models/ticket_purchase_spec.rb' + - 'spec/models/ticket_spec.rb' + - 'spec/models/user_spec.rb' + +# Offense count: 38 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: single_line_only, single_statement_only, disallow, require_implicit +RSpec/ImplicitSubject: + Exclude: + - 'spec/ability/ability_spec.rb' + - 'spec/models/booth_spec.rb' + - 'spec/models/conference_spec.rb' + - 'spec/models/event_type_spec.rb' + - 'spec/models/registration_period_spec.rb' + - 'spec/models/sponsor_spec.rb' + - 'spec/models/sponsorship_level_spec.rb' + - 'spec/models/ticket_purchase_spec.rb' + - 'spec/models/ticket_spec.rb' + +# Offense count: 19 # Configuration parameters: Max, AllowedIdentifiers, AllowedPatterns. RSpec/IndexedLet: Exclude: @@ -343,11 +833,19 @@ RSpec/InstanceVariable: - 'spec/models/track_spec.rb' - 'spec/models/user_spec.rb' -# Offense count: 64 +# Offense count: 4 +# This cop supports safe autocorrection (--autocorrect). +RSpec/LeadingSubject: + Exclude: + - 'spec/ability/ability_spec.rb' + - 'spec/models/conference_spec.rb' + - 'spec/models/ticket_spec.rb' + +# Offense count: 56 RSpec/LetSetup: Enabled: false -# Offense count: 4 +# Offense count: 3 # This cop supports safe autocorrection (--autocorrect). RSpec/MatchArray: Exclude: @@ -361,19 +859,26 @@ RSpec/MatchArray: RSpec/MessageSpies: EnforcedStyle: receive +# Offense count: 225 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: hash, symbol +RSpec/MetadataStyle: + Enabled: false + # Offense count: 1 RSpec/MultipleDescribes: Exclude: - 'spec/models/conference_spec.rb' -# Offense count: 300 +# Offense count: 251 RSpec/MultipleExpectations: - Max: 97 + Max: 94 -# Offense count: 274 +# Offense count: 218 # Configuration parameters: AllowSubject. RSpec/MultipleMemoizedHelpers: - Max: 32 + Max: 31 # Offense count: 438 # Configuration parameters: EnforcedStyle, IgnoreSharedExamples. @@ -395,7 +900,7 @@ RSpec/NamedSubject: - 'spec/models/ticket_spec.rb' - 'spec/models/track_spec.rb' -# Offense count: 219 +# Offense count: 202 # Configuration parameters: AllowedGroups. RSpec/NestedGroups: Max: 7 @@ -410,41 +915,35 @@ RSpec/NoExpectationExample: - 'spec/features/proposals_spec.rb' - 'spec/features/voting_spec.rb' -# Offense count: 1 -RSpec/OverwritingSetup: +# Offense count: 78 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: not_to, to_not +RSpec/NotToNot: Exclude: - 'spec/controllers/admin/booths_controller_spec.rb' - -# Offense count: 11 -RSpec/PendingWithoutReason: - Exclude: - - 'spec/ability/ability_spec.rb' - - 'spec/controllers/admin/conferences_controller_spec.rb' - - 'spec/datatables/user_datatable_spec.rb' - - 'spec/features/proposals_spec.rb' - - 'spec/features/versions_spec.rb' + - 'spec/controllers/admin/event_schedules_controller_spec.rb' + - 'spec/controllers/admin/registration_periods_controller_spec.rb' + - 'spec/controllers/admin/ticket_scannings_controller_spec.rb' + - 'spec/controllers/booths_controller_spec.rb' + - 'spec/features/cfp_ability_spec.rb' + - 'spec/features/info_desk_ability_spec.rb' + - 'spec/features/organizer_ability_spec.rb' + - 'spec/features/sponsor_spec.rb' + - 'spec/features/track_organizer_ability_spec.rb' + - 'spec/features/tracks_spec.rb' + - 'spec/models/program_spec.rb' + - 'spec/models/track_spec.rb' - 'spec/models/user_spec.rb' + - 'spec/pdfs/ticket_pdf_spec.rb' -# Offense count: 12 -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: Inferences. -RSpec/Rails/InferredSpecType: +# Offense count: 1 +RSpec/OverwritingSetup: Exclude: - - 'spec/controllers/admin/comments_controller_spec.rb' - - 'spec/controllers/admin/programs_controller_spec.rb' - - 'spec/controllers/application_controller_spec.rb' - - 'spec/controllers/conference_registration_controller_spec.rb' - - 'spec/features/omniauth_spec.rb' - - 'spec/helpers/application_helper_spec.rb' - - 'spec/helpers/conference_helper_spec.rb' - - 'spec/helpers/date_time_helper_spec.rb' - - 'spec/helpers/events_helper_spec.rb' - - 'spec/helpers/format_helper_spec.rb' - - 'spec/helpers/users_helper_spec.rb' - - 'spec/routing/routing_spec.rb' + - 'spec/controllers/admin/booths_controller_spec.rb' # Offense count: 12 -# This cop supports safe autocorrection (--autocorrect). +# This cop supports unsafe autocorrection (--autocorrect-all). RSpec/ReceiveMessages: Exclude: - 'spec/models/track_spec.rb' @@ -464,18 +963,54 @@ RSpec/RepeatedExampleGroupBody: Exclude: - 'spec/models/conference_spec.rb' +# Offense count: 10 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: and_return, block +RSpec/ReturnFromStub: + Exclude: + - 'spec/helpers/events_helper_spec.rb' + +# Offense count: 18 +# This cop supports safe autocorrection (--autocorrect). +RSpec/ScatteredLet: + Exclude: + - 'spec/ability/ability_spec.rb' + - 'spec/models/payment_spec.rb' + # Offense count: 2 # This cop supports safe autocorrection (--autocorrect). RSpec/ScatteredSetup: Exclude: - 'spec/models/payment_spec.rb' -# Offense count: 32 +# Offense count: 30 # This cop supports safe autocorrection (--autocorrect). RSpec/SortMetadata: Exclude: - 'spec/features/versions_spec.rb' +# Offense count: 8 +# Configuration parameters: Include, CustomTransform, IgnoreMethods, IgnoreMetadata. +# Include: **/*_spec.rb +RSpec/SpecFilePathFormat: + Exclude: + - 'spec/controllers/conference_registration_controller_spec.rb' + - 'spec/controllers/physical_ticket_controller_spec.rb' + - 'spec/features/email_spec.rb' + - 'spec/features/omniauth_spec.rb' + - 'spec/features/proposals_spec.rb' + - 'spec/features/ticket_purchases_spec.rb' + - 'spec/features/venues_spec.rb' + - 'spec/models/comment_spec.rb' + +# Offense count: 1 +# Configuration parameters: Include. +# Include: **/*_spec*rb*, **/spec/**/* +RSpec/SpecFilePathSuffix: + Exclude: + - 'spec/models/openid.rb' + # Offense count: 9 RSpec/StubbedMock: Exclude: @@ -500,82 +1035,633 @@ RSpec/VoidExpect: Exclude: - 'spec/models/conference_spec.rb' -# Offense count: 3 -Security/Open: +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +RSpecRails/AvoidSetupHook: Exclude: - - 'app/pdfs/ticket_pdf.rb' + - 'spec/helpers/events_helper_spec.rb' -# Offense count: 3 +# Offense count: 2 # This cop supports unsafe autocorrection (--autocorrect-all). -Style/ArrayIntersect: +# Configuration parameters: ResponseMethods. +# ResponseMethods: response, last_response +RSpecRails/HaveHttpStatus: Exclude: - - 'app/helpers/application_helper.rb' - - 'app/models/admin_ability.rb' + - 'spec/controllers/admin/event_schedules_controller_spec.rb' -# Offense count: 1 +# Offense count: 11 # This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: MinBranchesCount. -Style/CaseLikeIf: +# Configuration parameters: Inferences. +RSpecRails/InferredSpecType: Exclude: - - 'app/views/admin/events/events.xlsx.axlsx' - -# Offense count: 107 -# Configuration parameters: AllowedConstants. -Style/Documentation: - Enabled: false + - 'spec/controllers/admin/comments_controller_spec.rb' + - 'spec/controllers/admin/programs_controller_spec.rb' + - 'spec/controllers/application_controller_spec.rb' + - 'spec/controllers/conference_registration_controller_spec.rb' + - 'spec/helpers/application_helper_spec.rb' + - 'spec/helpers/conference_helper_spec.rb' + - 'spec/helpers/date_time_helper_spec.rb' + - 'spec/helpers/events_helper_spec.rb' + - 'spec/helpers/format_helper_spec.rb' + - 'spec/helpers/users_helper_spec.rb' + - 'spec/routing/routing_spec.rb' -# Offense count: 43 -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: always, always_true, never -Style/FrozenStringLiteralComment: +# Offense count: 23 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: ExpectedOrder, Include. +# ExpectedOrder: index, show, new, edit, create, update, destroy +# Include: app/controllers/**/*.rb +Rails/ActionOrder: Enabled: false -# Offense count: 1 +# Offense count: 4 # This cop supports unsafe autocorrection (--autocorrect-all). -Style/GlobalStdStream: +Rails/ActiveRecordAliases: Exclude: - - 'config/environments/production.rb' + - 'db/migrate/20141104131625_generate_username.rb' + - 'db/migrate/20141117214230_move_banner_description_to_conference.rb' + - 'db/migrate/20141118153918_change_venue_conference_association.rb' + - 'db/migrate/20141118162030_change_lodging_association_to_conference.rb' -# Offense count: 36 +# Offense count: 3 # This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: MinBodyLength, AllowConsecutiveConditionals. -Style/GuardClause: - Enabled: false - -# Offense count: 1 -# Configuration parameters: MinBranchesCount. -Style/HashLikeCase: +# Configuration parameters: Include. +# Include: app/models/**/*.rb +Rails/ActiveRecordCallbacksOrder: Exclude: - - 'app/helpers/versions_helper.rb' + - 'app/models/event.rb' + - 'app/models/track.rb' + - 'app/models/venue.rb' -# Offense count: 2 +# Offense count: 1 # This cop supports unsafe autocorrection (--autocorrect-all). -Style/HashTransformValues: +Rails/ApplicationController: Exclude: - - 'app/controllers/admin/comments_controller.rb' - - 'app/helpers/chart_helper.rb' + - 'app/controllers/api/base_controller.rb' -# Offense count: 4 +# Offense count: 1 # This cop supports unsafe autocorrection (--autocorrect-all). -Style/IdenticalConditionalBranches: +Rails/ApplicationMailer: Exclude: - - 'app/controllers/admin/booths_controller.rb' - - 'app/controllers/admin/events_controller.rb' + - 'app/mailers/mailbot.rb' -# Offense count: 34 -# This cop supports safe autocorrection (--autocorrect). -Style/IfUnlessModifier: +# Offense count: 129 +# This cop supports unsafe autocorrection (--autocorrect-all). +Rails/ApplicationRecord: Enabled: false -# Offense count: 8 +# Offense count: 10 # This cop supports unsafe autocorrection (--autocorrect-all). -Style/LineEndConcatenation: +# Configuration parameters: NilOrEmpty, NotPresent, UnlessPresent. +Rails/Blank: Exclude: - - 'spec/features/conference_spec.rb' - - 'spec/features/registration_periods_spec.rb' + - 'app/controllers/conferences_controller.rb' + - 'app/controllers/users/omniauth_callbacks_controller.rb' + - 'app/models/program.rb' + - 'app/models/user.rb' + - 'spec/factories/event_schedule.rb' + +# Offense count: 68 +# Configuration parameters: Database, Include. +# SupportedDatabases: mysql, postgresql +# Include: db/**/*.rb +Rails/BulkChangeTable: + Enabled: false + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +Rails/CompactBlank: + Exclude: + - 'app/controllers/surveys_controller.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Rails/ContentTag: + Exclude: + - 'app/helpers/application_helper.rb' + +# Offense count: 13 +# Configuration parameters: Include. +# Include: db/**/*.rb +Rails/CreateTableWithTimestamps: + Exclude: + - 'db/migrate/20121223115117_create_rooms_table.rb' + - 'db/migrate/20121223120413_create_event_types.rb' + - 'db/migrate/20130202130737_create_supporter_level_table.rb' + - 'db/migrate/20130202130923_create_table_supporter_registrations.rb' + - 'db/migrate/20130216070725_create_social_events_table.rb' + - 'db/migrate/20131228214532_create_vchoices.rb' + - 'db/migrate/20140109191145_create_qanswers.rb' + - 'db/migrate/20140623100942_create_visits.rb' + - 'db/migrate/20140623101032_create_ahoy_events.rb' + - 'db/migrate/20160309182642_remove_social_events_table.rb' + - 'db/migrate/20160628093634_create_survey_questions.rb' + - 'db/migrate/20170129075434_create_resources_table.rb' + - 'db/migrate/20170529215453_create_organizations.rb' + +# Offense count: 2 +# Configuration parameters: Severity, Include. +# Include: db/**/*.rb +Rails/DangerousColumnNames: + Exclude: + - 'db/migrate/20160403214841_add_id_and_created_at_to_events_registrations.rb' + - 'db/migrate/20160614145614_add_id_to_users_roles.rb' + +# Offense count: 103 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: EnforcedStyle, AllowToTime. +# SupportedStyles: strict, flexible +Rails/Date: + Enabled: false + +# Offense count: 3 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforceForPrefixed. +Rails/Delegate: + Exclude: + - 'app/models/event.rb' + - 'app/models/room.rb' + - 'app/models/track.rb' + +# Offense count: 4 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: Severity. +Rails/DuplicateAssociation: + Exclude: + - 'app/models/program.rb' + - 'app/models/user.rb' + +# Offense count: 3 +# This cop supports safe autocorrection (--autocorrect). +Rails/DurationArithmetic: + Exclude: + - 'spec/models/program_spec.rb' + - 'spec/models/user_spec.rb' + +# Offense count: 3 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: Whitelist, AllowedMethods, AllowedReceivers. +# Whitelist: find_by_sql, find_by_token_for +# AllowedMethods: find_by_sql, find_by_token_for +# AllowedReceivers: Gem::Specification, page +Rails/DynamicFindBy: + Exclude: + - 'app/controllers/admin/events_controller.rb' + - 'db/migrate/20140701123203_add_events_per_week_to_conference.rb' + +# Offense count: 5 +# This cop supports safe autocorrection (--autocorrect). +Rails/EagerEvaluationLogMessage: + Exclude: + - 'app/controllers/admin/events_controller.rb' + - 'app/controllers/application_controller.rb' + - 'app/controllers/proposals_controller.rb' + - 'app/models/event.rb' + +# Offense count: 3 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: Include. +# Include: app/models/**/*.rb +Rails/EnumHash: + Exclude: + - 'app/models/conference.rb' + - 'app/models/survey.rb' + - 'app/models/survey_question.rb' + +# Offense count: 7 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: slashes, arguments +Rails/FilePath: + Exclude: + - 'app/pdfs/ticket_pdf.rb' + - 'config/initializers/carrierwave.rb' + - 'lib/tasks/migrate_config.rake' + - 'spec/features/lodgings_spec.rb' + - 'spec/features/sponsor_spec.rb' + - 'spec/support/deprecation_shitlist.rb' + +# Offense count: 80 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: AllowedMethods, AllowedPatterns. +# AllowedMethods: order, limit, select, lock +Rails/FindEach: + Enabled: false + +# Offense count: 6 +# Configuration parameters: Include. +# Include: app/models/**/*.rb +Rails/HasAndBelongsToMany: + Exclude: + - 'app/models/conference.rb' + - 'app/models/qanswer.rb' + - 'app/models/question.rb' + - 'app/models/registration.rb' + - 'app/models/vchoice.rb' + +# Offense count: 24 +# Configuration parameters: Include. +# Include: app/models/**/*.rb +Rails/HasManyOrHasOneDependent: + Enabled: false + +# Offense count: 5 +# Configuration parameters: Include. +# Include: app/helpers/**/*.rb +Rails/HelperInstanceVariable: + Exclude: + - 'app/helpers/application_helper.rb' + - 'app/helpers/events_helper.rb' + - 'app/helpers/format_helper.rb' + +# Offense count: 8 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: numeric, symbolic +Rails/HttpStatus: + Exclude: + - 'app/controllers/admin/commercials_controller.rb' + - 'app/controllers/admin/event_schedules_controller.rb' + - 'app/controllers/admin/programs_controller.rb' + - 'app/controllers/admin/tracks_controller.rb' + - 'app/controllers/admin/venue_commercials_controller.rb' + - 'app/controllers/commercials_controller.rb' + +# Offense count: 99 +Rails/I18nLocaleTexts: + Enabled: false + +# Offense count: 7 +# Configuration parameters: IgnoreScopes, Include. +# Include: app/models/**/*.rb +Rails/InverseOf: + Exclude: + - 'app/models/booth.rb' + - 'app/models/conference.rb' + - 'app/models/event.rb' + - 'app/models/user.rb' + +# Offense count: 1 +# Configuration parameters: Include. +# Include: app/controllers/**/*.rb, app/mailers/**/*.rb +Rails/LexicallyScopedActionFilter: + Exclude: + - 'app/controllers/registrations_controller.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Rails/LinkToBlank: + Exclude: + - 'app/helpers/format_helper.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: Include. +# Include: app/mailers/**/*.rb +Rails/MailerName: + Exclude: + - 'app/mailers/mailbot.rb' + +# Offense count: 3 +Rails/OutputSafety: + Exclude: + - 'app/helpers/events_helper.rb' + - 'app/models/commercial.rb' + +# Offense count: 6 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: conservative, aggressive +Rails/PluckInWhere: + Exclude: + - 'app/models/ability.rb' + - 'app/models/admin_ability.rb' + +# Offense count: 16 +# This cop supports safe autocorrection (--autocorrect). +Rails/PluralizationGrammar: + Exclude: + - 'spec/models/conference_spec.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Rails/Presence: + Exclude: + - 'app/controllers/schedules_controller.rb' + - 'app/models/user.rb' + +# Offense count: 15 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: NotNilAndNotEmpty, NotBlank, UnlessBlank. +Rails/Present: + Exclude: + - 'app/models/cfp.rb' + - 'app/models/email_settings.rb' + - 'app/models/event.rb' + - 'app/models/program.rb' + - 'app/models/venue.rb' + +# Offense count: 5 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: Include. +# Include: **/Rakefile, **/*.rake +Rails/RakeEnvironment: + Exclude: + - 'lib/tasks/spec.rake' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: AllowedReceivers. +# AllowedReceivers: ActionMailer::Preview, ActiveSupport::TimeZone +Rails/RedundantActiveRecordAllMethod: + Exclude: + - 'db/migrate/20160309182655_remove_dietary_choices_table.rb' + +# Offense count: 19 +# This cop supports unsafe autocorrection (--autocorrect-all). +Rails/RedundantPresenceValidationOnBelongsTo: + Exclude: + - 'app/models/booth.rb' + - 'app/models/cfp.rb' + - 'app/models/comment.rb' + - 'app/models/contact.rb' + - 'app/models/event.rb' + - 'app/models/event_schedule.rb' + - 'app/models/events_registration.rb' + - 'app/models/payment.rb' + - 'app/models/qanswer.rb' + - 'app/models/question.rb' + - 'app/models/registration.rb' + - 'app/models/room.rb' + - 'app/models/sponsor.rb' + - 'app/models/survey_reply.rb' + - 'app/models/ticket_purchase.rb' + +# Offense count: 2 +Rails/RenderInline: + Exclude: + - 'app/controllers/conferences_controller.rb' + - 'app/controllers/schedules_controller.rb' + +# Offense count: 10 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: Include. +# Include: spec/controllers/**/*.rb, spec/requests/**/*.rb, test/controllers/**/*.rb, test/integration/**/*.rb +Rails/ResponseParsedBody: + Exclude: + - 'spec/controllers/api/v1/conferences_controller_spec.rb' + - 'spec/controllers/api/v1/events_controller_spec.rb' + - 'spec/controllers/api/v1/rooms_controller_spec.rb' + - 'spec/controllers/api/v1/speakers_controller_spec.rb' + - 'spec/controllers/api/v1/tracks_controller_spec.rb' + +# Offense count: 4 +# Configuration parameters: Include. +# Include: db/**/*.rb +Rails/ReversibleMigration: + Exclude: + - 'db/migrate/20170108053041_add_default_to_revision_in_conference.rb' + - 'db/migrate/20170715131706_make_track_state_not_null_and_add_default_value.rb' + - 'db/migrate/20170720134353_make_track_cfp_active_not_null.rb' + - 'db/migrate/20171118113113_change_visit_id_type_of_ahoy_events_to_integer.rb' + +# Offense count: 48 +# Configuration parameters: ForbiddenMethods, AllowedMethods. +# ForbiddenMethods: decrement!, decrement_counter, increment!, increment_counter, insert, insert!, insert_all, insert_all!, toggle!, touch, touch_all, update_all, update_attribute, update_column, update_columns, update_counters, upsert, upsert_all +Rails/SkipsModelValidations: + Enabled: false + +# Offense count: 77 +# Configuration parameters: Include. +# Include: db/**/*.rb +Rails/ThreeStateBooleanColumn: + Enabled: false + +# Offense count: 47 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: strict, flexible +Rails/TimeZone: + Exclude: + - 'app/models/comment.rb' + - 'app/models/conference.rb' + - 'config/environments/test.rb' + - 'db/migrate/20180226032958_add_created_at_and_updated_at_to_event_types.rb' + - 'db/migrate/20180313012253_add_timestamps_to_tickets.rb' + - 'spec/controllers/admin/comments_controller_spec.rb' + - 'spec/factories/users.rb' + - 'spec/helpers/application_helper_spec.rb' + - 'spec/models/conference_spec.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: Severity. +Rails/TopLevelHashWithIndifferentAccess: + Exclude: + - 'db/migrate/20140701123203_add_events_per_week_to_conference.rb' + +# Offense count: 12 +# Configuration parameters: Include. +# Include: app/models/**/*.rb +Rails/UniqueValidationWithoutIndex: + Exclude: + - 'app/models/booth.rb' + - 'app/models/cfp.rb' + - 'app/models/commercial.rb' + - 'app/models/conference.rb' + - 'app/models/events_registration.rb' + - 'app/models/registration.rb' + - 'app/models/role.rb' + - 'app/models/subscription.rb' + - 'app/models/survey_reply.rb' + - 'app/models/survey_submission.rb' + - 'app/models/track.rb' + - 'app/models/vote.rb' + +# Offense count: 17 +# This cop supports unsafe autocorrection (--autocorrect-all). +Rails/WhereEquals: + Exclude: + - 'app/controllers/admin/registrations_controller.rb' + - 'app/models/admin_ability.rb' + - 'app/models/conference.rb' + - 'app/models/event_schedule.rb' + - 'app/models/program.rb' + - 'app/models/user.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Rails/WhereNot: + Exclude: + - 'db/migrate/20140820093735_migrating_supporter_registrations_to_ticket_users.rb' + +# Offense count: 3 +Security/Open: + Exclude: + - 'app/pdfs/ticket_pdf.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: separated, grouped +Style/AccessorGrouping: + Exclude: + - 'app/models/payment.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowOnlyRestArgument, UseAnonymousForwarding, RedundantRestArgumentNames, RedundantKeywordRestArgumentNames, RedundantBlockArgumentNames. +# RedundantRestArgumentNames: args, arguments +# RedundantKeywordRestArgumentNames: kwargs, options, opts +# RedundantBlockArgumentNames: blk, block, proc +Style/ArgumentsForwarding: + Exclude: + - 'app/models/user.rb' + +# Offense count: 3 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/ArrayIntersect: + Exclude: + - 'app/helpers/application_helper.rb' + - 'app/models/admin_ability.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: MinBranchesCount. +Style/CaseLikeIf: + Exclude: + - 'app/views/admin/events/events.xlsx.axlsx' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: is_a?, kind_of? +Style/ClassCheck: + Exclude: + - 'app/models/email_settings.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Style/ColonMethodCall: + Exclude: + - 'app/models/commercial.rb' + - 'app/models/contact.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/CombinableLoops: + Exclude: + - 'db/migrate/20140820093735_migrating_supporter_registrations_to_ticket_users.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: Keywords, RequireColon. +# Keywords: TODO, FIXME, OPTIMIZE, HACK, REVIEW, NOTE +Style/CommentAnnotation: + Exclude: + - 'spec/controllers/admin/versions_controller_spec.rb' # Offense count: 3 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions. +# SupportedStyles: assign_to_condition, assign_inside_condition +Style/ConditionalAssignment: + Exclude: + - 'app/helpers/format_helper.rb' + - 'db/migrate/20140610165551_migrate_data_person_to_user.rb' + - 'db/migrate/20140820124117_undo_wrong_migration20140801080705_add_users_to_events.rb' + +# Offense count: 517 +# Configuration parameters: AllowedConstants. +Style/Documentation: + Enabled: false + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Style/EmptyCaseCondition: + Exclude: + - 'app/helpers/format_helper.rb' + - 'app/helpers/versions_helper.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Style/EmptyLiteral: + Exclude: + - 'spec/models/conference_spec.rb' + +# Offense count: 7 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AutoCorrect, EnforcedStyle. +# SupportedStyles: compact, expanded +Style/EmptyMethod: + Exclude: + - 'app/controllers/admin/lodgings_controller.rb' + - 'app/controllers/users_controller.rb' + - 'db/migrate/20121223115125_create_tracks_table.rb' + - 'db/migrate/20121223115135_create_events_table.rb' + - 'db/migrate/20130103134212_create_registrations_table.rb' + - 'db/migrate/20130206192339_rename_attending_social_events_with_partner.rb' + - 'db/migrate/20130216122155_set_registration_defaults_to_false.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Style/Encoding: + Exclude: + - 'app/uploaders/picture_uploader.rb' + - 'spec/models/conference_spec.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Style/ExpandPathArguments: + Exclude: + - 'spec/spec_helper.rb' + +# Offense count: 38 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: always, always_true, never +Style/FrozenStringLiteralComment: + Enabled: false + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/GlobalStdStream: + Exclude: + - 'config/environments/production.rb' + +# Offense count: 27 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: MinBodyLength, AllowConsecutiveConditionals. +Style/GuardClause: + Enabled: false + +# Offense count: 1 +# Configuration parameters: MinBranchesCount. +Style/HashLikeCase: + Exclude: + - 'app/helpers/versions_helper.rb' + +# Offense count: 346 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. +# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys +# SupportedShorthandSyntax: always, never, either, consistent, either_consistent +Style/HashSyntax: + Enabled: false + +# Offense count: 2 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/HashTransformValues: + Exclude: + - 'app/controllers/admin/comments_controller.rb' + - 'app/helpers/chart_helper.rb' + +# Offense count: 56 +# This cop supports safe autocorrection (--autocorrect). +Style/IfUnlessModifier: + Enabled: false + +# Offense count: 1 # This cop supports unsafe autocorrection (--autocorrect-all). Style/MapToHash: Exclude: @@ -660,19 +1746,130 @@ Style/RedundantFetchBlock: Exclude: - 'config/puma.rb' +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/RedundantFilterChain: + Exclude: + - 'app/models/program.rb' + +# Offense count: 12 +# This cop supports safe autocorrection (--autocorrect). +Style/RedundantParentheses: + Exclude: + - 'app/controllers/admin/base_controller.rb' + - 'app/controllers/application_controller.rb' + - 'app/helpers/application_helper.rb' + - 'app/helpers/format_helper.rb' + - 'app/models/admin_ability.rb' + - 'app/models/conference.rb' + - 'app/models/program.rb' + - 'app/models/venue.rb' + - 'lib/tasks/version.rake' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowMultipleReturnValues. +Style/RedundantReturn: + Exclude: + - 'app/controllers/admin/booths_controller.rb' + - 'app/controllers/admin/events_controller.rb' + # Offense count: 2 # This cop supports safe autocorrection (--autocorrect). Style/RedundantStringEscape: Exclude: - 'app/models/conference.rb' -# Offense count: 34 +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, AllowInnerSlashes. +# SupportedStyles: slashes, percent_r, mixed +Style/RegexpLiteral: + Exclude: + - 'app/uploaders/picture_uploader.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: implicit, explicit +Style/RescueStandardError: + Exclude: + - 'app/controllers/users/omniauth_callbacks_controller.rb' + - 'lib/tasks/migrate_config.rake' + +# Offense count: 3 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: only_raise, only_fail, semantic +Style/SignalException: + Exclude: + - 'lib/tasks/user.rake' + - 'spec/support/flash.rb' + +# Offense count: 6 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowModifier. +Style/SoleNestedConditional: + Exclude: + - 'app/controllers/admin/users_controller.rb' + - 'app/models/event.rb' + - 'app/models/user.rb' + - 'db/migrate/20140801164901_move_conference_media_to_commercial.rb' + - 'db/migrate/20140801170430_move_event_media_to_commercial.rb' + - 'db/migrate/20151018152439_create_programs_table.rb' + +# Offense count: 20 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: Mode. Style/StringConcatenation: + Exclude: + - 'app/controllers/admin/commercials_controller.rb' + - 'app/controllers/admin/conferences_controller.rb' + - 'app/controllers/admin/events_controller.rb' + - 'app/controllers/admin/roles_controller.rb' + - 'app/controllers/admin/surveys_controller.rb' + - 'app/controllers/payments_controller.rb' + - 'app/helpers/application_helper.rb' + - 'app/helpers/users_helper.rb' + - 'app/helpers/versions_helper.rb' + - 'app/models/commercial.rb' + - 'app/models/conference.rb' + - 'lib/tasks/data.rake' + - 'spec/features/contact_spec.rb' + - 'spec/helpers/events_helper_spec.rb' + +# Offense count: 12 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. +# SupportedStyles: single_quotes, double_quotes +Style/StringLiterals: + Exclude: + - 'Gemfile' + - 'config/deploy.rb' + - 'config/environments/production.rb' + - 'config/puma.rb' + - 'lib/tasks/events_registrations.rake' + - 'lib/tasks/factory_bot.rake' + - 'lib/tasks/user.rake' + +# Offense count: 8 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: single_quotes, double_quotes +Style/StringLiteralsInInterpolation: + Exclude: + - 'app/views/admin/events/_all_events.xlsx.axlsx' + - 'app/views/admin/events/_all_with_comments.xlsx.axlsx' + - 'app/views/admin/events/_confirmed_events.xlsx.axlsx' + +# Offense count: 105 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, MinSize. +# SupportedStyles: percent, brackets +Style/SymbolArray: Enabled: false -# Offense count: 11 +# Offense count: 10 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, AllowComments. # AllowedMethods: define_method, mail, respond_to @@ -685,7 +1882,24 @@ Style/SymbolProc: - 'spec/controllers/admin/conferences_controller_spec.rb' - 'spec/support/flash.rb' -# Offense count: 1 +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, AllowSafeAssignment. +# SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex +Style/TernaryParentheses: + Exclude: + - 'app/helpers/format_helper.rb' + +# Offense count: 21 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyleForMultiline. +# SupportedStylesForMultiline: comma, consistent_comma, no_comma +Style/TrailingCommaInHashLiteral: + Exclude: + - 'db/migrate/20140701123203_add_events_per_week_to_conference.rb' + - 'spec/models/conference_spec.rb' + +# Offense count: 3 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: WordRegex. # SupportedStyles: percent, brackets @@ -693,7 +1907,7 @@ Style/WordArray: EnforcedStyle: percent MinSize: 5 -# Offense count: 269 +# Offense count: 497 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. # URISchemes: http, https diff --git a/CHANGES.md b/CHANGES.md index 0080f6214..6da2b7496 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -41,18 +41,6 @@ data. bundle exec rake data:set_conference_in_versions RAILS_ENV=production ``` -### Organization admins - -We have a new role `organization admins` which allow a user to manage their -organization and create and manage a conference within the organization. This -needs the role to exist in the database, otherwise the application crashes -as it is assumed to exist. For that, run the following rake task: - -``` -bundle exec rake roles:add RAILS_ENV=production -``` - - # Changes in OSEM 1.0 [Released May 24, 2016](https://osem.io/1.0) diff --git a/Dockerfile b/Dockerfile index bd87877c8..9e18612e9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,10 @@ USER osem WORKDIR /osem/ # Install our bundle -RUN bundle install --jobs=3 --retry=3 +RUN bundle config set --local path 'vendor/bundle'; \ + bundle install --jobs=4 --retry=3 + +# Install our process manager +RUN sudo gem install foreman CMD ["foreman", "start"] diff --git a/Gemfile b/Gemfile index 20f29d553..1e49fae8f 100644 --- a/Gemfile +++ b/Gemfile @@ -22,7 +22,7 @@ gem 'puma' # http://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html#responders gem 'responders', '~> 3.0' -# as supported databases +# as database gem 'pg' # for tracking data changes @@ -91,9 +91,6 @@ gem 'jquery-ui-rails', '~> 7.0.0' # for languages validation gem 'iso-639' -# as date picker -gem 'bootstrap3-datetimepicker-rails', '~> 4.17.47' - # data tables gem 'ajax-datatables-rails' gem 'jquery-datatables' @@ -229,9 +226,7 @@ group :test do gem 'cucumber-rails', require: false gem 'cucumber-rails-training-wheels' # basic imperative step defs like "Then I should see..." gem 'database_cleaner' - gem 'geckodriver-helper' gem 'rspec-rails' - gem 'webdrivers' # for measuring test coverage gem 'simplecov' gem 'simplecov-cobertura' @@ -256,9 +251,6 @@ group :test do end group :development, :test, :linters do - # as debugger - gem 'byebug' - # for static code analisys gem 'rubocop', require: false gem 'rubocop-rspec', require: false @@ -278,8 +270,11 @@ group :development, :test, :linters do end group :development, :test do - # as development/test database - gem 'sqlite3' + # as capybara driver + gem 'webdrivers' + gem 'geckodriver-helper' + # as debugger + gem 'byebug' # to test new rails version gem 'next_rails' end diff --git a/Gemfile.lock b/Gemfile.lock index 12e3a7d04..8b30c6b9d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -10,7 +10,7 @@ GIT GEM remote: https://rubygems.org/ specs: - Ascii85 (1.1.0) + Ascii85 (1.1.1) actioncable (7.0.8.4) actionpack (= 7.0.8.4) activesupport (= 7.0.8.4) @@ -85,13 +85,14 @@ GEM activerecord (>= 4.0) activesupport (>= 4.0) awesome_nested_set (>= 3.0) - acts_as_list (1.1.0) - activerecord (>= 4.2) + acts_as_list (1.2.1) + activerecord (>= 6.1) + activesupport (>= 6.1) addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) afm (0.2.2) - ajax-datatables-rails (1.4.0) - rails (>= 5.2) + ajax-datatables-rails (1.5.0) + rails (>= 6.0) zeitwerk annotate (3.2.0) activerecord (>= 3.2, < 8.0) @@ -103,22 +104,20 @@ GEM execjs (~> 2) awesome_nested_set (3.6.0) activerecord (>= 4.0.0, < 7.2) - aws_cf_signer (0.1.3) + base64 (0.2.0) bcrypt (3.1.20) - bigdecimal (3.1.6) + bigdecimal (3.1.8) bindex (0.8.1) bootstrap-sass (3.4.1) autoprefixer-rails (>= 5.2.1) sassc (>= 2.0.0) bootstrap-switch-rails (3.3.3) - bootstrap3-datetimepicker-rails (4.17.47) - momentjs-rails (>= 2.8.1) builder (3.3.0) bullet (7.0.2) activesupport (>= 3.0.0) uniform_notifier (~> 1.11) byebug (11.1.3) - cancancan (3.5.0) + cancancan (3.6.1) capybara (3.40.0) addressable matrix @@ -128,9 +127,9 @@ GEM rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) - carrierwave (2.2.6) - activemodel (>= 5.0.0) - activesupport (>= 5.0.0) + carrierwave (3.0.7) + activemodel (>= 6.0.0) + activesupport (>= 6.0.0) addressable (~> 2.6) image_processing (~> 1.1) marcel (~> 1.0.0) @@ -142,7 +141,7 @@ GEM fastimage case_transform (0.2) activesupport - caxlsx (3.4.1) + caxlsx (4.1.0) htmlentities (~> 4.3, >= 4.3.4) marcel (~> 1.0) nokogiri (~> 1.10, >= 1.10.4) @@ -150,13 +149,15 @@ GEM caxlsx_rails (0.6.3) actionpack (>= 3.1) caxlsx (>= 3.0) - chartkick (5.0.6) + chartkick (5.0.7) + childprocess (5.0.0) chronic (0.10.2) chunky_png (1.4.0) climate_control (1.2.0) - cloudinary (1.29.0) - aws_cf_signer - rest-client (>= 2.0.0) + cloudinary (2.1.1) + faraday (>= 2.0.1, < 3.0.0) + faraday-follow_redirects (~> 0.3.0) + faraday-multipart (~> 1.0, >= 1.0.4) cocoon (1.2.15) colorize (1.1.0) concurrent-ruby (1.3.3) @@ -221,7 +222,7 @@ GEM delayed_job_active_record (4.1.8) activerecord (>= 3.0, < 8.0) delayed_job (>= 3.0, < 5) - devise (4.9.3) + devise (4.9.4) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) @@ -231,11 +232,10 @@ GEM devise (>= 2.2) diff-lcs (1.5.1) docile (1.4.0) - domain_name (0.6.20240107) - dotenv (2.8.1) - dotenv-rails (2.8.1) - dotenv (= 2.8.1) - railties (>= 3.2) + dotenv (3.1.2) + dotenv-rails (3.1.2) + dotenv (= 3.1.2) + railties (>= 6.1) erubi (1.13.0) execjs (2.9.1) factory_bot (6.4.6) @@ -243,20 +243,24 @@ GEM factory_bot_rails (6.4.3) factory_bot (~> 6.4) railties (>= 5.0.0) - faker (3.2.3) + faker (3.4.1) i18n (>= 1.8.11, < 2) - faraday (2.9.0) + faraday (2.9.1) faraday-net_http (>= 2.0, < 3.2) + faraday-follow_redirects (0.3.0) + faraday (>= 1, < 3) + faraday-multipart (1.0.4) + multipart-post (~> 2) faraday-net_http (3.1.0) net-http faraday-retry (2.2.0) faraday (~> 2.0) - fastimage (2.3.0) + fastimage (2.3.!) feature (1.4.0) ffi (1.17.0-arm64-darwin) ffi (1.17.0-x86_64-darwin) ffi (1.17.0-x86_64-linux-gnu) - font-awesome-sass (6.5.1) + font-awesome-sass (6.5.2) sassc (~> 2.0) geckodriver-helper (0.24.0) archive-zip (~> 0.7) @@ -266,7 +270,7 @@ GEM globalid (1.2.1) activesupport (>= 6.1) gravtastic (3.2.6) - haml (6.1.1) + haml (6.3.0) temple (>= 0.8.2) thor tilt @@ -277,11 +281,11 @@ GEM activesupport (>= 5.1) haml (>= 4.0.6) railties (>= 5.1) - haml_lint (0.45.0) - haml (>= 4.0, < 6.2) + haml_lint (0.58.0) + haml (>= 5.0) parallel (~> 1.10) rainbow - rubocop (>= 0.50.0) + rubocop (>= 1.0) sysexits (~> 1.1) hashdiff (1.1.0) hashery (2.1.2) @@ -312,22 +316,25 @@ GEM thor (>= 0.14, < 2.0) jquery-ui-rails (7.0.0) railties (>= 3.2.16) - json (2.7.1) - json-schema (4.1.1) + json (2.7.2) + json-schema (4.3.0) addressable (>= 2.8) jsonapi-renderer (0.2.2) - jwt (2.7.1) + jwt (2.8.2) + base64 language_server-protocol (3.17.0.3) - launchy (2.5.2) + launchy (3.0.1) addressable (~> 2.8) - leaflet-rails (1.9.3) - rails (>= 4.2.0) - letter_opener (1.9.0) - launchy (>= 2.2, < 3) - letter_opener_web (2.0.0) - actionmailer (>= 5.2) - letter_opener (~> 1.7) - railties (>= 5.2) + childprocess (~> 5.0) + leaflet-rails (1.9.4) + actionpack (>= 4.2.0) + railties (>= 4.2.0) + letter_opener (1.10.0) + launchy (>= 2.2, < 4) + letter_opener_web (3.0.0) + actionmailer (>= 6.1) + letter_opener (~> 1.9) + railties (>= 6.1) rexml logger (1.6.0) lograge (0.14.0) @@ -345,20 +352,16 @@ GEM net-smtp marcel (1.0.4) matrix (0.4.2) - method_source (1.0.0) - mime-types (3.5.2) - mime-types-data (~> 3.2015) - mime-types-data (3.2024.0206) + method_source (1.1.0) mina (1.2.5) rake mini_magick (4.13.2) mini_mime (1.1.5) + mini_portile2 (2.8.7) minitest (5.24.1) - momentjs-rails (2.29.4.1) - railties (>= 3.1) monetize (1.13.0) money (~> 6.12) - money (6.18.0) + money (6.19.0) i18n (>= 0.6.4, <= 2) money-rails (1.15.0) activesupport (>= 3.0) @@ -366,23 +369,23 @@ GEM money (~> 6.13) railties (>= 3.0) multi_json (1.15.0) - multi_test (0.1.2) - multi_xml (0.6.0) + multi_xml (0.7.1) + bigdecimal (~> 3.1) + multipart-post (2.4.1) net-http (0.4.1) uri - net-imap (0.4.10) + net-imap (0.4.14) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout - net-smtp (0.4.0.1) + net-smtp (0.5.0) net-protocol - netrc (0.11.0) next_rails (1.3.0) colorize (>= 0.8.1) - nio4r (2.7.0) + nio4r (2.7.3) nokogiri (1.16.6-arm64-darwin) racc (~> 1.4) nokogiri (1.16.6-x86_64-darwin) @@ -399,39 +402,40 @@ GEM octokit (6.1.1) faraday (>= 1, < 3) sawyer (~> 0.9) - omniauth (2.1.1) + omniauth (2.1.2) hashie (>= 3.4.6) rack (>= 2.2.3) rack-protection - omniauth-facebook (9.0.0) - omniauth-oauth2 (~> 1.2) + omniauth-facebook (10.0.0) + bigdecimal + omniauth-oauth2 (>= 1.2, < 3) omniauth-github (2.0.1) omniauth (~> 2.0) omniauth-oauth2 (~> 1.8) - omniauth-google-oauth2 (1.1.1) + omniauth-google-oauth2 (1.1.2) jwt (>= 2.0) - oauth2 (~> 2.0.6) + oauth2 (~> 2.0) omniauth (~> 2.0) - omniauth-oauth2 (~> 1.8.0) + omniauth-oauth2 (~> 1.8) omniauth-oauth2 (1.8.0) oauth2 (>= 1.4, < 3) omniauth (~> 2.0) omniauth-openid (2.0.1) omniauth (>= 1.0, < 3.0) rack-openid (~> 1.4.0) - omniauth-rails_csrf_protection (1.0.1) + omniauth-rails_csrf_protection (1.0.2) actionpack (>= 4.2) omniauth (~> 2.0) orm_adapter (0.5.0) pagy (3.11.0) - paper_trail (12.3.0) - activerecord (>= 5.2) - request_store (~> 1.1) - parallel (1.24.0) - parser (3.3.0.5) + paper_trail (15.1.0) + activerecord (>= 6.1) + request_store (~> 1.4) + parallel (1.25.1) + parser (3.3.4.0) ast (~> 2.4.1) racc - pdf-core (0.9.0) + pdf-core (0.10.0) pdf-inspector (1.3.0) pdf-reader (>= 1.0, < 3.0.a) pdf-reader (2.12.0) @@ -441,9 +445,10 @@ GEM ruby-rc4 ttfunk pg (1.5.6) - prawn (2.4.0) - pdf-core (~> 0.9.0) - ttfunk (~> 1.7) + prawn (2.5.0) + matrix (~> 0.4) + pdf-core (~> 0.10.0) + ttfunk (~> 1.8) prawn-qrcode (0.5.2) prawn (>= 1) rqrcode (>= 1.0.0) @@ -475,8 +480,9 @@ GEM rack-openid (1.4.2) rack (>= 1.1.0) ruby-openid (>= 2.1.8) - rack-protection (3.0.6) - rack + rack-protection (3.2.0) + base64 (>= 0.1.0) + rack (~> 2.2, >= 2.2.4) rack-test (2.1.0) rack (>= 1.3) rails (7.0.8.4) @@ -504,7 +510,7 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - rails-i18n (7.0.8) + rails-i18n (7.0.9) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 8) railties (7.0.8.4) @@ -515,22 +521,17 @@ GEM thor (~> 1.0) zeitwerk (~> 2.5) rainbow (3.1.1) - rake (13.1.0) + rake (13.2.1) recaptcha (5.16.0) redcarpet (3.6.0) redis (4.7.1) - regexp_parser (2.9.0) - request_store (1.6.0) + regexp_parser (2.9.2) + request_store (1.7.0) rack (>= 1.4) responders (3.1.1) actionpack (>= 5.2) railties (>= 5.2) - rest-client (2.1.0) - http-accept (>= 1.7.0, < 2.0) - http-cookie (>= 1.0.2, < 2.0) - mime-types (>= 1.16, < 4.0) - netrc (~> 0.8) - rexml (3.3.3) + rexml (3.3.4) strscan rolify (6.0.1) rqrcode (2.2.0) @@ -543,49 +544,53 @@ GEM rspec-mocks (>= 2.99, < 4.0) rspec-core (3.13.0) rspec-support (~> 3.13.0) - rspec-expectations (3.13.0) + rspec-expectations (3.13.1) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-mocks (3.13.0) + rspec-mocks (3.13.1) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-rails (6.1.1) + rspec-rails (6.1.2) actionpack (>= 6.1) activesupport (>= 6.1) railties (>= 6.1) - rspec-core (~> 3.12) - rspec-expectations (~> 3.12) - rspec-mocks (~> 3.12) - rspec-support (~> 3.12) + rspec-core (~> 3.13) + rspec-expectations (~> 3.13) + rspec-mocks (~> 3.13) + rspec-support (~> 3.13) rspec-support (3.13.1) - rubocop (1.61.0) + rubocop (1.65.0) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8, < 3.0) + regexp_parser (>= 2.4, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.30.0, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.31.1) - parser (>= 3.3.0.4) + rubocop-ast (1.31.3) + parser (>= 3.3.1.0) rubocop-capybara (2.20.0) rubocop (~> 1.41) rubocop-factory_bot (2.25.1) rubocop (~> 1.41) - rubocop-performance (1.20.2) + rubocop-performance (1.21.1) rubocop (>= 1.48.1, < 2.0) - rubocop-ast (>= 1.30.0, < 2.0) - rubocop-rails (2.19.1) + rubocop-ast (>= 1.31.1, < 2.0) + rubocop-rails (2.24.1) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) - rubocop-rspec (2.23.0) - rubocop (~> 1.33) + rubocop-ast (>= 1.31.1, < 2.0) + rubocop-rspec (2.29.2) + rubocop (~> 1.40) rubocop-capybara (~> 2.17) rubocop-factory_bot (~> 2.22) + rubocop-rspec_rails (~> 2.28) + rubocop-rspec_rails (2.28.3) + rubocop (~> 1.40) ruby-oembed (0.17.0) ruby-openid (2.9.2) ruby-progressbar (1.13.0) @@ -613,15 +618,13 @@ GEM rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) - sentry-delayed_job (5.16.1) - delayed_job (>= 4.0) - sentry-ruby (~> 5.16.1) - sentry-rails (5.16.1) + sentry-rails (5.17.3) railties (>= 5.0) - sentry-ruby (~> 5.16.1) - sentry-ruby (5.16.1) + sentry-ruby (~> 5.17.3) + sentry-ruby (5.17.3) + bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) - shoulda-matchers (6.1.0) + shoulda-matchers (6.2.0) activesupport (>= 5.2.0) simple_po_parser (1.1.6) simplecov (0.19.0) @@ -639,13 +642,10 @@ GEM sprockets (4.2.1) concurrent-ruby (~> 1.0) rack (>= 2.2.4, < 4) - sprockets-rails (3.4.2) - actionpack (>= 5.2) - activesupport (>= 5.2) + sprockets-rails (3.5.1) + actionpack (>= 6.1) + activesupport (>= 6.1) sprockets (>= 3.0.0) - sqlite3 (1.7.2-arm64-darwin) - sqlite3 (1.7.2-x86_64-darwin) - sqlite3 (1.7.2-x86_64-linux) ssrf_filter (1.1.2) stripe (5.55.0) stripe-ruby-mock (3.1.0) @@ -653,14 +653,12 @@ GEM multi_json (~> 1.0) stripe (> 5, < 6) strscan (3.1.0) - sys-uname (1.2.2) - ffi (~> 1.1) sysexits (1.2.0) temple (0.10.3) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) thor (1.3.1) - tilt (2.1.0) + tilt (2.3.0) timecop (0.9.8) timeout (0.4.1) transitions (1.3.0) @@ -678,7 +676,7 @@ GEM unobtrusive_flash (3.3.1) railties uri (0.13.0) - version_gem (1.1.3) + version_gem (1.1.4) warden (1.2.9) rack (>= 2.0.9) web-console (4.2.1) @@ -690,12 +688,11 @@ GEM nokogiri (~> 1.6) rubyzip (>= 1.3.0) selenium-webdriver (~> 4.0, < 4.11) - webmock (3.23.0) + webmock (3.23.1) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - webrick (1.8.1) - websocket (1.2.9) + websocket (1.2.11) websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) @@ -703,7 +700,7 @@ GEM chronic (>= 0.6.3) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.13) + zeitwerk (2.6.16) PLATFORMS arm64-darwin-20 @@ -722,7 +719,6 @@ DEPENDENCIES awesome_nested_set bootstrap-sass (~> 3.4.0) bootstrap-switch-rails (= 3.3.3) - bootstrap3-datetimepicker-rails (~> 4.17.47) bullet byebug cancancan @@ -815,7 +811,6 @@ DEPENDENCIES simplecov simplecov-cobertura sprockets-rails - sqlite3 stripe stripe-ruby-mock (~> 3.1.0.rc3) timecop diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 8284fbf80..8c5ce7d78 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -37,8 +37,6 @@ //= require momentjs //= require leaflet //= require holderjs -//= require bootstrap-datetimepicker -//= require osem-datepickers //= require osem-datatables //= require osem-tickets //= require bootstrap-switch diff --git a/app/assets/javascripts/osem-datepickers.js b/app/assets/javascripts/osem-datepickers.js deleted file mode 100644 index e603d15d0..000000000 --- a/app/assets/javascripts/osem-datepickers.js +++ /dev/null @@ -1,62 +0,0 @@ -$(function () { - $("input[id^='datetimepicker']").datetimepicker({ - useCurrent: false, - sideBySide: true, - format: 'YYYY-MM-DD HH:mm' - }); - - $('.datetimepicker').datetimepicker({ - useCurrent: false, - sideBySide: true, - format: 'YYYY-MM-DD HH:mm' - }); - - $("#conference-start-datepicker").datetimepicker({ - useCurrent: false, - ignoreReadonly: true, - format: "YYYY-MM-DD", - }); - - $("#conference-end-datepicker").datetimepicker({ - useCurrent: false, - ignoreReadonly: true, - format: "YYYY-MM-DD" - }); - - $('#registration-period-start-datepicker').datetimepicker({ - format: 'YYYY-MM-DD' - }); - - $('#registration-period-end-datepicker').datetimepicker({ - format: 'YYYY-MM-DD' - }); - - $("#conference-start-datepicker").on("dp.change",function (e) { - $('#conference-end-datepicker').data("DateTimePicker").minDate(e.date); - if (!$('#conference-end-datepicker').val()) { - $('#conference-end-datepicker').data("DateTimePicker").date(e.date); - } - }); - - $("#conference-start-datepicker").change(function (e) { - $('#conference-start-datepicker').val()?$('#conference-end-datepicker').data("DateTimePicker").minDate(e.date):$('#conference-end-datepicker').data("DateTimePicker").minDate(null); - }); - - $("#conference-end-datepicker").on("dp.change",function (e) { - $('#conference-start-datepicker').data("DateTimePicker").maxDate(e.date); - }); - - $("#conference-end-datepicker").change(function (e) { - $('#conference-end-datepicker').val()?$('#conference-start-datepicker').data("DateTimePicker").maxDate(e.date):$('#conference-start-datepicker').data("DateTimePicker").maxDate(null); - }); - - $("#registration-period-start-datepicker").on("dp.change",function (e) { - $('#registration-period-end-datepicker').data("DateTimePicker").minDate(e.date); - if (!$('#registration-period-end-datepicker').val()) { - $('#registration-period-end-datepicker').data("DateTimePicker").date(e.date); - } - }); - $("#registration-period-end-datepicker").on("dp.change",function (e) { - $('#registration-period-start-datepicker').data("DateTimePicker").maxDate(e.date); - }); -} ); diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 7c23a0d90..09fa0ee32 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -17,7 +17,6 @@ *= require osem-splash *= require osem-fonts *= require bootstrap-markdown - *= require bootstrap-datetimepicker *= require leaflet *= require bootstrap3-switch *= require osem-payments diff --git a/app/assets/stylesheets/jquery-ui-timepicker-addon.css b/app/assets/stylesheets/jquery-ui-timepicker-addon.css deleted file mode 100644 index b93a85f62..000000000 --- a/app/assets/stylesheets/jquery-ui-timepicker-addon.css +++ /dev/null @@ -1,10 +0,0 @@ -.ui-timepicker-div .ui-widget-header { margin-bottom: 8px; } -.ui-timepicker-div dl { text-align: left; } -.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; } -.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; } -.ui-timepicker-div td { font-size: 90%; } -.ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; } - -.ui-timepicker-rtl{ direction: rtl; } -.ui-timepicker-rtl dl { text-align: right; } -.ui-timepicker-rtl dl dd { margin: 0 65px 10px 10px; } \ No newline at end of file diff --git a/app/assets/stylesheets/strap-on.scss b/app/assets/stylesheets/strap-on.scss index bd2d3b38b..c0ed17dc8 100644 --- a/app/assets/stylesheets/strap-on.scss +++ b/app/assets/stylesheets/strap-on.scss @@ -1,6 +1,13 @@ // Place bootstrap variable customizations in the file below. + +$navbar-default-bg: #299a0b; +$navbar-default-link-active-bg: #DFE0DF; +$navbar-default-border: 1px solid #d4d4d4; +$navbar-default-color: #ffffff; +$navbar-default-link-color: #ffffff; +$navbar-default-link-hover-color: #000000; @import "osem-variables"; -@import 'bootstrap-datetimepicker'; + @import "bootstrap-sprockets"; // diff --git a/app/controllers/admin/base_controller.rb b/app/controllers/admin/base_controller.rb index 2229d983d..cab04889a 100644 --- a/app/controllers/admin/base_controller.rb +++ b/app/controllers/admin/base_controller.rb @@ -21,9 +21,7 @@ def verify_user_admin return false end unless (current_user.has_cached_role? :organizer, :any) || (current_user.has_cached_role? :cfp, :any) || - (current_user.has_cached_role? :info_desk, - :any) || (current_user.has_cached_role? :organization_admin, :any) || - (current_user.has_cached_role? :volunteers_coordinator, :any) || + (current_user.has_cached_role? :info_desk, :any) || (current_user.has_cached_role? :volunteers_coordinator, :any) || (current_user.has_cached_role? :track_organizer, :any) || current_user.is_admin raise CanCan::AccessDenied.new('You are not authorized to access this page.') end diff --git a/app/controllers/admin/conferences_controller.rb b/app/controllers/admin/conferences_controller.rb index 17d2bc131..765f4a3b8 100644 --- a/app/controllers/admin/conferences_controller.rb +++ b/app/controllers/admin/conferences_controller.rb @@ -180,7 +180,7 @@ def conference_params :use_vpositions, :use_vdays, :vdays_attributes, :vpositions_attributes, :use_volunteers, :color, :sponsorship_levels_attributes, :sponsors_attributes, - :registration_limit, :organization_id, :ticket_layout, + :registration_limit, :code_of_conduct, :ticket_layout, :booth_limit, :custom_css, :registered_attendees_message) end end diff --git a/app/controllers/admin/events_controller.rb b/app/controllers/admin/events_controller.rb index 939b4d967..9d5476b4b 100644 --- a/app/controllers/admin/events_controller.rb +++ b/app/controllers/admin/events_controller.rb @@ -63,7 +63,6 @@ def edit @comment_count = @event.comment_threads.count @user = @event.submitter @url = admin_conference_program_event_path(@conference.short_title, @event) - @languages = @program.languages_list @superevents = @program.events.where(superevent: true) end @@ -78,7 +77,6 @@ def comment end def update - @languages = @program.languages_list if @event.update(event_params) if request.xhr? @@ -96,7 +94,6 @@ def update def create @url = admin_conference_program_events_path(@conference.short_title, @event) - @languages = @program.languages_list @event.submitter = current_user @superevents = @program.events.where(superevent: true) @@ -111,7 +108,6 @@ def create def new @url = admin_conference_program_events_path(@conference.short_title, @event) - @languages = @program.languages_list @superevents = @program.events.where(superevent: true) end diff --git a/app/controllers/admin/organizations_controller.rb b/app/controllers/admin/organizations_controller.rb deleted file mode 100644 index f885edb8d..000000000 --- a/app/controllers/admin/organizations_controller.rb +++ /dev/null @@ -1,98 +0,0 @@ -# frozen_string_literal: true - -module Admin - class OrganizationsController < Admin::BaseController - load_and_authorize_resource :organization - before_action :verify_user, only: %i[assign_org_admins unassign_org_admins] - - def index - @organizations = Organization.all - end - - def create - @organization = Organization.new(organization_params) - if @organization.save - redirect_to admin_organizations_path, - notice: 'Organization successfully created' - else - redirect_to new_admin_organization_path, - error: @organization.errors.full_messages.join(', ') - end - end - - def new - @organization = Organization.new - end - - def edit; end - - def update - if @organization.update(organization_params) - redirect_to admin_organizations_path, - notice: 'Organization successfully updated' - else - redirect_to edit_admin_organization_path(@organization), - error: @organization.errors.full_messages.join(', ') - end - end - - def destroy - if @organization.destroy - redirect_to admin_organizations_path, - notice: 'Organization successfully destroyed' - else - redirect_to admin_organizations_path, - error: 'Organization cannot be destroyed' - end - end - - def assign_org_admins - if @user.has_cached_role? 'organization_admin', @organization - flash[:error] = "User #{@user.email} already has the role organization admin" - elsif @user.add_role 'organization_admin', @organization - flash[:notice] = "Successfully added role organization admin to user #{@user.email}" - else - flash[:error] = "Coud not add role organization admin to #{@user.email}" - end - - redirect_to admins_admin_organization_path(@organization) - end - - def unassign_org_admins - if @user.remove_role 'organization_admin', @organization - flash[:notice] = "Successfully removed role organization admin from user #{@user.email}" - else - flash[:error] = "Could not remove role organization admin from user #{@user.email}" - end - - redirect_to admins_admin_organization_path(@organization) - end - - def admins - @role = @organization.roles.first - @users = @role.users - render 'show_org_admins' - end - - private - - def user_params - params.require(:user).permit(:email) - end - - def verify_user - @user = User.find_by(email: user_params[:email]) - unless @user - redirect_to admins_admin_organization_path(@organization), - error: 'Could not find user. Please provide a valid email!' - nil - end - end - - def organization_params - params.require(:organization).permit( - :name, :description, :picture, :code_of_conduct - ) - end - end -end diff --git a/app/controllers/admin/versions_controller.rb b/app/controllers/admin/versions_controller.rb index 723c1d972..5f9987e9b 100644 --- a/app/controllers/admin/versions_controller.rb +++ b/app/controllers/admin/versions_controller.rb @@ -14,11 +14,6 @@ def index ).pluck(:short_title) end - if current_user.has_cached_role? :organization_admin, :any - @conferences_with_role = Organization.with_role('organization_admin', current_user).map do |org| - org.conferences.pluck :short_title - end.flatten - end @conferences_with_role.uniq! return if @conference.blank? diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index 492516829..6d5faba76 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -115,6 +115,8 @@ def calendar end end + def code_of_conduct; end + private def conference_finder_conditions diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb deleted file mode 100644 index 28696d335..000000000 --- a/app/controllers/organizations_controller.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class OrganizationsController < ApplicationController - load_and_authorize_resource :organization - - def index - @organizations = Organization.all - end - - def code_of_conduct - @title = "#{@organization.name}: Code of Conduct" - @content = @organization.code_of_conduct - render 'document' - end - - def conferences - @current = @organization.conferences.upcoming.reorder(start_date: :asc) - @antiquated = @organization.conferences.past - render '/conferences/index' - end -end diff --git a/app/controllers/proposals_controller.rb b/app/controllers/proposals_controller.rb index 2c3281e9a..b3ec2fff8 100644 --- a/app/controllers/proposals_controller.rb +++ b/app/controllers/proposals_controller.rb @@ -29,13 +29,11 @@ def show def new @user = User.new @url = conference_program_proposals_path(@conference.short_title) - @languages = @program.languages_list @superevents = @program.super_events end def edit @url = conference_program_proposal_path(@conference.short_title, params[:id]) - @languages = @program.languages_list @superevents = @program.events.where(superevent: true) end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 492c98a7f..ef2762e3e 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -157,31 +157,19 @@ def hidden_if_conference_over(conference) # 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_text = conference.present? ? conference.short_title : ENV.fetch('OSEM_NAME', 'OSEM') link_to( - image_tag(conference_logo_url(conference), alt: nav_link_text(conference)), + image_tag(conference_logo_url(conference), alt: "#{link_text} homepage"), path, class: 'navbar-brand', - title: nav_link_text(conference) + title: link_text ) end - # TODO-SNAPCON: This should be the conference title. - def nav_link_text(conference = nil) - conference.try(:organization).try(:name) || ENV.fetch('OSEM_NAME', 'OSEM') - end - - # TODO: Consider Renaming this? - # TODO: Allow passing in an organization def conference_logo_url(conference = nil) - return DEFAULT_LOGO unless conference + return conference.picture.thumb.url if conference && conference.picture.present? - if conference.picture.present? - conference.picture.thumb.url - elsif conference.organization&.picture.present? - conference.organization.picture.thumb.url - else - DEFAULT_LOGO - end + DEFAULT_LOGO end # returns the url to be used for logo on basis of sponsorship level position diff --git a/app/helpers/versions_helper.rb b/app/helpers/versions_helper.rb index 04af38a1c..38eb40e3c 100644 --- a/app/helpers/versions_helper.rb +++ b/app/helpers/versions_helper.rb @@ -8,15 +8,6 @@ def link_if_alive(version, link_text, link_url, conference) version.item && conference ? link_to(link_text, link_url) : "#{link_text} with ID #{version.item_id}" end - def link_to_organization(organization_id) - return 'deleted organization' unless organization_id - - org = Organization.find_by(id: organization_id) - return current_or_last_object_state('Organization', organization_id).try(:name) unless org - - org.name.to_s - end - def link_to_conference(conference_id) return 'deleted conference' if conference_id.nil? diff --git a/app/models/ability.rb b/app/models/ability.rb index 0211ee8bc..78ecb69e9 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -17,7 +17,6 @@ def initialize(user) # Abilities for not signed in users (guests) def not_signed_in - can %i[index conferences code_of_conduct], Organization can [:index], Conference can [:show], Conference do |conference| conference.splashpage&.public == true @@ -87,7 +86,6 @@ def signed_in(user) end end - can :index, Organization can :index, Ticket do |ticket| ticket.visible end diff --git a/app/models/admin_ability.rb b/app/models/admin_ability.rb index 07e72ec20..27757b5bd 100644 --- a/app/models/admin_ability.rb +++ b/app/models/admin_ability.rb @@ -30,7 +30,6 @@ def common_abilities_for_roles(user) (conference.registration_open? && !conference.registration_limit_exceeded?) || conference.program.speakers.confirmed.include?(user) end - can %i[index admins], Organization can :index, Ticket can :manage, TicketPurchase, user_id: user.id can %i[new create], Payment, user_id: user.id @@ -81,7 +80,6 @@ def common_abilities_for_roles(user) # Abilities for signed in users with roles def signed_in_with_roles(user) - signed_in_with_organization_admin_role(user) if user.has_cached_role? :organization_admin, :any signed_in_with_organizer_role(user) if user.has_cached_role? :organizer, :any signed_in_with_cfp_role(user) if user.has_cached_role? :cfp, :any signed_in_with_info_desk_role(user) if user.has_cached_role? :info_desk, :any @@ -90,26 +88,9 @@ def signed_in_with_roles(user) common_abilities_for_roles(user) end - def signed_in_with_organization_admin_role(user) - org_ids_for_organization_admin = Organization.with_role(:organization_admin, user).pluck(:id) - conf_ids_for_organization_admin = Conference.where(organization_id: org_ids_for_organization_admin).pluck(:id) - - can %i[read update destroy assign_org_admins unassign_org_admins admins], Organization, - id: org_ids_for_organization_admin - can :new, Conference - can :manage, Conference, organization_id: org_ids_for_organization_admin - can %i[index show], Role - - can %i[index revert_object revert_attribute], PaperTrail::Version, - organization_id: org_ids_for_organization_admin - - signed_in_with_organizer_role(user, conf_ids_for_organization_admin) - end - - def signed_in_with_organizer_role(user, conf_ids_for_organization_admin = []) - # ids of all the conferences for which the user has the 'organizer' role and - # conferences that belong to organizations for which user is 'organization_admin' - conf_ids = conf_ids_for_organization_admin.concat(Conference.with_role(:organizer, user).pluck(:id)).uniq + def signed_in_with_organizer_role(user) + # ids of all the conferences for which the user has the 'organizer' role + conf_ids = Conference.with_role(:organizer, user).pluck(:id) # ids of all the tracks that belong to the programs of the above conferences track_ids = Track.joins(:program).where('programs.conference_id IN (?)', conf_ids).pluck(:id) diff --git a/app/models/cfp.rb b/app/models/cfp.rb index 87cb70cd1..d42c35501 100644 --- a/app/models/cfp.rb +++ b/app/models/cfp.rb @@ -137,10 +137,8 @@ def before_end_of_conference end def start_after_end_date - if start_date && end_date && start_date > end_date - errors - .add(:start_date, "can't be after the end date") - end + errors + .add(:start_date, "can't be after the end date") if start_date > end_date end def conference_id diff --git a/app/models/conference.rb b/app/models/conference.rb index 20e1ce441..e556b143c 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -49,10 +49,7 @@ class Conference < ApplicationRecord scope :upcoming, -> { where('conferences.end_date >= ?', Date.current) } scope :past, -> { where('conferences.end_date < ?', Date.current) } - belongs_to :organization - delegate :code_of_conduct, to: :organization - - has_paper_trail ignore: %i[updated_at guid revision events_per_week], meta: { conference_id: :id } + has_paper_trail ignore: %i(updated_at guid revision events_per_week), meta: { conference_id: :id } has_and_belongs_to_many :questions @@ -123,7 +120,6 @@ def after_conference :start_hour, :end_hour, :ticket_layout, - :organization, :timezone, presence: true validates :short_title, uniqueness: true @@ -646,12 +642,12 @@ def tracks_distribution(state = nil) # * +ActiveRecord+ def self.get_active_conferences_for_dashboard result = Conference.where('start_date > ?', Time.now) - .select('id, short_title, color, start_date, organization_id') + .select('id, short_title, color, start_date') if result.empty? result = Conference - .select('id, short_title, color, start_date, organization_id').limit(2) - .order(start_date: :desc) + .select('id, short_title, color, start_date').limit(2) + .order(start_date: :desc) end result end @@ -662,7 +658,7 @@ def self.get_active_conferences_for_dashboard # ====Returns # * +ActiveRecord+ def self.get_conferences_without_active_for_dashboard(active_conferences) - result = Conference.select('id, short_title, color, start_date, organization_id').order(start_date: :desc) + result = Conference.select('id, short_title, color, start_date').order(start_date: :desc) result - active_conferences end diff --git a/app/models/organization.rb b/app/models/organization.rb deleted file mode 100644 index d1930403e..000000000 --- a/app/models/organization.rb +++ /dev/null @@ -1,35 +0,0 @@ -# frozen_string_literal: true - -# == Schema Information -# -# Table name: organizations -# -# id :bigint not null, primary key -# code_of_conduct :text -# description :text -# name :string not null -# picture :string -# -class Organization < ApplicationRecord - resourcify :roles, dependent: :delete_all - - has_paper_trail - - has_many :conferences, dependent: :destroy - - after_create :create_roles - - validates :name, - uniqueness: { - case_sensitive: false - }, - presence: true - - mount_uploader :picture, PictureUploader, mount_on: :picture - - private - - def create_roles - roles.where(name: 'organization_admin').first_or_create(description: 'For the administrators of an organization and its conferences') - end -end diff --git a/app/models/registration_period.rb b/app/models/registration_period.rb index 32043ef17..40985f049 100644 --- a/app/models/registration_period.rb +++ b/app/models/registration_period.rb @@ -17,27 +17,32 @@ class RegistrationPeriod < ApplicationRecord has_paper_trail ignore: [:updated_at], meta: { conference_id: :conference_id } validates :start_date, :end_date, presence: true - validate :before_end_of_conference + validate :start_before_end_of_conference + validate :end_before_end_of_conference validate :start_date_before_end_date private - def before_end_of_conference - if conference&.end_date && start_date && (start_date > conference.end_date) - errors - .add(:start_date, "can't be after the conference end date (#{conference.end_date})") - end + def start_before_end_of_conference + return unless conference + return unless start_date - if conference&.end_date && end_date && (end_date > conference.end_date) - errors - .add(:end_date, "can't be after the conference end date (#{conference.end_date})") - end + errors + .add(:start_date, "can't start after the conference end date (#{conference.end_date})") if start_date > conference.end_date + end + + def end_before_end_of_conference + return unless conference + return unless end_date + + errors + .add(:end_date, "can't end after the conference end date (#{conference.end_date})") if end_date > conference.end_date end def start_date_before_end_date - if start_date && end_date && start_date > end_date - errors - .add(:start_date, "can't be after the end date") - end + return unless start_date && end_date + + errors + .add(:start_date, "can't be after the end date") if start_date > end_date end end diff --git a/app/pdfs/ticket_pdf.rb b/app/pdfs/ticket_pdf.rb index de9c5ce3f..b330d6fd0 100644 --- a/app/pdfs/ticket_pdf.rb +++ b/app/pdfs/ticket_pdf.rb @@ -67,7 +67,6 @@ def draw_second_square move_down 70 draw_text @conference.title.to_s, at: [@mid_horizontal + 30, cursor - 30], size: 12 - draw_text @conference.organization.name.to_s, at: [@mid_horizontal + 30, cursor - 50], size: 12 if @conference.venue draw_text @conference.venue_name, at: [@mid_horizontal + 30, cursor - 70] draw_text @conference.venue_street, at: [@mid_horizontal + 30, cursor - 90] diff --git a/app/views/admin/cfps/_form.html.haml b/app/views/admin/cfps/_form.html.haml index 3baf8c219..84131fa90 100644 --- a/app/views/admin/cfps/_form.html.haml +++ b/app/views/admin/cfps/_form.html.haml @@ -2,10 +2,12 @@ = f.hidden_field :cfp_type .form-group = f.label :start_date, "Start Date" - = f.text_field :start_date, class: 'form-control', id: 'registration-period-start-datepicker', start_date: @conference.start_date, end_date: @conference.end_date + %abbr{title: 'This field is required'} * + = f.date_field :start_date, class: 'form-control', required: true .form-group = f.label :end_date, "End Date" - = f.text_field :end_date, class: 'form-control', id: 'registration-period-end-datepicker', start_date: @conference.start_date, end_date: @conference.end_date + %abbr{title: 'This field is required'} * + = f.date_field :end_date, class: 'form-control', required: true .form-group = f.label :description = f.text_area :description, rows: 15, data: { provide: 'markdown' } diff --git a/app/views/admin/conferences/_form_fields.html.haml b/app/views/admin/conferences/_form_fields.html.haml index c5439f1ac..239241839 100644 --- a/app/views/admin/conferences/_form_fields.html.haml +++ b/app/views/admin/conferences/_form_fields.html.haml @@ -1,9 +1,5 @@ %h4 Basic Information %hr -- if f.object.new_record? - .form-group - = f.label :organization, "Organization" - = f.select :organization_id, Organization.accessible_by(current_ability, :update).pluck(:name, :id) .form-group = f.label :title %abbr{title: 'This field is required'} * @@ -36,8 +32,32 @@ - if f.object.picture? = image_tag f.object.picture.thumb.url = f.file_field :picture - %span.help-block + .help-block This will be shown in the navigation bar and emails. + .form-group + = f.text_area :code_of_conduct, rows: 10, data: { provide: 'markdown' }, class: 'form-control' + .help-block + Rules governing behavior and dispute resolution... + = markdown_hint + = f.select :ticket_layout, Conference.ticket_layouts.keys, {}, class: 'form-control' + %span.help-block + Layout type for tickets of the conference. + +%h4 + Scheduling +%hr += f.time_zone_select :timezone, nil, { default: 'UTC' }, { class: 'form-control' } +%span.help-block + Please select in what time zone your conference will take place. +.form-group + = f.label :start_date, "Start Date" + %abbr{title: 'This field is required'} * + = f.date_field :start_date, required: true, class: 'form-control' +.form-group + = f.label :end_date, "End Date" + %abbr{title: 'This field is required'} * + = f.date_field :end_date, required: true, class: 'form-control' +- unless f.object.new_record? # We are showing more fields on the edit form .form-group = f.label :custom_css, "Custom CSS" = f.text_area :custom_css, rows: 10, class: 'form-control', html: { style: 'font-family: monospace' } diff --git a/app/views/admin/organizations/_form.html.haml b/app/views/admin/organizations/_form.html.haml deleted file mode 100644 index 13544440b..000000000 --- a/app/views/admin/organizations/_form.html.haml +++ /dev/null @@ -1,22 +0,0 @@ -= form_for(@organization, url: (@organization.new_record? ? admin_organizations_path : admin_organization_path(@organization))) do |f| - .form-group - = f.label :name, "Name" - %abbr{title: 'This field is required'} * - = f.text_field :name, required: true, class: 'form-control', placeholder: 'Name' - .form-group - = f.text_area :description, rows: 10, data: { provide: 'markdown' }, class: 'form-control', placeholder: 'Decribe about your organization...' - %span.help-block - = markdown_hint - .form-group - = f.text_area :code_of_conduct, rows: 10, data: { provide: 'markdown' }, class: 'form-control', placeholder: 'Rules governing behavior and dispute resolution...' - %span.help-block - = markdown_hint - .form-group - = image_tag f.object.picture.thumb.url if f.object.picture? - = f.file_field :picture - %p.text-right - %button{type: 'submit', class: 'btn btn-success'} - - if @organization.new_record? - Create Organization - - else - Update Organization diff --git a/app/views/admin/organizations/_users_with_org_admin_role.haml b/app/views/admin/organizations/_users_with_org_admin_role.haml deleted file mode 100644 index 0632afbf0..000000000 --- a/app/views/admin/organizations/_users_with_org_admin_role.haml +++ /dev/null @@ -1,26 +0,0 @@ -.page-header - %h3 Users (#{users.length}) -- if users.present? - %table.datatable#users - %thead - %tr - %th Name - %th Email - - if ( can? :unassign_org_admins, organization ) - %th - Actions - %tbody - - users.each do |user| - %tr - %td= user.name - %td= user.email - - if ( can? :unassign_org_admins, organization ) - %td - = link_to 'Remove from organization admin', - unassign_org_admins_admin_organization_path(organization.id, - role.name, - user: {email: user.email}), - method: :delete, - class: 'btn btn-danger' -- else - %h5 No users found! diff --git a/app/views/admin/organizations/edit.html.haml b/app/views/admin/organizations/edit.html.haml deleted file mode 100644 index c9d69bcd4..000000000 --- a/app/views/admin/organizations/edit.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -.row - .col-md-12 - .page-header - %h1 - Edit Organization - = @organization.name -.row - .col-md-8 - = render partial: 'form' diff --git a/app/views/admin/organizations/index.html.haml b/app/views/admin/organizations/index.html.haml deleted file mode 100644 index 09cf187ea..000000000 --- a/app/views/admin/organizations/index.html.haml +++ /dev/null @@ -1,40 +0,0 @@ -.row - .col-md-12 - .page-header - %h1 Organizations - - if can? :manage, :all - .btn-group.pull-right - = link_to 'Create Organization', new_admin_organization_path, class: 'btn btn-success pull-right' - %p.text-muted - Manage organizations in OSEM -.row - .col-md-12 - %table.datatable - %thead - %tr - %th Name - %th Upcoming Conferences - %th Past Conferences - %th Code of Conduct? - %th Actions - %tbody - - @organizations.each do |organization| - %tr{ id: "organization-#{organization.id}" } - %td - = organization.name - %td - = organization.conferences.upcoming.count - %td - = organization.conferences.past.count - %td.text-center - - unless organization.code_of_conduct.blank? - = icon 'fa-solid', 'check', title: 'yes' - %td - .btn-group - = link_to 'Admins', admins_admin_organization_path(organization), - method: :get, class: 'btn btn-success' - = link_to 'Edit', edit_admin_organization_path(organization), - method: :get, class: 'btn btn-primary' - = link_to 'Delete', admin_organization_path(organization), - method: :delete, class: 'btn btn-danger', data: { confirm: "Warning: This will delete #{organization.name} and all its data which includes data for all conferences within #{organization.name}. Do you really want to continue?" } - = link_to 'Add Conference', new_admin_conference_path, method: :get, class: 'btn btn-info' diff --git a/app/views/admin/organizations/new.html.haml b/app/views/admin/organizations/new.html.haml deleted file mode 100644 index b38ea9372..000000000 --- a/app/views/admin/organizations/new.html.haml +++ /dev/null @@ -1,8 +0,0 @@ -.row - .col-md-12 - .page-header - %h1 - Create Organization -.row - .col-md-8 - = render partial: 'form' diff --git a/app/views/admin/organizations/show_org_admins.haml b/app/views/admin/organizations/show_org_admins.haml deleted file mode 100644 index 5c7698db1..000000000 --- a/app/views/admin/organizations/show_org_admins.haml +++ /dev/null @@ -1,20 +0,0 @@ -.row - .col-md-12 - .page-header - %h2 - Organization admins for #{@organization.name} - .text-muted - = @role.description - -.row.col-md-3 - - if ( can? :assign_org_admins, @organization ) - = form_for :user, url: assign_org_admins_admin_organization_path(@organization, @role.name), method: :post do |f| - .form-group - = f.label :email, 'Add user by email: ' - = f.text_field :email, placeholder: "User's email", class: 'form-control', required: true - = f.submit 'Add', id: 'user-add', class: 'btn btn-primary' - -.row - .col-md-12 - = render partial: 'users_with_org_admin_role', - locals: { users: @users, organization: @organization, role: @role } diff --git a/app/views/admin/programs/_form.html.haml b/app/views/admin/programs/_form.html.haml index c341dbbe3..ad85199b1 100644 --- a/app/views/admin/programs/_form.html.haml +++ b/app/views/admin/programs/_form.html.haml @@ -25,10 +25,9 @@ For the feature to work you need to set the voting dates below as well .form-group = f.label :voting_start_date - = f.text_field :voting_start_date, id: 'datetimepicker-voting_start_date', value: (f.object.voting_start_date.to_formatted_s(:db_without_seconds) unless f.object.voting_start_date.nil?), class: 'form-control' - .form-group + = f.datetime_field :voting_start_date, value: (f.object.voting_start_date.to_formatted_s(:db_without_seconds) unless f.object.voting_start_date.nil?), class: 'form-control' = f.label :voting_end_date - = f.text_field :voting_end_date, id: 'datetimepicker-voting_end_date', value: (f.object.voting_end_date.to_formatted_s(:db_without_seconds) unless f.object.voting_end_date.nil?), class: 'form-control' + = f.datetime_field :voting_end_date, value: (f.object.voting_end_date.to_formatted_s(:db_without_seconds) unless f.object.voting_end_date.nil?), class: 'form-control' %h4 Languages %hr diff --git a/app/views/admin/registration_periods/_form.html.haml b/app/views/admin/registration_periods/_form.html.haml index 35b996b10..2bf25a57d 100644 --- a/app/views/admin/registration_periods/_form.html.haml +++ b/app/views/admin/registration_periods/_form.html.haml @@ -1,11 +1,20 @@ +%p + Setup the time frame in which people can registrer to your conference = form_for(@registration_period, url: admin_conference_registration_period_path(@conference.short_title)) do |f| .form-group = f.label :start_date %abbr{title: 'This field is required'} * - = f.text_field :start_date, required: true, 'data-end-conference': @conference.end_date.to_s, id: 'registration-period-start-datepicker', class: 'form-control' + %p.small + Must be before conference end (#{@conference.end_date}) and the end date + - if @registration_period.end_date + (#{@registration_period.end_date}) + below + = f.date_field :start_date, required: true, class: 'form-control', max: @conference.end_date, required: true .form-group = f.label :end_date %abbr{title: 'This field is required'} * - = f.text_field :end_date, required: true, id: 'registration-period-end-datepicker', class: 'form-control' + %p.small + Must be before conference end (#{@conference.end_date}) + = f.date_field :end_date, required: true, class: 'form-control', max: @conference.end_date, required: true %p.text-right = f.submit 'Save Registration Period', class: 'btn btn-primary' diff --git a/app/views/admin/survey_questions/_form.html.haml b/app/views/admin/survey_questions/_form.html.haml index b77bb1c55..7b8885edb 100644 --- a/app/views/admin/survey_questions/_form.html.haml +++ b/app/views/admin/survey_questions/_form.html.haml @@ -86,10 +86,10 @@ .kinds.text{ class: @survey_question.text? ? '' : 'hidden' } %textarea.form-control{ rows: 4 } .kinds.datetime{ class: @survey_question.datetime? ? '' : 'hidden' } - .form-group{ class: 'datetimepicker' } + .form-group .input-group .input-group-addon %span.fa-solid.fa-calendar - %input.form-control{ readonly: 'readonly' } + %input.form-control{ type: 'datetime-local', readonly: 'readonly' } .kinds.numeric{ class: @survey_question.numeric? ? '' : 'hidden' } %input.form-control{ type: 'number' } diff --git a/app/views/admin/surveys/_form.html.haml b/app/views/admin/surveys/_form.html.haml index b03022ab1..3479bbc78 100644 --- a/app/views/admin/surveys/_form.html.haml +++ b/app/views/admin/surveys/_form.html.haml @@ -22,7 +22,7 @@ = f.select :target, Survey.targets.keys, class: 'form-control' .form-group = f.label :start_date - = f.text_field :start_date, class: 'datetimepicker form-control' + = f.datetime_field :start_date, class: 'form-control' = f.label :end_date - = f.text_field :end_date, class: 'datetimepicker form-control' + = f.datetime_field :end_date, class: 'form-control' = f.submit nil, class: 'btn btn-primary' diff --git a/app/views/admin/surveys/_survey_question.html.haml b/app/views/admin/surveys/_survey_question.html.haml index f006036e0..0219ce461 100644 --- a/app/views/admin/surveys/_survey_question.html.haml +++ b/app/views/admin/surveys/_survey_question.html.haml @@ -32,10 +32,10 @@ - elsif survey_question.text? = text_area_tag "survey_submission[#{survey_question.id}][]", survey_reply.text, rows: 4, class: 'form-control', required: survey_question.mandatory - elsif survey_question.datetime? - .form-group{ class: 'datetimepicker' } + .form-group .input-group .input-group-addon %span.fa-solid.fa-calendar - %input.form-control{ readonly: 'readonly', name: "survey_submission[#{survey_question.id}][]", value: survey_reply.text, required: survey_question.mandatory } + %input.form-control{ type: 'datetime-local', readonly: 'readonly', name: "survey_submission[#{survey_question.id}][]", value: survey_reply.text, required: survey_question.mandatory } - elsif survey_question.numeric? %input.form-control{ type: 'number', name: "survey_submission[#{survey_question.id}][]", value: survey_reply.text, required: survey_question.mandatory } diff --git a/app/views/admin/versions/_object_desc_and_link.html.haml b/app/views/admin/versions/_object_desc_and_link.html.haml index 6870af950..f6921bd73 100644 --- a/app/views/admin/versions/_object_desc_and_link.html.haml +++ b/app/views/admin/versions/_object_desc_and_link.html.haml @@ -7,22 +7,13 @@ end - case version.item_type -- when 'Organization' - organization - = link_to_organization(version.item_id) - - when 'UsersRole' - role = current_or_last_object_state('Role', object.role_id) - role_name = role.try(:name) || PaperTrail::Version.where(item_type: 'Role', item_id: object.role_id).last.changeset[:name].second role - - if version.conference_id - - conference = Conference.find_by(id: version.conference_id) - - conference_short_title = conference.try(:short_title) || current_or_last_object_state('Conference', version.conference_id).try(:short_title) || ' ' - = link_if_alive version, role.try(:name), admin_conference_role_path(conference_short_title,role.try(:name) || ' '), conference - - elsif version.organization_id - - organization = Organization.find(version.organization_id) - = link_if_alive version, role_name, - admins_admin_organization_path(organization), organization + - conference = Conference.find_by(id: version.conference_id) + - conference_short_title = conference.try(:short_title) || current_or_last_object_state('Conference', version.conference_id).try(:short_title) || ' ' + = link_if_alive version, role.try(:name), admin_conference_role_path(conference_short_title,role.try(:name) || ' '), conference = version.event == 'create' ? 'to' : 'from' user @@ -130,15 +121,10 @@ - when 'Role' role - role_name = object.try(:name) || PaperTrail::Version.where(item_type: 'Role', item_id: version.item_id).last.changeset[:name].second - - if version.conference_id - - conference = Conference.find_by(id: version.conference_id) - - conference_short_title = conference.try(:short_title) || current_or_last_object_state('Conference', version.conference_id).try(:short_title) || ' ' - = link_if_alive version, role_name, - admin_conference_role_path(conference_short_title, role_name), conference - - elsif version.organization_id - - organization = Organization.find(version.organization_id) - = link_if_alive version, role_name, - admins_admin_organization_path(organization), organization + - conference = Conference.find_by(id: version.conference_id) + - conference_short_title = conference.try(:short_title) || current_or_last_object_state('Conference', version.conference_id).try(:short_title) || ' ' + = link_if_alive version, role_name, + admin_conference_role_path(conference_short_title, role_name), conference - when 'Venue' venue @@ -195,7 +181,7 @@ user = link_to_user(version.item_id) -- unless %w(Conference Subscription Registration User Organization).include?(version.item_type) +- unless %w(Conference Subscription Registration User).include?(version.item_type) - if version.item_type == 'Commercial' - commercial = current_or_last_object_state(version.item_type, version.item_id) - commercialable = current_or_last_object_state(commercial.commercialable_type, commercial.commercialable_id) diff --git a/app/views/conference_registrations/_registration_info.html.haml b/app/views/conference_registrations/_registration_info.html.haml index a952c067c..c47a72673 100644 --- a/app/views/conference_registrations/_registration_info.html.haml +++ b/app/views/conference_registrations/_registration_info.html.haml @@ -1,16 +1,14 @@ -- unless @conference.code_of_conduct.blank? - - code_of_conduct_link = link_to 'Code of Conduct', '#', - data: { toggle: 'modal', target: '#modal-code-of-conduct'} +- if @conference.code_of_conduct.present? - if @registration.accepted_code_of_conduct = icon 'fa-solid', 'square-check' I have read and accepted the - = code_of_conduct_link + = link_to "Code of Conduct", code_of_conduct_conference_path(@conference.short_title) - else .checkbox %label = f.check_box :accepted_code_of_conduct, required: true I have read and accept the - = code_of_conduct_link + = link_to "Code of Conduct", code_of_conduct_conference_path(@conference.short_title) %abbr{title: 'This field is required'} * - if @conference.program.events.with_registration_open.any? || @registration.events.any? @@ -31,5 +29,3 @@ - if event.scheduled? (Scheduled on: #{event.time.to_date}) %br - -= render 'conferences/code_of_conduct', organization: @conference.organization diff --git a/app/views/conference_registrations/show.html.haml b/app/views/conference_registrations/show.html.haml index 88e4fac45..3b274b448 100644 --- a/app/views/conference_registrations/show.html.haml +++ b/app/views/conference_registrations/show.html.haml @@ -37,8 +37,7 @@ You need to accept the = link_to 'Code of Conduct', '#', data: { toggle: 'modal', target: '#modal-code-of-conduct'} - = render 'conferences/code_of_conduct', - organization: @conference.organization + = render 'conferences/code_of_conduct' - if @conference.surveys.for_registration.any? .row .col-md-12 diff --git a/app/views/conferences/_code_of_conduct.haml b/app/views/conferences/_code_of_conduct.haml deleted file mode 100644 index 1b9b98674..000000000 --- a/app/views/conferences/_code_of_conduct.haml +++ /dev/null @@ -1,20 +0,0 @@ -= content_for :splash_nav do - %li - = link_to 'Code of Conduct', '#', - data: { toggle: 'modal', target: '#modal-code-of-conduct'} - -- content_for :modals do - - cache [organization, '#CoC-modal'] do - .modal.fade{ id: "modal-code-of-conduct" } - .modal-dialog - .modal-content - .modal-header - %button.close{ data: { dismiss: 'modal' } } - %i.fa-solid.fa-xmark - %h3.modal-title Code of Conduct - .modal-body - = markdown organization.code_of_conduct - .modal-footer - = link_to 'permalink', - [:code_of_conduct, organization], - target: '_blank' diff --git a/app/views/conferences/_conference_details.html.haml b/app/views/conferences/_conference_details.html.haml index b860d609a..4fde262c9 100644 --- a/app/views/conferences/_conference_details.html.haml +++ b/app/views/conferences/_conference_details.html.haml @@ -28,11 +28,8 @@ = link_to "View Conference", conference_path(conference.short_title), class: 'btn btn-default' - if conference.program and conference.program.schedule_public = link_to "Schedule", vertical_schedule_conference_schedule_path(conference.short_title), class: 'btn btn-default' - - unless conference.code_of_conduct.blank? - = link_to "Code of Conduct", - [:code_of_conduct, conference.organization], - class: 'btn btn-default' - - if conference.registration_open? + - if conference.code_of_conduct.present? + = link_to "Code of Conduct", code_of_conduct_conference_path(conference.short_title), class: 'btn btn-default' - if conference.registration_open? - if conference.user_registered?(current_user) = link_to "My Registration", conference_conference_registration_path(conference.short_title), class: 'btn btn-default' - else diff --git a/app/views/conferences/_social_media.haml b/app/views/conferences/_social_media.haml index 4cfd4d2e0..2a257a208 100644 --- a/app/views/conferences/_social_media.haml +++ b/app/views/conferences/_social_media.haml @@ -28,3 +28,9 @@ = mail_to "#{ contact.email }" do %i.fa-solid.fa-envelope.fa-4x .trapezoid.social-media + -# .row + -# .col-md-12 + -# - if @conference.code_of_conduct.present? + -# %hr + -# %p.text-center + -# = link_to "Code of Conduct", code_of_conduct_conference_path(@conference.short_title) diff --git a/app/views/conferences/code_of_conduct.html.haml b/app/views/conferences/code_of_conduct.html.haml new file mode 100644 index 000000000..57f27cf74 --- /dev/null +++ b/app/views/conferences/code_of_conduct.html.haml @@ -0,0 +1,10 @@ +.container + .row + .col-md-12 + .page-header + %h1 + = @conference.short_title + Code Of Conduct + .row + .col-md-12 + = markdown @conference.code_of_conduct diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index 49aa07b7e..48e826ea5 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -40,7 +40,7 @@ #splash -# - cache [@conference, @splashpage, @conference.program, current_user, '#splash#main'] do - if @conference.code_of_conduct.present? - = render 'code_of_conduct', organization: @conference.organization + = render 'code_of_conduct' -# header = render 'header', conference: @conference, venue: @conference.venue, splashpage: @splashpage, cached: true diff --git a/app/views/layouts/_admin_sidebar_index.html.haml b/app/views/layouts/_admin_sidebar_index.html.haml index 91001405c..3da79dd2b 100644 --- a/app/views/layouts/_admin_sidebar_index.html.haml +++ b/app/views/layouts/_admin_sidebar_index.html.haml @@ -27,18 +27,8 @@ = link_to(admin_users_path) do %span.fa-solid.fa-user Users - - if can? :index, Organization - %li - = link_to(admin_organizations_path) do - %span.fa-solid.fa-users - Organizations - if can? :index, PaperTrail::Version %li = link_to(admin_revision_history_path) do %span.fa-solid.fa-clock-rotate-left Revision History - - if ENV.fetch('ORGANIZATIONS_ENABLED', nil) == 'true' - %li - = link_to(admin_organizations_path) do - %span.fa-solid.fa-user-group - Organizations diff --git a/app/views/layouts/_user_menu.html.haml b/app/views/layouts/_user_menu.html.haml index 887eee03a..f3c965adf 100644 --- a/app/views/layouts/_user_menu.html.haml +++ b/app/views/layouts/_user_menu.html.haml @@ -76,8 +76,3 @@ = link_to(admin_revision_history_path) do %span.fa-solid.fa-clock-rotate-left Revision History - - if ENV.fetch('OSEM_ICHAIN_ENABLED', nil) == 'true' - %li - = link_to(admin_organizations_path) do - %span.fa-solid.fa-user-group - Organizations diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 64374c3f4..b225496b0 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -34,12 +34,12 @@ #messages .container = render 'layouts/messages' - #content + %main#content = yield = yield :modals - #footer + %footer#footer .container %p.muted.text-center %small @@ -50,8 +50,5 @@ You can run, copy, distribute, study, change and improve it. The source code and the developers are on #{link_to "GitHub", "https://github.com/snap-cloud/snapcon"}. This site is a modification of #{link_to "OSEM", "https://github.com/openSUSE/osem"}. - - if ENV.fetch('SKYLIGHT_PUBLIC_DASHBOARD_URL', nil) - Performance data is available on - #{link_to "Skylight", ENV["SKYLIGHT_PUBLIC_DASHBOARD_URL"]}. = yield :script_body = yield :charts_js diff --git a/app/views/organizations/index.html.haml b/app/views/organizations/index.html.haml deleted file mode 100644 index bd97ac2b3..000000000 --- a/app/views/organizations/index.html.haml +++ /dev/null @@ -1,21 +0,0 @@ -.container - .row - .col-md-12.page-header - %h1 - Organizations - .btn-group.pull-right - / = link_to 'Add new', new_organization_path, class: 'btn btn-mini btn-success' - - @organizations.each do |organization| - .col-md-4{ id: "organization-#{organization.id}" } - .thumbnail - = image_tag(organization.picture.thumb.url, width: '20%') if organization.picture? - .caption - %h4 - = organization.name - .btn-group - = link_to 'Conferences', - conferences_organization_path(organization), - class: 'btn btn-success' - - unless organization.code_of_conduct.blank? - = link_to 'Code of Conduct', [:code_of_conduct, organization], class: 'btn btn-info' - / = link_to 'Edit', edit_organization_path(organization), class: 'btn btn-mini btn-default' diff --git a/app/views/physical_tickets/show.html.haml b/app/views/physical_tickets/show.html.haml index ec8e73793..693517456 100644 --- a/app/views/physical_tickets/show.html.haml +++ b/app/views/physical_tickets/show.html.haml @@ -34,12 +34,6 @@ = image_tag(@conference.picture.ticket.url, class: 'img-responsive') - else = image_tag('/img/osem-logo.png', class: 'img-responsive') - %p.text-left - %br - %strong - Organization - %br - = @conference.organization.name .col-md-5.box.well %p.text-left %strong diff --git a/app/views/proposals/_form.html.haml b/app/views/proposals/_form.html.haml index 6d5badcb2..109ab8966 100644 --- a/app/views/proposals/_form.html.haml +++ b/app/views/proposals/_form.html.haml @@ -57,7 +57,8 @@ - if @program.languages.present? .form-group = f.label :language - = f.select :language, @languages, { include_blank: false}, { class: 'select-help-toggle form-control' } + = f.select :language, @program.languages_list, { include_blank: false}, { class: 'select-help-toggle form-control' } + - if @conference.program.difficulty_levels.any? .form-group diff --git a/app/views/schedules/show.xml.haml b/app/views/schedules/show.xml.haml index 21bbbcea4..826784fb1 100644 --- a/app/views/schedules/show.xml.haml +++ b/app/views/schedules/show.xml.haml @@ -16,7 +16,7 @@ %room{ name: room.name } - events_in_rooms[room].each do |event| %event{ guid: event.guid, id: event.id } - %date= event.time.in_time_zone(@conference.timezone).iso8601 + %date= event.time.change(zone: @conference.timezone).iso8601 %start= event.time.strftime('%H:%M') %duration= length_timestamp(event.event_type.length) %room= event.room.name diff --git a/app/views/tracks/_form_fields.html.haml b/app/views/tracks/_form_fields.html.haml index b32420996..4c2210209 100644 --- a/app/views/tracks/_form_fields.html.haml +++ b/app/views/tracks/_form_fields.html.haml @@ -13,12 +13,12 @@ = f.color_field :color, size: 6, required: true, class: 'form-control' .form-group = f.label :start_date, "Start Date" - = f.text_field :start_date, id: 'registration-period-start-datepicker', start_date: @conference.start_date, end_date: @conference.end_date, required: @track.self_organized_and_accepted_or_confirmed?, class: 'form-control' + = f.date_field :start_date, required: @track.self_organized_and_accepted_or_confirmed?, class: 'form-control' - if @track.self_organized_and_accepted_or_confirmed? %abbr{title: 'This field is required'} * .form-group = f.label :end_date, "End Date" - = f.text_field :end_date, id: 'registration-period-end-datepicker', required: @track.self_organized_and_accepted_or_confirmed?, class: 'form-control' + = f.date_field :end_date, required: @track.self_organized_and_accepted_or_confirmed?, class: 'form-control' - if @track.self_organized_and_accepted_or_confirmed? %abbr{title: 'This field is required'} * - if current_user.is_admin? diff --git a/config/application.rb b/config/application.rb index c65e46dd0..e467057ba 100644 --- a/config/application.rb +++ b/config/application.rb @@ -63,6 +63,6 @@ class Application < Rails::Application # This is a nightmare with our current data model, no one ever thought about this. config.active_record.belongs_to_required_by_default = false # https://discuss.rubyonrails.org/t/cve-2022-32224-possible-rce-escalation-bug-with-serialized-columns-in-active-record/81017 - config.active_record.yaml_column_permitted_classes = ['Date', 'DateTime', 'Symbol', 'Time'] + config.active_record.yaml_column_permitted_classes = ['Date', 'DateTime', 'Symbol', 'Time', 'ActiveSupport::TimeWithZone', 'ActiveSupport::TimeZone'] end end diff --git a/config/database.yml b/config/database.yml index 9609cd404..709d883f4 100644 --- a/config/database.yml +++ b/config/database.yml @@ -1,14 +1,6 @@ -<% - encoding = 'unicode' - if ENV.fetch('OSEM_DB_ADAPTER', nil) == 'mysql2' - encoding = 'utf8' - end -%> - - default: &default - adapter: <%= ENV.fetch('OSEM_DB_ADAPTER', 'postgresql') %> - encoding: <%= encoding %> + adapter: 'postgresql' + encoding: 'unicode' host: <%= ENV.fetch('OSEM_DB_HOST', 'database') %> port: <%= ENV.fetch('OSEM_DB_PORT', '5432') %> username: <%= ENV.fetch('OSEM_DB_USER', ENV.fetch('USER', 'postgres')) %> @@ -23,9 +15,6 @@ development: # username: <%= ENV['OSEM_DB_USER'] || 'postgres' %> database: osem_development -# Warning: The database defined as "test" will be erased and -# re-generated when you run "rake". -# Do not set this db to the same as development or production. test: <<: *default host: localhost diff --git a/config/routes.rb b/config/routes.rb index 62ac3dfdd..cbb29a2a8 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -25,13 +25,6 @@ end namespace :admin do - resources :organizations do - member do - get :admins - post :assign_org_admins - delete :unassign_org_admins - end - end resources :users do member do patch :toggle_confirmation @@ -162,12 +155,8 @@ get '/revision_history/:id/revert_object' => 'versions#revert_object', as: 'revision_history_revert_object' get '/revision_history/:id/revert_attribute' => 'versions#revert_attribute', as: 'revision_history_revert_attribute' end - resources :organizations, only: [:index] do - member do - get :conferences, 'code-of-conduct' - end - end - resources :conferences, only: %i[index show] do + + resources :conferences, only: [:index, :show] do resources :booths do member do patch :withdraw @@ -224,6 +213,10 @@ resources :rooms, only: [] do get :live_session end + + member do + get 'code-of-conduct' + end end namespace :api, defaults: { format: 'json' } do diff --git a/db/migrate/20181229233812_drop_organizations.rb b/db/migrate/20181229233812_drop_organizations.rb new file mode 100644 index 000000000..dd1be5f2c --- /dev/null +++ b/db/migrate/20181229233812_drop_organizations.rb @@ -0,0 +1,11 @@ +class DropOrganizations < ActiveRecord::Migration[7.0] + def change + drop_table :organizations do |t| + t.string :name, null: false + t.text :description + t.string :picture + end + + remove_reference :conferences, :organization, index: true + end +end diff --git a/db/migrate/20181229233813_add_code_of_conduct_to_conference.rb b/db/migrate/20181229233813_add_code_of_conduct_to_conference.rb new file mode 100644 index 000000000..6151241f2 --- /dev/null +++ b/db/migrate/20181229233813_add_code_of_conduct_to_conference.rb @@ -0,0 +1,5 @@ +class AddCodeOfConductToConference < ActiveRecord::Migration[7.0] + def change + add_column :conferences, :code_of_conduct, :text + end +end diff --git a/db/schema.rb b/db/schema.rb index 18d82ff98..47f700a7d 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -104,13 +104,12 @@ t.string "picture" t.integer "start_hour", default: 9 t.integer "end_hour", default: 20 - t.integer "organization_id" t.integer "ticket_layout", default: 0 t.string "custom_domain" t.integer "booth_limit", default: 0 t.text "custom_css" t.text "registered_attendees_message" - t.index ["organization_id"], name: "index_conferences_on_organization_id" + t.text "code_of_conduct" end create_table "conferences_questions", id: false, force: :cascade do |t| @@ -315,13 +314,6 @@ t.datetime "updated_at", precision: nil end - create_table "organizations", force: :cascade do |t| - t.string "name", null: false - t.text "description" - t.string "picture" - t.text "code_of_conduct" - end - create_table "payments", force: :cascade do |t| t.string "last4" t.integer "amount" diff --git a/docker-compose.yml b/docker-compose.yml index 70e5b94bb..ce8a4613c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: "2.4" services: database: - image: postgres:12-alpine + image: postgres:16-alpine environment: PGDATA: /var/lib/postgresql/data/pgdata POSTGRES_PASSWORD: $OSEM_DB_PASSWORD diff --git a/dotenv.example b/dotenv.example index 372800ec9..6d31d9c62 100644 --- a/dotenv.example +++ b/dotenv.example @@ -9,9 +9,6 @@ # bundle exec rake secret # SECRET_KEY_BASE=12345 -# The type of database to use (postgresql, mysql2, sqlite3) -# OSEM_DB_ADAPTER=mysql2 - # The name of the host the database runs on # OSEM_DB_HOST=database @@ -32,9 +29,6 @@ # OSEM_MEMCACHED_USERNAME='root' # OSEM_MEMCACHED_PASSWORD='1234' -# Set this if you want to deviate from our 'standard' ruby version -# OSEM_RUBY_VERSION=3.1.2 - # What time is it? # OSEM_TIME_ZONE="UTC" @@ -111,10 +105,6 @@ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # FORCE_SSL=true -# Your skylight.io keys -# SKYLIGHT_AUTHENTICATION=1234 -# SKYLIGHT_PUBLIC_DASHBOARD_URL='https://oss.skylight.io/app/applications/xxxxxxxxxxxx' - # How should browser tests be performed? # For headless Chrome (default): # OSEM_TEST_DRIVER=chrome_headless diff --git a/lib/tasks/dump_db.rake b/lib/tasks/dump_db.rake deleted file mode 100644 index 71b557f4e..000000000 --- a/lib/tasks/dump_db.rake +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -require 'yaml' -task :dump_db do - yaml = YAML.load_file('config/database.yml') - conf = yaml['production'] - filename = "#{conf['database']}-#{Time.now.strftime('%Y-%m-%d-%H:%M:%S:%L')}.sql" - if conf['adapter'] == 'mysql2' - system "mysqldump -u #{conf['username']} --password=#{conf['password']} -h #{conf['host']} #{conf['database']} > ~/#{filename}" - else - puts 'Error: This rake task only works for MYSQL' - end -end diff --git a/lib/tasks/roles.rake b/lib/tasks/roles.rake index e07122bc9..2b753c9fd 100644 --- a/lib/tasks/roles.rake +++ b/lib/tasks/roles.rake @@ -3,10 +3,6 @@ namespace :roles do desc 'Adds back deleted roles to all conferences' task add: :environment do - Organization.all.each do |org| - Role.where(name: 'organization_admin', - resource: org).first_or_create(description: 'For the administrators of an organization and its conferences') - end Conference.all.each do |c| Role.where(name: 'organizer', diff --git a/spec/ability/ability_spec.rb b/spec/ability/ability_spec.rb index abbd623f2..02874e123 100644 --- a/spec/ability/ability_spec.rb +++ b/spec/ability/ability_spec.rb @@ -6,12 +6,12 @@ describe 'User' do describe 'Abilities' do # see https://github.com/CanCanCommunity/cancancan/wiki/Testing-Abilities - subject(:ability) { Ability.new(user) } + subject(:ability){ Ability.new(user) } + let(:user){ nil } let!(:admin) { create(:admin) } let(:user) { nil } - let!(:organization) { create(:organization) } - let!(:my_conference) { create(:full_conference, organization: organization) } + let!(:my_conference) { create(:full_conference) } let(:my_room) { create(:room, venue: my_conference.venue) } let(:conference_not_public) { create(:conference, splashpage: create(:splashpage, public: false)) } let(:conference_public) { create(:full_conference, splashpage: create(:splashpage, public: true)) } @@ -30,8 +30,7 @@ # Test abilities for not signed in users context 'when user is not signed in' do - it { is_expected.to be_able_to(:index, Organization) } - it { is_expected.to be_able_to(:index, Conference) } + it{ should be_able_to(:index, Conference)} it { is_expected.to be_able_to(:show, conference_public) } it { is_expected.not_to be_able_to(:show, conference_not_public) } diff --git a/spec/controllers/admin/conferences_controller_spec.rb b/spec/controllers/admin/conferences_controller_spec.rb index c91bbacf9..24c001dde 100644 --- a/spec/controllers/admin/conferences_controller_spec.rb +++ b/spec/controllers/admin/conferences_controller_spec.rb @@ -4,18 +4,13 @@ describe Admin::ConferencesController do # It is necessary to use bang version of let to build roles before user - let!(:organization) { create(:organization, name: 'organization') } - let!(:conference) do - create(:conference, organization: organization, start_date: Date.new(2014, 5, 26), end_date: Date.new(2014, 5, 26) + 15) - end - let!(:organization_admin_role) { Role.find_by(name: 'organization_admin', resource: organization) } - let(:organization_admin) { create(:user, role_ids: organization_admin_role.id) } + let!(:conference) { create(:conference, end_date: Date.new(2014, 05, 26) + 15) } let(:organizer_role) { Role.find_by(name: 'organizer', resource: conference) } let!(:organizer) { create(:organizer, resource: conference) } let!(:organizer2) { create(:organizer, email: 'organizer2@email.osem', resource: conference) } let(:participant) { create(:user) } - shared_examples 'access as organizer or organization_admin' do + shared_examples 'access as organizer' do describe 'PATCH #update' do context 'valid attributes' do it 'locates the requested conference' do @@ -207,99 +202,6 @@ end end - shared_examples 'access as organization_admin' do - describe 'POST #create' do - context 'with valid attributes' do - it 'saves the conference to the database' do - expected = expect do - post :create, params: { conference: - attributes_for(:conference, short_title: 'dps15', organization_id: organization.id) } - end - expected.to change { Conference.count }.by 1 - end - - it 'redirects to conference#show' do - post :create, params: { conference: - attributes_for(:conference, short_title: 'dps15', organization_id: organization.id) } - - expect(response).to redirect_to admin_conference_path( - assigns[:conference].short_title - ) - end - - it 'creates roles for the conference' do - cfp_role = Role.find_by(name: 'cfp', resource: conference) - info_desk_role = Role.find_by(name: 'info_desk', resource: conference) - volunteers_coordinator_role = Role.find_by(name: 'volunteers_coordinator', resource: conference) - - post :create, params: { conference: - attributes_for(:conference, short_title: 'dps15') } - - expect(conference.roles.count).to eq 4 - - expect(conference.roles).to match_array [organizer_role, cfp_role, info_desk_role, - volunteers_coordinator_role] - end - end - - context 'with invalid attributes' do - it 'does not save the conference to the database' do - expected = expect do - post :create, params: { conference: - attributes_for(:conference, short_title: nil, organization_id: organization.id) } - end - expected.not_to change { Conference.count } - end - - it 're-renders the new template' do - post :create, params: { conference: - attributes_for(:conference, short_title: nil, organization_id: organization.id) } - expect(response).to be_successful - end - end - - context 'with duplicate conference short title' do - it 'does not save the conference to the database' do - conference - expected = expect do - post :create, params: { conference: - attributes_for(:conference, short_title: conference.short_title, organization_id: organization.id) } - end - expected.not_to change { Conference.count } - end - - it 're-renders the new template' do - conference - post :create, - params: { conference: attributes_for(:conference, short_title: conference.short_title, - organization_id: organization.id) } - expect(response).to be_successful - end - end - end - - describe 'GET #new' do - it 'assigns a new conference to conference' do - get :new - expect(assigns(:conference)).to be_a_new(Conference) - end - - it 'renders the :new template' do - get :new - expect(response).to render_template :new - end - end - end - - describe 'organization admin access' do - before do - sign_in(organization_admin) - end - - it_behaves_like 'access as organizer or organization_admin' - it_behaves_like 'access as organization_admin' - end - shared_examples 'access as organizer, participant or guest' do |path, message| describe 'GET #new' do it 'requires organizer privileges' do @@ -311,8 +213,7 @@ describe 'POST #create' do it 'requires organizer privileges' do - post :create, params: { conference: attributes_for(:conference, - short_title: 'ExCon', organization_id: organization.id) } + post :create, params: { conference: attributes_for(:conference, short_title: 'ExCon') } expect(response).to redirect_to(send(path)) expect(flash[:alert]).to match(/#{message}/) if message end @@ -324,9 +225,8 @@ sign_in(organizer) end - it_behaves_like 'access as organizer or organization_admin' - it_behaves_like 'access as organizer, participant or guest', :root_path, - 'You are not authorized to access this page.' + it_behaves_like 'access as organizer' + it_behaves_like 'access as organizer, participant or guest', :root_path, 'You are not authorized to access this page.' end shared_examples 'access as participant or guest' do |path, message| diff --git a/spec/controllers/admin/organizations_controller_spec.rb b/spec/controllers/admin/organizations_controller_spec.rb deleted file mode 100644 index 5bddb571f..000000000 --- a/spec/controllers/admin/organizations_controller_spec.rb +++ /dev/null @@ -1,203 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -describe Admin::OrganizationsController do - let!(:admin) { create(:admin) } - let!(:organization) { create(:organization) } - let!(:user) { create(:user) } - - context 'logged in as user with no role' do - before do - sign_in user - end - - describe 'GET #new' do - before do - get :new - end - - it 'redirects to root' do - expect(flash[:alert]).to eq('You are not authorized to access this page.') - expect(response).to redirect_to(root_path) - end - end - - describe 'GET #index' do - before do - get :index - end - - it 'redirects to root' do - expect(flash[:alert]).to eq('You are not authorized to access this page.') - expect(response).to redirect_to(root_path) - end - end - - describe 'POST #create' do - it 'does not create new organization' do - expected = expect do - post :create, params: { organization: attributes_for(:organization) } - end - expected.not_to change(Organization, :count) - end - - it 'redirects to root' do - post :create, params: { organization: attributes_for(:organization) } - - expect(flash[:alert]).to eq('You are not authorized to access this page.') - expect(response).to redirect_to(root_path) - end - end - - describe 'PATCH #update' do - it 'does not update and redirects to root' do - old_name = organization.name - patch :update, params: { id: organization.id, organization: attributes_for(:organization, name: 'new name') } - - organization.reload - expect(organization.name).to eq(old_name) - expect(flash[:alert]).to eq('You are not authorized to access this page.') - expect(response).to redirect_to(root_path) - end - end - - describe 'DELETE #destroy' do - context 'for a valid organization' do - it 'does not destroy a resource' do - expected = expect do - delete :destroy, params: { id: organization.id } - end - expected.not_to change(Organization, :count) - end - - it 'redirects to root' do - delete :destroy, params: { id: organization.id } - - expect(flash[:alert]).to eq('You are not authorized to access this page.') - expect(response).to redirect_to(root_path) - end - end - end - end - - context 'logged in as admin' do - before do - sign_in admin - end - - describe 'GET #new' do - before do - get :new - end - - it { expect(response).to render_template('new') } - end - - describe 'GET #index' do - before do - get :index - end - - it { expect(response).to render_template('index') } - end - - describe 'POST #create' do - context 'with valid attributes' do - it 'creates new organization' do - expected = expect do - post :create, params: { organization: attributes_for(:organization) } - end - expected.to change { Organization.count }.by(1) - end - - it 'redirects to index' do - post :create, params: { organization: attributes_for(:organization) } - - expect(flash[:notice]).to eq('Organization successfully created') - expect(response).to redirect_to(admin_organizations_path) - end - end - - context 'with invalid attributes' do - it 'does not create new organization' do - expected = expect do - post :create, params: { organization: attributes_for(:organization, name: '') } - end - expected.not_to change(Organization, :count) - end - - it 'redirects to new' do - post :create, params: { organization: attributes_for(:organization, name: '') } - - expect(flash[:error]).to eq("Name can't be blank") - expect(response).to redirect_to(new_admin_organization_path) - end - end - end - - describe 'PATCH #update' do - it 'saves and redirects to index when the attributes are valid' do - patch :update, - params: { id: organization.id, organization: attributes_for(:organization, name: 'changed name') } - - organization.reload - expect(organization.name).to eq('changed name') - expect(flash[:notice]).to eq('Organization successfully updated') - expect(response).to redirect_to(admin_organizations_path) - end - - it 'redirects to edit when attributes are invalid' do - patch :update, params: { id: organization.id, organization: attributes_for(:organization, name: '') } - - expect(flash[:error]).to eq("Name can't be blank") - expect(response).to redirect_to(edit_admin_organization_path(organization)) - end - end - - describe 'DELETE #destroy' do - context 'for a valid organization' do - it 'successfullies destroy a resource' do - expected = expect do - delete :destroy, params: { id: organization.id } - end - expected.to change { Organization.count }.by(-1) - end - - it 'redirects to index' do - delete :destroy, params: { id: organization.id } - - expect(flash[:notice]).to eq('Organization successfully destroyed') - expect(response).to redirect_to(admin_organizations_path) - end - end - end - - describe 'POST #assign_org_admins' do - let(:org_admin_role) { Role.find_by(name: 'organization_admin', resource: organization) } - - before do - post :assign_org_admins, params: { id: organization.id, - user: { email: user.email } } - end - - it 'assigns organization_admin role' do - expect(user.roles).to eq [org_admin_role] - end - end - - describe 'DELETE #unassign_org_admins' do - let(:org_admin_role) { Role.find_by(name: 'organization_admin', resource: organization) } - let!(:org_admin_user) { create(:user, role_ids: [org_admin_role.id]) } - - before do - delete :unassign_org_admins, params: { id: organization.id, - user: { email: org_admin_user.email } } - end - - it 'unassigns organization_admin role' do - expect(org_admin_user.reload.roles).to eq [] - end - end - end -end diff --git a/spec/controllers/conference_registration_controller_spec.rb b/spec/controllers/conference_registration_controller_spec.rb index dfe04003b..18f18e0fe 100644 --- a/spec/controllers/conference_registration_controller_spec.rb +++ b/spec/controllers/conference_registration_controller_spec.rb @@ -12,7 +12,7 @@ shared_examples 'access #new action' do |user, ichain, path, message| before do sign_in send(user) if user - stub_const('ENV', ENV.to_hash.merge('OSEM_ICHAIN_ENABLED' => ichain)) + ENV['OSEM_ICHAIN_ENABLED'] = ichain get :new, params: { conference_id: conference.short_title } end @@ -28,7 +28,7 @@ shared_examples 'can access #new action' do |user, ichain| before do sign_in send(user) if user - stub_const('ENV', ENV.to_hash.merge('OSEM_ICHAIN_ENABLED' => ichain)) + ENV['OSEM_ICHAIN_ENABLED'] = ichain get :new, params: { conference_id: conference.short_title } end diff --git a/spec/controllers/organizations_controller_spec.rb b/spec/controllers/organizations_controller_spec.rb deleted file mode 100644 index 963863dc1..000000000 --- a/spec/controllers/organizations_controller_spec.rb +++ /dev/null @@ -1,60 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -describe OrganizationsController do - let!(:organization) { create(:organization) } - let!(:conference) do - create( - :conference, - splashpage: create(:splashpage, public: true), - venue: create(:venue), - organization: organization - ) - end - let!(:antiquated_conference) do - create( - :conference, - splashpage: create(:splashpage, public: true), - venue: create(:venue), - organization: organization, - start_date: 2.weeks.ago, - end_date: 1.week.ago - ) - end - - let!(:other_conference) { create(:conference) } - let!(:user) { create(:user) } - - describe 'GET #index' do - before do - sign_in user - get :index - end - - it { expect(response).to render_template('index') } - end - - describe 'GET #conferences' do - before do - get :conferences, params: { id: organization.id } - end - - it 'loads the organization' do - expect(assigns(:organization)).to eq organization - end - - it 'includes organization conferences' do - expect(assigns(:current)).to include conference - end - - it 'does not include conferences outside organization' do - expect(assigns(:current)).not_to include other_conference - expect(assigns(:antiquated)).not_to include other_conference - end - - it 'includes antiquated organization conferences' do - expect(assigns(:antiquated)).to include antiquated_conference - end - end -end diff --git a/spec/factories/conferences.rb b/spec/factories/conferences.rb index 5c1f9377a..7f87ccd7e 100644 --- a/spec/factories/conferences.rb +++ b/spec/factories/conferences.rb @@ -49,8 +49,6 @@ registration_limit { 0 } 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)') diff --git a/spec/factories/organizations.rb b/spec/factories/organizations.rb deleted file mode 100644 index 013b144cb..000000000 --- a/spec/factories/organizations.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -# == Schema Information -# -# Table name: organizations -# -# id :bigint not null, primary key -# code_of_conduct :text -# description :text -# name :string not null -# picture :string -# -FactoryBot.define do - factory :organization do - sequence(:name) { |n| "#{Faker::Company.name} #{n}" } - description { Faker::Lorem.paragraph } - - # after(:create) do |organization| - # File.open("spec/support/logos/#{1 + rand(13)}.png") do |file| - # organization.picture = file - # end - # organization.save! - # end - end -end diff --git a/spec/features/cfp_ability_spec.rb b/spec/features/cfp_ability_spec.rb index 8416692d7..bd56e49d0 100644 --- a/spec/features/cfp_ability_spec.rb +++ b/spec/features/cfp_ability_spec.rb @@ -2,9 +2,9 @@ require 'spec_helper' -describe 'Has correct abilities' do - let(:organization) { create(:organization) } - let(:conference) { create(:full_conference, organization: organization) } +feature 'Has correct abilities' do + + let(:conference) { create(:full_conference) } let(:role_cfp) { Role.find_by(name: 'cfp', resource: conference) } let(:user_cfp) { create(:user, role_ids: [role_cfp.id]) } @@ -13,7 +13,7 @@ sign_in user_cfp end - it 'for organization and conference attributes' do + scenario 'for conference attributes' do visit admin_conference_path(conference.short_title) expect(page).to have_current_path(admin_conference_path(conference.short_title), ignore_query: true) @@ -194,15 +194,6 @@ visit admin_conference_path(conference.short_title) expect(page).to have_current_path(admin_conference_path(conference.short_title), ignore_query: true) - visit admin_organizations_path - expect(page).to have_current_path(admin_organizations_path, ignore_query: true) - - visit edit_admin_organization_path(organization) - expect(page).to have_current_path(root_path, ignore_query: true) - - visit new_admin_organization_path - expect(page).to have_current_path(root_path, ignore_query: true) - visit edit_admin_conference_path(conference.short_title) expect(page).to have_current_path(root_path, ignore_query: true) diff --git a/spec/features/code_of_conduct_spec.rb b/spec/features/code_of_conduct_spec.rb deleted file mode 100644 index 633ebe113..000000000 --- a/spec/features/code_of_conduct_spec.rb +++ /dev/null @@ -1,91 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -describe 'Code of Conduct:' do - let!(:organization) { create(:organization) } - let!(:conference) { create(:full_conference, organization: organization) } - let(:admin) { create(:admin) } - let(:sample_text) { Faker::Lorem.paragraph } - - context 'on an organization' do - describe 'as admin' do - before { sign_in admin } - - it 'can add and remove' do - visit admin_organizations_path - within "tr#organization-#{organization.id}" do - expect(page).not_to have_css 'i.fa-check' - click_on 'Edit' - end - expect(page).to have_field 'organization[code_of_conduct]', with: '' - fill_in 'organization[code_of_conduct]', with: sample_text - click_on 'Update Organization' - within "tr#organization-#{organization.id}" do - expect(page).to have_css 'i.fa-check' - click_on 'Edit' - end - expect(page).to have_field 'organization[code_of_conduct]', with: sample_text - fill_in 'organization[code_of_conduct]', with: '' - click_on 'Update Organization' - within "tr#organization-#{organization.id}" do - expect(page).not_to have_css 'i.fa-check' - end - end - end - - describe 'anonymously' do - let!(:organization) { create(:organization, code_of_conduct: sample_text) } - - context 'on the organization' do - it 'can be read' do - visit organizations_path - within "#organization-#{organization.id}" do - click_on 'Code of Conduct' - end - expect(page).to have_text(sample_text) - end - end - - context 'on a conference' do - it 'is linked from the index' do - visit conferences_path - within "#conference-#{conference.id}" do - click_on 'Code of Conduct' - end - expect(page).to have_text(sample_text) - end - - it 'is included in the splash page', js: true do - visit conference_path(conference) - click_on 'Code of Conduct' - expect(page).to have_text(sample_text) - end - end - end - - describe 'as a participant' do - let!(:organization) { create(:organization, code_of_conduct: sample_text) } - let!(:participant) { create(:user) } - - before do - sign_in participant - visit conferences_path - within "#conference-#{conference.id}" do - click_on 'Register' - end - end - - it 'can be viewed', js: true do - page.find('input#registration_accepted_code_of_conduct') - expect(page).to have_text('I have read and accept the Code of Conduct') - expect(page).not_to have_text(sample_text) - within 'form' do - click_on 'Code of Conduct' - end - page.find('.modal-dialog') - expect(page).to have_content(sample_text) - end - end - end -end diff --git a/spec/features/conference_spec.rb b/spec/features/conference_spec.rb index eb00a0799..e1ff12aa3 100644 --- a/spec/features/conference_spec.rb +++ b/spec/features/conference_spec.rb @@ -2,38 +2,32 @@ require 'spec_helper' -describe Conference do - let!(:user) { create(:admin) } - let!(:organization) { create(:organization) } +feature Conference do + let(:user) { create(:admin) } - shared_examples 'add and update conference' do - it 'adds a new conference', feature: true, js: true do + describe 'admin' do + let(:conference) { create(:conference) } + + scenario 'adds a new conference', feature: true, js: true do expected_count = Conference.count + 1 sign_in user visit new_admin_conference_path - select organization.name, from: 'conference_organization_id' fill_in 'conference_title', with: 'Example Con' fill_in 'conference_short_title', with: 'ExCon' select('(GMT+01:00) Berlin', from: 'conference[timezone]') - today = Date.today - 1 - page - .execute_script("$('#conference-start-datepicker').val('" + - "#{today.strftime('%d/%m/%Y')}')") - page - .execute_script("$('#conference-end-datepicker').val('" + - "#{(today + 7).strftime('%d/%m/%Y')}')") - + today = Time.zone.today - 1 + fill_in 'conference_start_date', with: today.strftime('%Y/%m/%d') + fill_in 'conference_end_date', with: (today + 7).strftime('%Y/%m/%d') click_button 'Create Conference' page.find('#flash') expect(flash) .to eq('Conference was successfully created.') expect(Conference.count).to eq(expected_count) - expect(Conference.last.organization).to eq(organization) user.reload expect(user.has_cached_role?(:organizer, Conference.last)).to be(true) end @@ -50,14 +44,9 @@ fill_in 'conference_title', with: 'New Con' fill_in 'conference_short_title', with: 'NewCon' - day = Date.today + 10 - page - .execute_script("$('#conference-start-datepicker').val('" + - "#{day.strftime('%d/%m/%Y')}')") - page - .execute_script("$('#conference-end-datepicker').val('" + - "#{(day + 7).strftime('%d/%m/%Y')}')") - + day = Time.zone.today + 10 + fill_in 'conference_start_date', with: day.strftime('%Y/%m/%d') + fill_in 'conference_end_date', with: (day + 7).strftime('%Y/%m/%d') page.accept_alert do click_button 'Update Conference' end @@ -71,51 +60,4 @@ expect(Conference.count).to eq(expected_count) end end - - describe 'admin' do - let!(:conference) { create(:conference) } - - it 'has organization name in menu bar for conference views', feature: true, js: true do - sign_in user - visit admin_conference_path(conference.short_title) - - expect(find('.navbar-brand img')['alt']).to have_content conference.organization.name - end - - it_behaves_like 'add and update conference' - end - - describe 'user views' do - let!(:conference) { create(:full_conference, description: 'Welcome to this conference!', registered_attendees_message: 'This is an exclusive message!') } - let!(:registered_user) { create(:user) } - let!(:not_registered_user) { create(:user) } - let!(:registration) { create(:registration, user: registered_user, conference: conference) } - - context 'when user is registered for conference' do - before do - sign_in registered_user - visit conference_path(conference.short_title) - end - - it 'shows registered attendees message and description' do - expect(page).to have_content('Welcome to this conference!') - expect(page).to have_content('This is an exclusive message!') - end - end - - context 'when user is not registered for conference' do - before do - sign_in not_registered_user - visit conference_path(conference) - end - - it 'shows conference description' do - expect(page).to have_content('Welcome to this conference!') - end - - it 'does not show registered attendees message' do - expect(page).to have_no_content('This is an exclusive message!') - end - end - end end diff --git a/spec/features/info_desk_ability_spec.rb b/spec/features/info_desk_ability_spec.rb index 935e2ba27..1aa70cc58 100644 --- a/spec/features/info_desk_ability_spec.rb +++ b/spec/features/info_desk_ability_spec.rb @@ -2,9 +2,9 @@ require 'spec_helper' -describe 'Has correct abilities' do - let(:organization) { create(:organization) } - let(:conference) { create(:full_conference, organization: organization) } +feature 'Has correct abilities' do + + let(:conference) { create(:full_conference) } let(:role_info_desk) { Role.find_by(name: 'info_desk', resource: conference) } let(:user_info_desk) { create(:user, role_ids: [role_info_desk.id]) } @@ -13,7 +13,7 @@ sign_in user_info_desk end - it 'for organization and conference attributes' do + scenario 'for conference attributes' do visit admin_conference_path(conference.short_title) expect(page).to have_current_path(admin_conference_path(conference.short_title), ignore_query: true) @@ -51,15 +51,6 @@ expect(page).not_to have_link('E-Mails', href: "/admin/conferences/#{conference.short_title}/emails") expect(page).not_to have_link('New Conference', href: '/admin/conferences/new') - visit admin_organizations_path - expect(page).to have_current_path(admin_organizations_path, ignore_query: true) - - visit edit_admin_organization_path(organization) - expect(page).to have_current_path(root_path, ignore_query: true) - - visit new_admin_organization_path - expect(page).to have_current_path(root_path, ignore_query: true) - visit edit_admin_conference_path(conference.short_title) expect(page).to have_current_path(root_path, ignore_query: true) diff --git a/spec/features/organization_admin_ability_spec.rb b/spec/features/organization_admin_ability_spec.rb deleted file mode 100644 index c7480ba57..000000000 --- a/spec/features/organization_admin_ability_spec.rb +++ /dev/null @@ -1,306 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -describe 'Has correct abilities' do - let(:organization) { create(:organization) } - let(:conference) { create(:full_conference, organization: organization) } - let(:role_organization_admin) { Role.find_by(name: 'organization_admin', resource: organization) } - let(:user_organization_admin) { create(:user, role_ids: [role_organization_admin.id]) } - let!(:registration_ticket) { create(:registration_ticket, conference: conference) } - - context 'when user is organization_admin' do - before do - sign_in user_organization_admin - end - - it 'for organization attributes' do - visit admin_organizations_path - expect(page).to have_current_path(admin_organizations_path, ignore_query: true) - - visit edit_admin_organization_path(organization) - expect(page).to have_current_path(edit_admin_organization_path(organization), ignore_query: true) - - visit new_admin_organization_path - expect(page).to have_current_path(root_path, ignore_query: true) - end - - it 'for conference attributes' do - visit admin_conference_path(conference.short_title) - expect(page).to have_current_path(admin_conference_path(conference.short_title), ignore_query: true) - - expect(page).to have_selector('li.nav-header.nav-header-bigger a', text: 'Dashboard') - expect(page).to have_link('Basics', href: "/admin/conferences/#{conference.short_title}/edit") - expect(page).to have_link('Contact', href: "/admin/conferences/#{conference.short_title}/contact/edit") - expect(page).to have_link('Materials', href: "/admin/conferences/#{conference.short_title}/commercials") - expect(page).to have_link('Splashpage', href: "/admin/conferences/#{conference.short_title}/splashpage") - expect(page).to have_link('Venue', href: "/admin/conferences/#{conference.short_title}/venue") - expect(page).to have_link('Rooms', href: "/admin/conferences/#{conference.short_title}/venue/rooms") - expect(page).to have_link('Lodgings', href: "/admin/conferences/#{conference.short_title}/lodgings") - expect(page).to have_link('Program', href: "/admin/conferences/#{conference.short_title}/program") - expect(page).to have_link('Calls for Content', href: "/admin/conferences/#{conference.short_title}/program/cfps") - expect(page).to have_link('Events', href: "/admin/conferences/#{conference.short_title}/program/events") - expect(page).to have_link('Tracks', href: "/admin/conferences/#{conference.short_title}/program/tracks") - expect(page).to have_link('Event Types', href: "/admin/conferences/#{conference.short_title}/program/event_types") - expect(page).to have_link('Difficulty Levels', - href: "/admin/conferences/#{conference.short_title}/program/difficulty_levels") - expect(page).to have_link('Schedules', href: "/admin/conferences/#{conference.short_title}/schedules") - expect(page).to have_link('Reports', href: "/admin/conferences/#{conference.short_title}/program/reports") - expect(page).to have_link('Registrations', href: "/admin/conferences/#{conference.short_title}/registrations") - expect(page).to have_link('Registration Period', - href: "/admin/conferences/#{conference.short_title}/registration_period") - expect(page).to have_link('Questions', href: "/admin/conferences/#{conference.short_title}/questions") - expect(page).to have_text('Donations') - expect(page).to have_link('Sponsorship Levels', - href: "/admin/conferences/#{conference.short_title}/sponsorship_levels") - expect(page).to have_link('Sponsors', href: "/admin/conferences/#{conference.short_title}/sponsors") - expect(page).to have_link('Tickets', href: "/admin/conferences/#{conference.short_title}/tickets") - expect(page).to have_link('E-Mails', href: "/admin/conferences/#{conference.short_title}/emails") - expect(page).to have_link('Roles', href: "/admin/conferences/#{conference.short_title}/roles") - expect(page).to have_link('Resources', href: "/admin/conferences/#{conference.short_title}/resources") - expect(page).to have_link('New Conference', href: '/admin/conferences/new') - - visit edit_admin_conference_path(conference.short_title) - expect(page).to have_current_path(edit_admin_conference_path(conference.short_title), ignore_query: true) - - visit edit_admin_conference_contact_path(conference.short_title) - expect(page).to have_current_path(edit_admin_conference_contact_path(conference.short_title), ignore_query: true) - - visit admin_conference_commercials_path(conference.short_title) - expect(page).to have_current_path(admin_conference_commercials_path(conference.short_title), ignore_query: true) - - visit new_admin_conference_splashpage_path(conference.short_title) - expect(page).to have_current_path(new_admin_conference_splashpage_path(conference.short_title), - ignore_query: true) - - visit edit_admin_conference_splashpage_path(conference.short_title) - expect(page).to have_current_path(edit_admin_conference_splashpage_path(conference.short_title), - ignore_query: true) - - visit new_admin_conference_venue_path(conference.short_title) - expect(page).to have_current_path(new_admin_conference_venue_path(conference.short_title), ignore_query: true) - - conference.venue = create(:venue) - visit edit_admin_conference_venue_path(conference.short_title) - expect(page).to have_current_path(edit_admin_conference_venue_path(conference.short_title), ignore_query: true) - - visit admin_conference_venue_rooms_path(conference.short_title) - expect(page).to have_current_path(admin_conference_venue_rooms_path(conference.short_title), ignore_query: true) - - create(:room, venue: conference.venue) - visit edit_admin_conference_venue_room_path(conference.short_title, conference.venue.rooms.first) - expect(page).to have_current_path(edit_admin_conference_venue_room_path(conference.short_title, - conference.venue.rooms.first), ignore_query: true) - - visit admin_conference_lodgings_path(conference.short_title) - expect(page).to have_current_path(admin_conference_lodgings_path(conference.short_title), ignore_query: true) - - visit new_admin_conference_lodging_path(conference.short_title) - expect(page).to have_current_path(new_admin_conference_lodging_path(conference.short_title), ignore_query: true) - - create(:lodging, conference: conference) - visit edit_admin_conference_lodging_path(conference.short_title, conference.lodgings.first) - expect(page).to have_current_path( - edit_admin_conference_lodging_path(conference.short_title, conference.lodgings.first), ignore_query: true - ) - - visit new_admin_conference_program_path(conference.short_title) - expect(page).to have_current_path(new_admin_conference_program_path(conference.short_title), ignore_query: true) - - visit edit_admin_conference_program_path(conference.short_title) - expect(page).to have_current_path(edit_admin_conference_program_path(conference.short_title), ignore_query: true) - - # Only event exists - visit new_admin_conference_program_cfp_path(conference.short_title) - expect(page).to have_current_path(new_admin_conference_program_cfp_path(conference.short_title), - ignore_query: true) - - # Event and booth cfps exist - cfb = create(:cfp, cfp_type: 'booths', program: conference.program) - visit new_admin_conference_program_cfp_path(conference.short_title) - expect(page).to have_current_path new_admin_conference_program_cfp_path(conference.short_title), - ignore_query: true - - visit edit_admin_conference_program_cfp_path(conference.short_title, conference.program.cfp) - expect(page).to have_current_path( - edit_admin_conference_program_cfp_path(conference.short_title, conference.program.cfp), ignore_query: true - ) - - # Event, booth, track cfps exist - call_for_tracks = create(:cfp, cfp_type: 'tracks', program: conference.program) - visit new_admin_conference_program_cfp_path(conference.short_title) - expect(page).to have_current_path root_path, ignore_query: true - - # Booth and track cfps exist - conference.program.cfp.destroy! - visit new_admin_conference_program_cfp_path(conference.short_title) - expect(page).to have_current_path new_admin_conference_program_cfp_path(conference.short_title), - ignore_query: true - - # Only booth exists - call_for_tracks.destroy! - visit new_admin_conference_program_cfp_path(conference.short_title) - expect(page).to have_current_path(new_admin_conference_program_cfp_path(conference.short_title), - ignore_query: true) - - visit edit_admin_conference_program_cfp_path(conference.short_title, cfb) - expect(page).to have_current_path(edit_admin_conference_program_cfp_path(conference.short_title, cfb), - ignore_query: true) - - # No cfp exists - cfb.destroy - visit new_admin_conference_program_cfp_path(conference.short_title) - expect(page).to have_current_path(new_admin_conference_program_cfp_path(conference.short_title), - ignore_query: true) - - # Only Tracks cfp exists - call_for_tracks = create(:cfp, cfp_type: 'tracks', program: conference.program) - visit new_admin_conference_program_cfp_path(conference.short_title) - expect(page).to have_current_path new_admin_conference_program_cfp_path(conference.short_title), - ignore_query: true - - visit edit_admin_conference_program_cfp_path(conference.short_title, call_for_tracks) - expect(page).to have_current_path edit_admin_conference_program_cfp_path(conference.short_title, call_for_tracks), - ignore_query: true - - # Event and track cfps exist - create(:cfp, cfp_type: 'events', program: conference.program) - visit new_admin_conference_program_cfp_path(conference.short_title) - expect(page).to have_current_path new_admin_conference_program_cfp_path(conference.short_title), - ignore_query: true - - call_for_tracks.destroy! - visit admin_conference_program_events_path(conference.short_title) - expect(page).to have_current_path(admin_conference_program_events_path(conference.short_title), - ignore_query: true) - - create(:event, program: conference.program) - visit edit_admin_conference_program_event_path(conference.short_title, conference.program.events.first) - expect(page).to have_current_path(edit_admin_conference_program_event_path(conference.short_title, - conference.program.events.first), ignore_query: true) - - visit admin_conference_program_event_types_path(conference.short_title) - expect(page).to have_current_path(admin_conference_program_event_types_path(conference.short_title), - ignore_query: true) - - visit new_admin_conference_program_event_type_path(conference.short_title) - expect(page).to have_current_path(new_admin_conference_program_event_type_path(conference.short_title), - ignore_query: true) - - visit edit_admin_conference_program_event_type_path(conference.short_title, conference.program.event_types.first) - expect(page).to have_current_path(edit_admin_conference_program_event_type_path(conference.short_title, - conference.program.event_types.first), ignore_query: true) - - visit admin_conference_program_difficulty_levels_path(conference.short_title) - expect(page).to have_current_path(admin_conference_program_difficulty_levels_path(conference.short_title), - ignore_query: true) - - visit new_admin_conference_program_difficulty_level_path(conference.short_title) - expect(page).to have_current_path(new_admin_conference_program_difficulty_level_path(conference.short_title), - ignore_query: true) - - visit edit_admin_conference_program_difficulty_level_path(conference.short_title, - conference.program.difficulty_levels.first) - expect(page).to have_current_path(edit_admin_conference_program_difficulty_level_path(conference.short_title, - conference.program.difficulty_levels.first), ignore_query: true) - - visit admin_conference_schedules_path(conference.short_title) - expect(page).to have_current_path(admin_conference_schedules_path(conference.short_title), ignore_query: true) - - create(:schedule, program: conference.program) - visit admin_conference_schedule_path(conference.short_title, conference.program.schedules.first) - expect(page).to have_current_path(admin_conference_schedule_path(conference.short_title, - conference.program.schedules.first), ignore_query: true) - - visit admin_conference_program_reports_path(conference.short_title) - expect(page).to have_current_path(admin_conference_program_reports_path(conference.short_title), - ignore_query: true) - - visit admin_conference_registrations_path(conference.short_title) - expect(page).to have_current_path(admin_conference_registrations_path(conference.short_title), ignore_query: true) - - # Create a registration for a user, which requires a registration ticket. - other_user = create(:user) - ticket = conference.registration_tickets.first - create(:paid_ticket_purchase, - 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(page).to have_current_path(edit_admin_conference_registration_path(conference.short_title, - conference.registrations.first), ignore_query: true) - - visit new_admin_conference_registration_period_path(conference.short_title) - expect(page).to have_current_path(new_admin_conference_registration_period_path(conference.short_title), - ignore_query: true) - - create(:registration_period, conference: conference) - visit edit_admin_conference_registration_period_path(conference.short_title) - expect(page).to have_current_path(edit_admin_conference_registration_period_path(conference.short_title), - ignore_query: true) - - visit admin_conference_questions_path(conference.short_title) - expect(page).to have_current_path(admin_conference_questions_path(conference.short_title), ignore_query: true) - - visit admin_conference_sponsorship_levels_path(conference.short_title) - expect(page).to have_current_path(admin_conference_sponsorship_levels_path(conference.short_title), - ignore_query: true) - - visit new_admin_conference_sponsorship_level_path(conference.short_title) - expect(page).to have_current_path(new_admin_conference_sponsorship_level_path(conference.short_title), - ignore_query: true) - - create(:sponsorship_level, conference: conference) - visit edit_admin_conference_sponsorship_level_path(conference.short_title, conference.sponsorship_levels.first) - expect(page).to have_current_path(edit_admin_conference_sponsorship_level_path(conference.short_title, - conference.sponsorship_levels.first), ignore_query: true) - - visit admin_conference_sponsors_path(conference.short_title) - expect(page).to have_current_path(admin_conference_sponsors_path(conference.short_title), ignore_query: true) - - visit new_admin_conference_sponsor_path(conference.short_title) - expect(page).to have_current_path(new_admin_conference_sponsor_path(conference.short_title), ignore_query: true) - - create(:sponsor, conference: conference, sponsorship_level: conference.sponsorship_levels.first) - visit edit_admin_conference_sponsor_path(conference.short_title, conference.sponsors.first) - expect(page).to have_current_path( - edit_admin_conference_sponsor_path(conference.short_title, conference.sponsors.first), ignore_query: true - ) - - visit admin_conference_tickets_path(conference.short_title) - expect(page).to have_current_path(admin_conference_tickets_path(conference.short_title), ignore_query: true) - - visit new_admin_conference_ticket_path(conference.short_title) - expect(page).to have_current_path(new_admin_conference_ticket_path(conference.short_title), ignore_query: true) - - create(:ticket, conference: conference) - visit edit_admin_conference_ticket_path(conference.short_title, conference.tickets.first) - expect(page).to have_current_path( - edit_admin_conference_ticket_path(conference.short_title, conference.tickets.first), ignore_query: true - ) - - visit admin_conference_program_tracks_path(conference.short_title) - expect(page).to have_current_path(admin_conference_program_tracks_path(conference.short_title), - ignore_query: true) - - visit admin_conference_roles_path(conference.short_title) - expect(page).to have_current_path(admin_conference_roles_path(conference.short_title), ignore_query: true) - - visit admin_conference_emails_path(conference.short_title) - expect(page).to have_current_path(admin_conference_emails_path(conference.short_title), ignore_query: true) - - visit admin_conference_resources_path(conference.short_title) - expect(page).to have_current_path(admin_conference_resources_path(conference.short_title), ignore_query: true) - - visit new_admin_conference_resource_path(conference.short_title) - expect(page).to have_current_path(new_admin_conference_resource_path(conference.short_title), ignore_query: true) - - create(:resource, conference: conference) - visit edit_admin_conference_resource_path(conference.short_title, conference.resources.first) - expect(page).to have_current_path(edit_admin_conference_resource_path(conference.short_title, - conference.resources.first), ignore_query: true) - - visit admin_revision_history_path - expect(page).to have_current_path(admin_revision_history_path, ignore_query: true) - end - end -end diff --git a/spec/features/organization_spec.rb b/spec/features/organization_spec.rb deleted file mode 100644 index 31ee01d96..000000000 --- a/spec/features/organization_spec.rb +++ /dev/null @@ -1,64 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -describe Organization do - let!(:organization) { create(:organization) } - let!(:organization_admin_role) { Role.find_by(name: 'organization_admin', resource: organization) } - let(:organization_admin) { create(:user, role_ids: [organization_admin_role.id]) } - let(:admin_user) { create(:admin) } - - shared_examples 'successfully updates an organization' do - it 'updates a exsisting organization', feature: true, js: true do - visit edit_admin_organization_path(organization) - fill_in 'organization_name', with: 'changed name' - - click_button 'Update Organization' - - organization.reload - page.find('#flash') - expect(flash).to eq('Organization successfully updated') - expect(organization.name).to eq('changed name') - end - end - - context 'signed in as site admin' do - before do - sign_in admin_user - end - - it 'creates a new organization', feature: true, js: true do - visit new_admin_organization_path - fill_in 'organization_name', with: 'Organization name' - - click_button 'Create Organization' - page.find('#flash') - expect(flash).to eq('Organization successfully created') - expect(Organization.last.name).to eq('Organization name') - end - - it_behaves_like 'successfully updates an organization' - end - - context 'signed in as organization admin' do - before do - sign_in organization_admin - end - - it "can't create new organization", feature: true, js: true do - visit new_admin_organization_path - page.find('#flash') - expect(flash).to eq('You are not authorized to access this page.') - end - - it_behaves_like 'successfully updates an organization' - end - - context 'anonymously' do - it 'index should link to conferences list' do - visit organizations_path - - expect(page).to have_link('Conferences', href: "/organizations/#{organization.id}/conferences") - end - end -end diff --git a/spec/features/organizer_ability_spec.rb b/spec/features/organizer_ability_spec.rb index 511c36eea..a0026e9d9 100644 --- a/spec/features/organizer_ability_spec.rb +++ b/spec/features/organizer_ability_spec.rb @@ -2,13 +2,10 @@ require 'spec_helper' -describe 'Has correct abilities' do - let(:organization) { create(:organization) } - let(:conference) { create(:full_conference, organization: organization) } - # user is organizer, venue is not set by default - let(:other_conference) do - create(:conference, organization: organization) - end +feature 'Has correct abilities' do + + let(:conference) { create(:full_conference) } + let(:other_conference) { create(:conference) } # user is organizer, venue is not set by default let(:role_organizer_conf) { Role.find_by(name: 'organizer', resource: conference) } let(:role_organizer_other_conf) { Role.find_by(name: 'organizer', resource: other_conference) } let(:user_organizer) { create(:user, role_ids: [role_organizer_conf.id, role_organizer_other_conf.id]) } @@ -19,18 +16,7 @@ sign_in user_organizer end - it 'for organization attributes' do - visit admin_organizations_path - expect(page).to have_current_path(admin_organizations_path, ignore_query: true) - - visit edit_admin_organization_path(organization) - expect(page).to have_current_path(root_path, ignore_query: true) - - visit new_admin_organization_path - expect(page).to have_current_path(root_path, ignore_query: true) - end - - it 'for conference attributes' do + scenario 'for conference attributes' do visit admin_conference_path(conference.short_title) expect(page).to have_current_path(admin_conference_path(conference.short_title), ignore_query: true) diff --git a/spec/features/registration_periods_spec.rb b/spec/features/registration_periods_spec.rb index 1b6b4a901..ad7fe8ec3 100644 --- a/spec/features/registration_periods_spec.rb +++ b/spec/features/registration_periods_spec.rb @@ -16,64 +16,33 @@ click_link 'New Registration Period' end - it 'requires start date and end date', feature: true do - visit admin_conference_registration_period_path(conference_id: conference) - click_link 'New Registration Period' - - click_button 'Save Registration Period' - page.find('#flash') - expect(flash) - .to eq('An error prohibited the Registration Period from being saved: ' \ - "Start date can't be blank. End date can't be blank.") - end - context 'with tickets' do let!(:registration_ticket) do create(:registration_ticket, conference: conference) end it 'creates registration period', feature: true, js: true do - page - .execute_script("$('#registration-period-start-datepicker').val('" + - "#{start_date.strftime('%d/%m/%Y')}')") - page - .execute_script("$('#registration-period-end-datepicker').val('" + - "#{end_date.strftime('%d/%m/%Y')}')") - + fill_in 'registration_period_start_date', with: start_date.strftime('%Y/%m/%d') + fill_in 'registration_period_end_date', with: end_date.strftime('%Y/%m/%d') click_button 'Save Registration Period' page.find('#flash') expect(flash).to eq('Registration Period successfully updated.') expect(page).to have_current_path(admin_conference_registration_period_path(conference.short_title), ignore_query: true) expect(page).to have_text("Ticket required?\nYes") - - registration_period = RegistrationPeriod.where(conference_id: conference.id).first - registration_period.reload - expect(registration_period.start_date).to eq(start_date) - expect(registration_period.end_date).to eq(end_date) end end context 'without tickets' do it 'creates registration period', feature: true, js: true do - page - .execute_script("$('#registration-period-start-datepicker').val('" + - "#{start_date.strftime('%d/%m/%Y')}')") - page - .execute_script("$('#registration-period-end-datepicker').val('" + - "#{end_date.strftime('%d/%m/%Y')}')") - + fill_in 'registration_period_start_date', with: start_date.strftime('%Y-%m-%d') + fill_in 'registration_period_end_date', with: end_date.strftime('%Y-%m-%d') click_button 'Save Registration Period' page.find('#flash') expect(flash).to eq('Registration Period successfully updated.') expect(page).to have_current_path(admin_conference_registration_period_path(conference.short_title), ignore_query: true) expect(page).to have_text("Ticket required?\nNo") - - registration_period = RegistrationPeriod.where(conference_id: conference.id).first - registration_period.reload - expect(registration_period.start_date).to eq(start_date) - expect(registration_period.end_date).to eq(end_date) end end end diff --git a/spec/features/splashpage_spec.rb b/spec/features/splashpage_spec.rb index ed8ce86bf..2d9a88e8a 100644 --- a/spec/features/splashpage_spec.rb +++ b/spec/features/splashpage_spec.rb @@ -65,21 +65,6 @@ end end - context 'navigation' do - let!(:splashpage) { create(:splashpage, conference: conference, public: true) } - - context 'multiple organizations' do - let!(:additional_organization) { create(:organization) } - - it 'has organization logo', feature: true, js: true do - sign_in participant - visit conference_path(conference.short_title) - - expect(find('.navbar-brand img')['alt']).to have_content conference.organization.name - end - end - end - context 'happening now section', feature: true, js: true do let!(:conference2) do create(:full_conference, start_date: 1.day.ago, end_date: 7.days.from_now, start_hour: 0, end_hour: 24) diff --git a/spec/features/track_organizer_ability_spec.rb b/spec/features/track_organizer_ability_spec.rb index 3f4690a4f..b71c8152d 100644 --- a/spec/features/track_organizer_ability_spec.rb +++ b/spec/features/track_organizer_ability_spec.rb @@ -2,9 +2,9 @@ require 'spec_helper' -describe 'Has correct abilities' do - let(:organization) { create(:organization) } - let(:conference) { create(:full_conference, organization: organization) } +feature 'Has correct abilities' do + + let(:conference) { create(:full_conference) } let(:self_organized_track) { create(:track, :self_organized, program: conference.program, state: 'confirmed') } let(:role_track_organizer) { Role.where(name: 'track_organizer', resource: self_organized_track).first_or_create } let(:user_track_organizer) { create(:user, role_ids: [role_track_organizer.id]) } @@ -14,7 +14,7 @@ sign_in user_track_organizer end - it 'for organization and conference attributes' do + scenario 'for conference attributes' do visit admin_conference_path(conference.short_title) expect(page).to have_current_path(admin_conference_path(conference.short_title), ignore_query: true) diff --git a/spec/features/user_ability_spec.rb b/spec/features/user_ability_spec.rb index e1ac1ed7b..ee4ecbfbf 100644 --- a/spec/features/user_ability_spec.rb +++ b/spec/features/user_ability_spec.rb @@ -2,9 +2,9 @@ require 'spec_helper' -describe 'Has correct abilities' do - let(:organization) { create(:organization) } - let(:conference) { create(:full_conference, organization: organization) } # user is cfp +feature 'Has correct abilities' do + + let(:conference) { create(:full_conference) } # user is cfp let(:user) { create(:user) } context 'when user has no role' do diff --git a/spec/features/versions_spec.rb b/spec/features/versions_spec.rb index 861abcf08..cd4032462 100644 --- a/spec/features/versions_spec.rb +++ b/spec/features/versions_spec.rb @@ -311,42 +311,7 @@ expect(page).to have_no_text('Someone (probably via the console) created new commercial') end - it 'display changes in organization', feature: true, versioning: true, js: true do - admin = create(:admin) - sign_in admin - - visit new_admin_organization_path - fill_in 'organization_name', with: 'New org' - click_button 'Create Organization' - - visit admin_revision_history_path - expect(page).to have_text('created new organization New org') - end - - context 'organization role', feature: true, versioning: true, js: true do - let!(:organization_admin) { create(:organization_admin, organization: conference.organization) } - let!(:user) { create(:user) } - - before do - user.add_role :organization_admin, conference.organization - user.remove_role :organization_admin, conference.organization - - sign_in organization_admin - visit admin_revision_history_path - end - - it 'is recorded to history when user is added' do - skip('fails since paper_trail 12.2.0') - expect(page).to have_text(/added role organization_admin with ID \d+ to user #{user.name} in organization #{conference.organization.name}/) - end - - it 'is recorded to history when user is removed' do - skip('fails since paper_trail 12.2.0') - expect(page).to have_text(/removed role organization_admin with ID \d+ from user #{user.name} in organization #{conference.organization.name}/) - end - end - - it 'display changes in users_role for conference role', feature: true, versioning: true, js: true do + scenario 'display changes in users_role for conference role', feature: true, versioning: true, js: true do user = create(:user) role = Role.find_by(name: 'cfp', resource_id: conference.id, resource_type: 'Conference') user.add_role :cfp, conference diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 808a2827d..244a7edde 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -70,27 +70,6 @@ ENV.delete('OSEM_NAME') expect(nav_root_link_for(nil)).to include image_tag('snapcon_logo.png', alt: 'OSEM') end - - it 'uses the conference organization name' do - expect(nav_root_link_for(conference)).to include image_tag(conference.picture.thumb.url, - alt: conference.organization.name) - end - end - - describe 'navigation link title text' do - it 'defaults to OSEM' do - ENV.delete('OSEM_NAME') - expect(nav_link_text(nil)).to match 'OSEM' - end - - it 'uses the environment variable' do - ENV['OSEM_NAME'] = Faker::Company.name + "'" - expect(nav_link_text(nil)).to match ENV.fetch('OSEM_NAME', nil) - end - - it 'uses the conference organization name' do - expect(nav_link_text(conference)).to match conference.organization.name - end end end diff --git a/spec/models/organization_spec.rb b/spec/models/organization_spec.rb deleted file mode 100644 index e60cb7da3..000000000 --- a/spec/models/organization_spec.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -# == Schema Information -# -# Table name: organizations -# -# id :bigint not null, primary key -# code_of_conduct :text -# description :text -# name :string not null -# picture :string -# -require 'spec_helper' - -describe Organization do - let(:organization) { create(:organization) } - - describe 'validation' do - it 'is not valid without a name' do - expect(subject).to validate_presence_of(:name) - end - end - - describe 'associations' do - it { is_expected.to have_many(:conferences).dependent(:destroy) } - end -end diff --git a/spec/support/external_request.rb b/spec/support/external_request.rb index 6fd7af57f..b4d3df0cc 100644 --- a/spec/support/external_request.rb +++ b/spec/support/external_request.rb @@ -2,6 +2,7 @@ # Mock external requests to youtube require 'webmock/rspec' + driver_urls = Webdrivers::Common.subclasses.map do |driver| Addressable::URI.parse(driver.base_url).host end diff --git a/spec/support/save_feature_failures.rb b/spec/support/save_feature_failures.rb index 66aa399f8..20b2496f2 100644 --- a/spec/support/save_feature_failures.rb +++ b/spec/support/save_feature_failures.rb @@ -7,6 +7,7 @@ example_filename = File.expand_path(example_filename, Capybara.save_path) example_screenshotname = "#{example_filename}.png" example_filename += '.html' + # rubocop:disable Lint/Debugger if RSpec.current_example.exception.present? save_page(example_filename) save_screenshot(example_screenshotname) @@ -15,5 +16,6 @@ FileUtils.rm_rf(example_filename) FileUtils.rm_rf(example_screenshotname) end + # rubocop:enable Lint/Debugger end end diff --git a/spec/support/webmock.rb b/spec/support/webmock.rb new file mode 100644 index 000000000..29af2a1b2 --- /dev/null +++ b/spec/support/webmock.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +# Allow webdriver update urls +# from https://github.com/titusfortner/webdrivers/wiki/Using-with-VCR-or-WebMock +allowed_urls = Webdrivers::Common.subclasses.map(&:base_url) +allowed_urls << /geckodriver/ +# We've seen [a redirect](https://github.com/titusfortner/webdrivers/issues/204) to this domain +allowed_urls += ['github-releases.githubusercontent.com'] + +# Allow stripe.com for stripe integration tests +allowed_urls += ['stripe.com'] + +WebMock.disable_net_connect!(allow_localhost: true, allow: allowed_urls)