Commit graph

3607 commits

Author SHA1 Message Date
Andrew Kvalheim
c2c074c3c5 Merge #​2673 "Serve precompiled assets in example Docker Compose configuration" 2020-06-26 20:19:41 -07:00
Andrew Kvalheim
3f1c8068ee Merge #​2667 "Work around bug in migrations to non-null columns" 2020-06-26 20:19:40 -07:00
Andrew Kvalheim
86713f992e Merge #​2666 "Fix migration that fails on conferences without pictures" 2020-06-26 20:19:40 -07:00
Andrew Kvalheim
e11f634377 Merge #​2665 "Annotate past migrations with Rails version" 2020-06-26 20:19:39 -07:00
Andrew Kvalheim
d7a5351b7c Merge #​2663 "Update Docker Compose file format: 2.0 → 2.4 (minor)" 2020-06-26 20:19:38 -07:00
Andrew Kvalheim
0618f93660 Merge #​2662 "Fix bug in test of animated form" 2020-06-26 20:19:37 -07:00
Andrew Kvalheim
943f0afaaf Merge #​2659 "Use Rails transactional tests" 2020-06-26 20:19:36 -07:00
Andrew Kvalheim
305c7cac28 Merge #​2658 "Fix bug in logging of screenshots of failed tests" 2020-06-26 20:19:36 -07:00
Andrew Kvalheim
04a77a6043 Merge #​2657 "Remove superfluous click to display Markdown editor" 2020-06-26 20:19:35 -07:00
Andrew Kvalheim
e4251d7b67 Merge #​2654 "Fix access to the version history of organization-level roles" 2020-06-26 20:19:34 -07:00
Andrew Kvalheim
668aa388a1 Merge #​2655 "Ignore schema.rb in RuboCop" 2020-06-26 20:19:34 -07:00
Andrew Kvalheim
042fe17fdb Merge #​2649 "Work around ChromeDriver/Chromium crash" 2020-06-26 20:19:33 -07:00
Andrew Kvalheim
09b30b4b23 Merge #​2648 "Resolve conflict between WebMock and Webdrivers" 2020-06-26 20:19:32 -07:00
Andrew Kvalheim
14fe81be29 Merge #​2647 "Install missing test dependency in base image" 2020-06-26 20:19:32 -07:00
Andrew Kvalheim
c5f937902a Merge #​2670 "Update all of rails: 5.2.3 → 5.2.4.3 (minor)" 2020-06-26 20:19:31 -07:00
Andrew Kvalheim
dd40243fbf Merge #​2646 "Use version range instead of OSEM_RUBY_VERSION." 2020-06-26 20:19:10 -07:00
Andrew Kvalheim
ace4fd4996 Merge #​2640 "Explicitly configure database authentication in Docker Compose" 2020-06-26 20:19:10 -07:00
depfu[bot]
7baf1099ab
Update all of rails to version 5.2.4.3 2020-06-20 02:40:59 +00:00
James Mason
6e6a6dcd39
Merge pull request #2679 from openSUSE/depfu/update/rack-2.1.4
🚨 [security] Update rack: 2.0.8 → 2.1.4 (minor)
2020-06-19 19:33:39 -07:00
depfu[bot]
3a3c0e6f2f
Update rack to version 2.1.4 2020-06-20 02:10:35 +00:00
James Mason
8c96a6cc9a
Merge pull request #2677 from openSUSE/depfu/update/websocket-extensions-0.1.5
🚨 [security] Update websocket-extensions: 0.1.4 → 0.1.5 (minor)
2020-06-19 19:09:34 -07:00
James Mason
0d876de27f
Merge pull request #2672 from openSUSE/depfu/update/puma-3.12.6
🚨 [security] Update puma: 3.12.4 → 3.12.6 (patch)
2020-06-19 19:09:13 -07:00
James Mason
754c47e41b
Merge pull request #2656 from AndrewKvalheim/ajax-datatables-rails-293-postgresql
Fix bug in UserDatatable query affecting PostgreSQL
2020-06-19 19:07:18 -07:00
depfu[bot]
acb3654af2
Update websocket-extensions to version 0.1.5 2020-06-05 18:44:31 +00:00
Andrew Kvalheim
b7187323a7 Serve precompiled assets in example Docker Compose configuration
Continues 959d5af.
2020-05-30 09:36:26 -07:00
depfu[bot]
4e6c74ecb5
Update puma to version 3.12.6 2020-05-22 20:50:27 +00:00
Stella Rouzi
a89201ff82
Merge pull request #2671 from ifellinaholeonce/master
Add uniqueness tests for Event scope on Vote model with User association
2020-05-21 08:47:26 +03:00
Tymm Schmitke
40036899b3 Add empty line at end of file 2020-05-19 23:18:05 -04:00
Tymm Schmitke
aa99f909a6 Add uniqueness tests for Event scope on Vote model with User association 2020-05-19 22:24:37 -04:00
Andrew Kvalheim
16b7d6f69d Work around bug in migrations to non-null columns
When running migration 20170705075039 followed by 20170715131706, the
latter fails due to lingering null values in a newly non-null column—

    Mysql2::Error: Invalid use of NULL value: ALTER TABLE `tracks` CHANGE `state` `state` varchar(255) DEFAULT 'new' NOT NULL
    db/migrate/20170715131706_make_track_state_not_null_and_add_default_value.rb:17:in `change'

—despite having apparently converted any existing null values prior to
changing the column type. Investigation reveals that actually the
attempted conversion has had no effect, and that this can be resolved by
clearing ActiveRecord internal caches between migrations:

    connection.schema_cache.clear_data_source_cache! 'tracks'

The same problem also affects running 20170705075039 followed by
20170720134353, but in that case it leads to silent data corruption as
`change_column_null` automatically converts any lingering null values.

This commit 1) clears ActiveRecord internal caches at the beginning of
each affected migration, and 2) replaces `change_column_null` with
`change_column` to reflect that no automatic conversion is intended.
2020-05-12 08:18:12 -07:00
Andrew Kvalheim
63aa240e65 Fix migration that fails on conferences without pictures
CarrierWave documentation:

> Note: `recreate_versions!` will throw an exception on records without
> an image. To avoid this, scope the records to those with images or
> check if an image exists within the block.

Resolves #1976:

    NoMethodError: undefined method `read' for nil:NilClass
    …/carrierwave-1.3.1/lib/carrierwave/uploader/cache.rb:81:in `sanitized_file'
    …/carrierwave-1.3.1/lib/carrierwave/uploader/cache.rb:118:in `cache!'
    …/carrierwave-1.3.1/lib/carrierwave/uploader/versions.rb:234:in `recreate_versions!'
    db/migrate/20171130172334_rebuild_conference_pictures.rb:4:in `block in up'
2020-05-12 07:43:58 -07:00
Andrew Kvalheim
4a0961e88e Annotate past migrations with Rails version
Many migrations currently fail to run with:

> Directly inheriting from ActiveRecord::Migration is not supported.
> Please specify the Rails release the migration was written for:
>
>     class Example < ActiveRecord::Migration[4.2]

I've annotated those that I need to run with the Rails version at the
time each was committed:

    rake db:migrate:status \
    | grep --perl-regexp --only-matching '(?<=^  down    )\d{14}' \
    | while read -r id; do
      path="$(ls -1 db/migrate/${id}_*.rb)"
      version="$(git show "$(git log --diff-filter=A --pretty=format:%H -- "$path")":Gemfile.lock \
        | grep --perl-regexp --only-matching '(?<=^    rails \()\d+\.\d+(?=(\.\d+)+\))')"
      sed --in-place -e "s/\(< ActiveRecord::Migration\)$/\\1[$version]/" "$path"
    done
2020-05-12 07:09:28 -07:00
Andrew Kvalheim
c34b55c1b8 Update Docker Compose file format: 2.0 → 2.4 (minor)
Allows the use of additional parameters such as `cpus` and
`healthcheck`.
2020-04-13 08:45:31 -07:00
Andrew Kvalheim
e657d37c8d Whitelist Webdrivers update URLs in WebMock
Resolves #2557:

    $ docker-compose run --rm osem bundle exec rspec --tag js
    …
    WebMock::NetConnectNotAllowedError

See titusfortner/webdrivers#109 for details.
2020-04-12 17:43:46 -07:00
Andrew Kvalheim
e077fe9671 Fix bug in test of animated form
The help text for the event type field is animated using a technique
unaffected by `Capybara.disable_animation`. Wait for the animation.

Resolves: #2356
Works around: #2661
2020-04-12 13:40:49 -07:00
James Mason
dfb159a0e1
Merge pull request #2638 from openSUSE/depfu/update/puma-3.12.4
🚨 [security] Update puma: 3.12.2 → 3.12.4 (patch)
2020-04-06 09:48:04 -07:00
James Mason
49639dadb1
Merge pull request #2637 from openSUSE/depfu/update/sqlite3-1.4.2
Update sqlite3: 1.4.1 → 1.4.2 (patch)
2020-04-06 09:46:41 -07:00
James Mason
8403074765
Merge pull request #2644 from openSUSE/depfu/update/json-2.3.0
🚨 [security] Update json: 2.2.0 → 2.3.0 (minor)
2020-04-06 09:46:08 -07:00
Stella Rouzi
303129bf45
Merge pull request #2652 from AndrewKvalheim/test-unspecified-order-2
Decouple tests from unspecified data ordering (part 2)
2020-04-06 15:26:07 +03:00
Andrew Kvalheim
ae00a7f055 Use Rails transactional tests
As of Rails 5.1:

  - Rails has built-in support for running tests within database
    transactions, so Database Cleaner is no longer needed for this.
  - Rails automatically shares the database connection across threads,
    so transactional_capybara is no longer needed.

Changes:

  - Enable `use_transactional_tests`.
  - Remove transactional_capybara.
  - Remove the Database Cleaner test wrapper.

This resolves:

  - transactional_capybara mismanages the shared database connection,
    causing the connection to falsely report as idle after the first
    test. At 6 minutes (idle_timeout + reaping_frequency) into testing,
    the connection is closed, causing e.g. `PG::ConnectionBad` errors.
2020-04-05 13:15:12 -07:00
Andrew Kvalheim
11a7e056bf Fix bug in test database preparation
Presumably the intent of this was to clear the database and repopulate
it with seed data. `transaction` isn't the right strategy for this; it
just rolls back any existing transactions.
2020-04-05 13:15:04 -07:00
Andrew Kvalheim
3aa32aebe8 Remove redundant code
This functionality is provided by transactional_capybara.
2020-04-05 13:14:55 -07:00
Andrew Kvalheim
75f64508de Work around RuboCop false positive
Details: rubocop-hq/rubocop#7853
2020-04-05 10:24:51 -07:00
Andrew Kvalheim
3142c0f164 Fix bug in logging of screenshots of failed tests
Presumably this was a typo.
2020-04-05 10:24:27 -07:00
Andrew Kvalheim
5b3520801f Use correct loading mode of Bootstrap-Markdown
data-provide="markdown-editable" is intended for inline editing of page
content à la contenteditable. When this is applied to a textarea, the
editor is loaded only after the user clicks on the field. This behavior
breaks focus and is incompatible with keyboard navigation.
2020-04-04 22:09:48 -07:00
Andrew Kvalheim
4182b6fb8f Fix bug in UserDatatable query affecting PostgreSQL
Resolves:

    $ docker-compose run --rm osem bundle exec rspec ./spec/datatables/user_datatable_spec.rb:97
    …
    ActiveRecord::StatementInvalid:
    PG::GroupingError: ERROR:  column "users.id" must appear in the GROUP BY clause or be used in an aggregate function
2020-04-04 10:35:56 -07:00
Andrew Kvalheim
d3e73b103f Document workaround for jbox-web/ajax-datatables-rails#293 2020-04-04 10:35:44 -07:00
Andrew Kvalheim
17c0abb2de Don't clobber RuboCop's default excludes
By default, adding an exclude (faffc49) has the effect of removing the
default excludes. Merge them as described in rubocop-hq/rubocop#6567.
2020-04-03 17:06:36 -07:00
Andrew Kvalheim
faffc49020 Exclude Rails database schema from linting
The schema is automatically generated, so RuboCop's recommendations are
non-actionable; ignore it as in rubocop-hq/rubocop#752.
2020-04-03 16:39:23 -07:00
Andrew Kvalheim
fe2e5febe3 Deconflate organization/conference IDs in role versions
Resolves failing test spec/features/versions_spec.rb:320.
2020-04-03 16:19:36 -07:00