diff --git a/.dockerignore b/.dockerignore
index e3cd043e9..fb4e9b361 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -6,9 +6,12 @@
# Ignore bundler config.
/.bundle
-# Ignore all environment files (except templates).
+# Ignore all environment files
/.env*
-!/.env*.erb
+
+# Ignore Kamal files.
+/config/deploy*.yml
+/.kamal
# Ignore all default key files.
/config/master.key
diff --git a/.gitignore b/.gitignore
index f856c4e89..e7cd399ce 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,9 +7,8 @@
# Ignore bundler config
/.bundle
-# Ignore all environment files (except templates).
+# Ignore all environment files
/.env*
-!/.env*.erb
# Ignore all logfiles and tempfiles.
/log/*
diff --git a/.rubocop.yml b/.rubocop.yml
index 0d729d038..dbcb46b2c 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -12,8 +12,8 @@ require:
Rails:
Enabled: true
AllCops:
- TargetRubyVersion: 3.2.5
- TargetRailsVersion: 7.1
+ TargetRubyVersion: 3.4
+ TargetRailsVersion: 8.0
Style/StringLiterals:
EnforcedStyle: single_quotes
diff --git a/.ruby-version b/.ruby-version
index 5ae69bd5f..7bcbb3808 100644
--- a/.ruby-version
+++ b/.ruby-version
@@ -1 +1 @@
-3.2.5
+3.4.9
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0c88f2f20..ac7ab1bba 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,16 @@
+### 1.22.0
+
+**Rails 7.2 Upgrade**
+The primary goal of this release is to upgrade the Rails version without causing
+any breaking changes to functionality.
+
+* Upgrades Rails 7.1.3.4 to 8.0.5
+* Upgrades Ruby 3.2.5 to 3.4.9
+* Some dependency updates/changes allowed or required by the above:
+ * Upgraded `sprockets` from 3.7.2 to 4.0.3
+ * Upgraded `papertrail` from 15.1.0 to 17.0.0
+ * Upgraded `acts-as-taggable-on` from 10.0.0 to 12.0.0
+
### 1.21.2
**Species+**
diff --git a/Dockerfile b/Dockerfile
index 5b18e7dcc..5ce6e24a8 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -4,7 +4,7 @@
# or SUS-ORS project.
# Dockerfile
-FROM ruby:3.2.5
+FROM ruby:3.4.9
# Rails and SAPI has some additional dependencies, e.g. rake requires a JS
# runtime, so attempt to get these from apt, where possible
@@ -21,11 +21,13 @@ RUN apt-get update && apt-get install -y --force-yes \
RUN mkdir /SAPI
WORKDIR /SAPI
-#
-# Don't need to do these, as we have done this with Docker bindings
-# COPY Gemfile /SAPI/Gemfile
-# COPY Gemfile.lock /SAPI/Gemfile.lock
-RUN gem install bundler -v 2.5.17
+COPY Gemfile.lock /SAPI/Gemfile.lock
+
+RUN grep -A1 '^BUNDLED WITH$' Gemfile.lock | tail -n1 | tr -d ' ' \
+ | xargs -I _BUNDLER_VERSION_ gem install bundler -v _BUNDLER_VERSION_
+
+# Don't this any more, as we get it with Docker bindings
+RUN rm /SAPI/Gemfile.lock
##
# This happens in the entrypoint
diff --git a/Dockerfile.cap-deploy b/Dockerfile.cap-deploy
index 377c091fc..dab0ef354 100644
--- a/Dockerfile.cap-deploy
+++ b/Dockerfile.cap-deploy
@@ -1,5 +1,5 @@
# Dockerfile
-FROM ruby:3.2.5
+FROM ruby:3.4.9
ENV DEBIAN_FRONTEND=noninteractive
# Rails and SAPI has some additional dependencies, e.g. rake requires a JS
@@ -20,7 +20,7 @@ WORKDIR /SAPI
# https://stackoverflow.com/questions/43612927/how-to-correctly-install-rvm-in-docker
RUN gpg --keyserver keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
RUN curl -sSL https://get.rvm.io | bash -s
-RUN /bin/bash -l -c ". /etc/profile.d/rvm.sh && rvm install 3.2.5"
+RUN /bin/bash -l -c ". /etc/profile.d/rvm.sh && rvm install 3.4.9"
# RVM installed in multi-user mode. However cap assume rvm is installed in single user mode.
# Create a soft link to fake it.
RUN mkdir -p ~/.rvm/bin && ln -s /usr/local/rvm/bin/rvm ~/.rvm/bin/rvm
@@ -29,9 +29,11 @@ COPY Gemfile /SAPI/Gemfile
COPY Gemfile.lock /SAPI/Gemfile.lock
ENV BUNDLE_SILENCE_ROOT_WARNING=1
+
RUN /bin/bash -c "source /etc/profile.d/rvm.sh \
- && gem install bundler:2.5.17 \
- && bundle"
+ && grep -A1 '^BUNDLED WITH$' Gemfile.lock | tail -n1 | tr -d ' ' \
+ | xargs -I _BUNDLER_VERSION_ gem install bundler -v _BUNDLER_VERSION_ \
+ && bundle install"
ENTRYPOINT ["/bin/bash", "-l"]
diff --git a/Gemfile b/Gemfile
index 100a8b7da..38bdd2378 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,9 +1,9 @@
source 'https://rubygems.org'
-ruby '3.2.5'
+ruby '3.4.9'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
-gem 'rails', '7.1.3.4'
+gem 'rails', '8.0.5'
# Configure Cross-Origin resource sharing
gem 'rack-cors'
@@ -14,15 +14,10 @@ gem 'rack-cors'
gem 'puma', '~> 5.0'
# Use SCSS for stylesheets
-# TODO: Can't upgrade sass-rails to 6.0, it raise the following error when running `RAILS_ENV=staging rake assets:precompile`.
-# SassC::SyntaxError: Error: Invalid CSS after "...in-bottom:-3px;": expected "}", was ".margin-bottom:-3px"
-# on line 3712:5063 of stdin
-# >> ction=135,Strength=3)";_margin-bottom:-3px;.margin-bottom:-3px;}/*!Add round
-# gem 'sass-rails', '>= 6'
-gem 'sass-rails', '~> 5.0'
+gem 'sass-rails', '~> 6'
# https://stackoverflow.com/questions/55213868/rails-6-how-to-disable-webpack-and-use-sprockets-instead
-gem 'sprockets', '3.7.2'
+gem 'sprockets', '~> 4'
gem 'sprockets-rails', require: 'sprockets/railtie'
# Use Terser as compressor for JavaScript assets
@@ -34,10 +29,10 @@ gem 'coffee-rails', '~> 5.0'
# gem 'mini_racer', platforms: :ruby
gem 'active_model_serializers', '0.8.4' # Deprecated
-gem "active_storage_validations", "~> 2.0"
+gem 'active_storage_validations', '~> 2.0'
# Use redis for caching
-gem "redis", "~> 4.8"
+gem 'redis', '~> 4.8'
# Use PostgreSQL database
gem 'pg', '~> 1.5', '>= 1.5.4'
@@ -53,6 +48,7 @@ gem 'devise', '~> 4.9', '>= 4.9.3'
gem 'cancancan', '~> 3.5'
gem 'ahoy_matey', '~> 5.0', '>= 5.0.2'
gem 'uuidtools', '~> 2.2' # For Ahoy. (https://github.com/ankane/ahoy/blob/v2.2.1/docs/Ahoy-2-Upgrade.md#activerecordstore)
+gem 'csv', '~> 3.3.5' # no longer a default gem from Ruby 3.4.0 onwards
gem 'wicked', '2.0.0'
@@ -70,7 +66,7 @@ gem 'httparty', '~> 0.21.0'
gem 'kaminari', '~> 1.2', '>= 1.2.2' # TODO: Suggest migrate to pagy gem.
-gem 'acts-as-taggable-on', '~> 10.0' # TODO: refuses to install against Rails 7.2
+gem 'acts-as-taggable-on', '~> 12.0'
gem 'carrierwave', '~> 3.0', '>= 3.0.5'
# PDF
@@ -98,17 +94,22 @@ gem 'bootsnap', '>= 1.4.4', require: false
# To use Jbuilder templates for JSON
# gem 'jbuilder', '~> 2.7'
+gem 'erb', '~> 6.0.2'
+
group :development do
+ ##
# Adds comments at the top of models describing table column
# (replaces annotate)
- gem 'annotaterb', '~> 4.10.2'
+ gem 'annotaterb', '~> 4.22.0'
+ ##
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
- gem 'web-console', '>= 4.1.0'
+ gem 'web-console'
+
# Display performance information such as SQL time and flame graphs for each request in your browser.
# Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md
- gem 'rack-mini-profiler', '~> 2.0'
- gem 'listen', '~> 3.3'
+ gem 'rack-mini-profiler', '~> 4.0.1'
+ gem 'listen', '~> 3.10.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
@@ -145,11 +146,15 @@ group :development do
gem 'bcrypt_pbkdf', '1.1.0'
gem 'ed25519', '1.2.4'
- # @TODO: bring back when ruby updated to > 2.6 # gem 'net-ssh', '7.0.0.beta1' # openssl 3.0 compatibility @see https://stackoverflow.com/q/72068406/1090438
+ ##
+ # Static analysis for security vulnerabilities [https://brakemanscanner.org/]
+ gem 'brakeman', require: false
+
+ gem 'net-ssh', '7.3.2'
end
group :test, :development do
- gem 'rspec-rails', '~> 6.1', '>= 6.1.1'
+ gem 'rspec-rails', '~> 7.1'
gem 'rspec-collection_matchers', '~> 1.2', '>= 1.2.1'
gem 'json_spec', '~> 1.1', '>= 1.1.5'
gem 'database_cleaner', '~> 2.0', '>= 2.0.2'
@@ -161,12 +166,12 @@ end
group :test do
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '>= 3.26'
- gem 'selenium-webdriver', '>= 4.0.0.rc1'
+ gem 'selenium-webdriver', '~> 4.41'
# Easy installation and use of web drivers to run system tests with browsers
gem 'webdrivers'
gem 'rails-controller-testing'
- gem 'factory_bot_rails', '5.2.0'
+ gem 'factory_bot_rails', '~> 6.5.1'
gem 'simplecov', '~> 0.22.0', require: false
gem 'coveralls_reborn', '~> 0.28.0', require: false
end
@@ -174,7 +179,7 @@ end
gem 'geoip', '1.3.5' # TODO: no change logs, no idea if safe to update. Latest version is 1.6.4 @ 2018
gem 'request_store', '~> 1.5', '>= 1.5.1'
-gem 'paper_trail', '15.1.0'
+gem 'paper_trail', '~> 17.0.0'
gem 'dotenv-rails', '2.0.1'
@@ -228,6 +233,4 @@ gem 'handlebars-source', '1.0.12' # TODO: just a wrapwrapper. Any update will ch
#
# It might be possible to fix this if we had an nginx version which supported
# the config: `passenger_preload_bundler on;`
-gem 'base64', '0.1.1'
-
-
+gem 'base64', '0.2.0'
diff --git a/Gemfile.lock b/Gemfile.lock
index d9acef088..d7ea6c3bc 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -2,51 +2,45 @@ GEM
remote: https://rubygems.org/
specs:
Ascii85 (1.0.3)
- actioncable (7.1.3.4)
- actionpack (= 7.1.3.4)
- activesupport (= 7.1.3.4)
+ actioncable (8.0.5)
+ actionpack (= 8.0.5)
+ activesupport (= 8.0.5)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6)
- actionmailbox (7.1.3.4)
- actionpack (= 7.1.3.4)
- activejob (= 7.1.3.4)
- activerecord (= 7.1.3.4)
- activestorage (= 7.1.3.4)
- activesupport (= 7.1.3.4)
- mail (>= 2.7.1)
- net-imap
- net-pop
- net-smtp
- actionmailer (7.1.3.4)
- actionpack (= 7.1.3.4)
- actionview (= 7.1.3.4)
- activejob (= 7.1.3.4)
- activesupport (= 7.1.3.4)
- mail (~> 2.5, >= 2.5.4)
- net-imap
- net-pop
- net-smtp
+ actionmailbox (8.0.5)
+ actionpack (= 8.0.5)
+ activejob (= 8.0.5)
+ activerecord (= 8.0.5)
+ activestorage (= 8.0.5)
+ activesupport (= 8.0.5)
+ mail (>= 2.8.0)
+ actionmailer (8.0.5)
+ actionpack (= 8.0.5)
+ actionview (= 8.0.5)
+ activejob (= 8.0.5)
+ activesupport (= 8.0.5)
+ mail (>= 2.8.0)
rails-dom-testing (~> 2.2)
- actionpack (7.1.3.4)
- actionview (= 7.1.3.4)
- activesupport (= 7.1.3.4)
+ actionpack (8.0.5)
+ actionview (= 8.0.5)
+ activesupport (= 8.0.5)
nokogiri (>= 1.8.5)
- racc
rack (>= 2.2.4)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
- actiontext (7.1.3.4)
- actionpack (= 7.1.3.4)
- activerecord (= 7.1.3.4)
- activestorage (= 7.1.3.4)
- activesupport (= 7.1.3.4)
+ useragent (~> 0.16)
+ actiontext (8.0.5)
+ actionpack (= 8.0.5)
+ activerecord (= 8.0.5)
+ activestorage (= 8.0.5)
+ activesupport (= 8.0.5)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
- actionview (7.1.3.4)
- activesupport (= 7.1.3.4)
+ actionview (8.0.5)
+ activesupport (= 8.0.5)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
@@ -55,67 +49,77 @@ GEM
ember-data-source (>= 1.13, < 3.0)
active_model_serializers (0.8.4)
activemodel (>= 3.0)
- active_storage_validations (2.0.3)
+ active_storage_validations (2.0.4)
activejob (>= 6.1.4)
activemodel (>= 6.1.4)
activestorage (>= 6.1.4)
activesupport (>= 6.1.4)
marcel (>= 1.0.3)
- activejob (7.1.3.4)
- activesupport (= 7.1.3.4)
+ activejob (8.0.5)
+ activesupport (= 8.0.5)
globalid (>= 0.3.6)
- activemodel (7.1.3.4)
- activesupport (= 7.1.3.4)
- activerecord (7.1.3.4)
- activemodel (= 7.1.3.4)
- activesupport (= 7.1.3.4)
+ activemodel (8.0.5)
+ activesupport (= 8.0.5)
+ activerecord (8.0.5)
+ activemodel (= 8.0.5)
+ activesupport (= 8.0.5)
timeout (>= 0.4.0)
- activestorage (7.1.3.4)
- actionpack (= 7.1.3.4)
- activejob (= 7.1.3.4)
- activerecord (= 7.1.3.4)
- activesupport (= 7.1.3.4)
+ activestorage (8.0.5)
+ actionpack (= 8.0.5)
+ activejob (= 8.0.5)
+ activerecord (= 8.0.5)
+ activesupport (= 8.0.5)
marcel (~> 1.0)
- activesupport (7.1.3.4)
+ activesupport (8.0.5)
base64
+ benchmark (>= 0.3)
bigdecimal
- concurrent-ruby (~> 1.0, >= 1.0.2)
+ concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
+ logger (>= 1.4.2)
minitest (>= 5.1)
- mutex_m
- tzinfo (~> 2.0)
- acts-as-taggable-on (10.0.0)
- activerecord (>= 6.1, < 7.2)
- addressable (2.8.7)
- public_suffix (>= 2.0.2, < 7.0)
+ securerandom (>= 0.3)
+ tzinfo (~> 2.0, >= 2.0.5)
+ uri (>= 0.13.1)
+ acts-as-taggable-on (12.0.0)
+ activerecord (>= 7.1, < 8.1)
+ zeitwerk (>= 2.4, < 3.0)
+ addressable (2.9.0)
+ public_suffix (>= 2.0.2, < 8.0)
afm (0.2.2)
- ahoy_matey (5.1.0)
- activesupport (>= 6.1)
+ ahoy_matey (5.5.0)
+ activesupport (>= 7.2)
+ cgi
device_detector (>= 1)
safely_block (>= 0.4)
- airbrussh (1.5.2)
+ airbrussh (1.6.1)
sshkit (>= 1.6.1, != 1.7.0)
- annotaterb (4.10.2)
+ annotaterb (4.22.0)
+ activerecord (>= 6.0.0)
+ activesupport (>= 6.0.0)
appsignal (3.13.1)
rack
- ast (2.4.2)
- aws-eventstream (1.3.0)
- aws-partitions (1.961.0)
- aws-sdk-core (3.201.3)
+ ast (2.4.3)
+ aws-eventstream (1.4.0)
+ aws-partitions (1.1237.0)
+ aws-sdk-core (3.244.0)
aws-eventstream (~> 1, >= 1.3.0)
- aws-partitions (~> 1, >= 1.651.0)
- aws-sigv4 (~> 1.8)
+ aws-partitions (~> 1, >= 1.992.0)
+ aws-sigv4 (~> 1.9)
+ base64
+ bigdecimal
jmespath (~> 1, >= 1.6.1)
- aws-sdk-kms (1.88.0)
- aws-sdk-core (~> 3, >= 3.201.0)
+ logger
+ aws-sdk-kms (1.123.0)
+ aws-sdk-core (~> 3, >= 3.244.0)
aws-sigv4 (~> 1.5)
- aws-sdk-s3 (1.157.0)
- aws-sdk-core (~> 3, >= 3.201.0)
+ aws-sdk-s3 (1.219.0)
+ aws-sdk-core (~> 3, >= 3.244.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
- aws-sigv4 (1.9.1)
+ aws-sigv4 (1.12.1)
aws-eventstream (~> 1, >= 1.0.2)
babel-source (5.8.35)
babel-transpiler (0.7.0)
@@ -124,20 +128,24 @@ GEM
barber (0.12.2)
ember-source (>= 1.0, < 3.1)
execjs (>= 1.2, < 3)
- base64 (0.1.1)
- bcrypt (3.1.20)
+ base64 (0.2.0)
+ bcrypt (3.1.22)
bcrypt_pbkdf (1.1.0)
- bigdecimal (3.1.8)
+ benchmark (0.5.0)
+ bigdecimal (4.1.1)
bindex (0.8.1)
- bootsnap (1.18.3)
+ bootsnap (1.23.0)
msgpack (~> 1.2)
bootstrap-sass (2.3.2.2)
sass (~> 3.2)
+ brakeman (8.0.4)
+ racc
brpoplpush-redis_script (0.1.3)
concurrent-ruby (~> 1.0, >= 1.0.5)
redis (>= 1.0, < 6)
builder (3.3.0)
- byebug (11.1.3)
+ byebug (13.0.0)
+ reline (>= 0.6.0)
cancancan (3.6.1)
capistrano (3.18.0)
airbrussh (>= 1.0.0)
@@ -171,14 +179,15 @@ GEM
rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2)
- carrierwave (3.0.7)
+ carrierwave (3.1.2)
activemodel (>= 6.0.0)
activesupport (>= 6.0.0)
addressable (~> 2.6)
image_processing (~> 1.1)
marcel (~> 1.0.0)
ssrf_filter (~> 1.0)
- chartkick (5.0.7)
+ cgi (0.5.1)
+ chartkick (5.2.1)
chronic_duration (0.10.6)
numerizer (~> 0.1.1)
coffee-rails (5.0.0)
@@ -188,21 +197,22 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.12.2)
- concurrent-ruby (1.3.5)
- connection_pool (2.5.0)
+ concurrent-ruby (1.3.6)
+ connection_pool (2.5.5)
coveralls_reborn (0.28.0)
simplecov (~> 0.22.0)
term-ansicolor (~> 1.7)
thor (~> 1.2)
tins (~> 1.32)
crass (1.0.6)
- database_cleaner (2.0.2)
+ csv (3.3.5)
+ database_cleaner (2.1.0)
database_cleaner-active_record (>= 2, < 3)
- database_cleaner-active_record (2.2.0)
+ database_cleaner-active_record (2.2.2)
activerecord (>= 5.a)
- database_cleaner-core (~> 2.0.0)
+ database_cleaner-core (~> 2.0)
database_cleaner-core (2.0.1)
- date (3.4.1)
+ date (3.5.1)
device_detector (1.1.3)
devise (4.9.4)
bcrypt (~> 3.0)
@@ -210,12 +220,12 @@ GEM
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
- diff-lcs (1.5.1)
+ diff-lcs (1.6.2)
docile (1.4.1)
dotenv (2.0.1)
dotenv-rails (2.0.1)
dotenv (= 2.0.1)
- drb (2.2.1)
+ drb (2.2.3)
ed25519 (1.2.4)
ember-cli-assets (0.0.37)
ember-data-source (1.13.0)
@@ -238,59 +248,62 @@ GEM
railties (>= 4.2)
ember-source (1.8.0)
handlebars-source (~> 1.0)
- erubi (1.13.0)
- et-orbi (1.2.11)
+ erb (6.0.2)
+ erubi (1.13.1)
+ et-orbi (1.4.0)
tzinfo
- execjs (2.9.1)
- factory_bot (5.2.0)
- activesupport (>= 4.2.0)
- factory_bot_rails (5.2.0)
- factory_bot (~> 5.2.0)
- railties (>= 4.2.0)
- ffi (1.17.0)
+ execjs (2.10.1)
+ factory_bot (6.5.6)
+ activesupport (>= 6.1.0)
+ factory_bot_rails (6.5.1)
+ factory_bot (~> 6.5)
+ railties (>= 6.1.0)
+ ffi (1.17.4-x86_64-linux-gnu)
file_exists (0.2.0)
- fugit (1.11.0)
- et-orbi (~> 1, >= 1.2.11)
+ fugit (1.12.1)
+ et-orbi (~> 1.4)
raabro (~> 1.4)
geoip (1.3.5)
- globalid (1.2.1)
+ globalid (1.3.0)
activesupport (>= 6.1)
- gon (6.4.0)
+ gon (6.6.0)
actionpack (>= 3.0.20)
i18n (>= 0.7)
multi_json
request_store (>= 1.0)
- groupdate (6.4.0)
- activesupport (>= 6.1)
+ groupdate (6.8.0)
+ activesupport (>= 7.2)
handlebars-source (1.0.12)
- has_scope (0.8.2)
- actionpack (>= 5.2)
- activesupport (>= 5.2)
+ has_scope (0.9.0)
+ actionpack (>= 7.0)
+ activesupport (>= 7.0)
hashery (2.1.2)
httparty (0.21.0)
mini_mime (>= 1.0.0)
multi_xml (>= 0.5.2)
- i18n (1.14.5)
+ i18n (1.14.8)
concurrent-ruby (~> 1.0)
- image_processing (1.13.0)
- mini_magick (>= 4.9.5, < 5)
+ image_processing (1.14.0)
+ mini_magick (>= 4.9.5, < 6)
ruby-vips (>= 2.0.17, < 3)
inherited_resources (1.14.0)
actionpack (>= 6.0)
has_scope (>= 0.6)
railties (>= 6.0)
responders (>= 2)
- io-console (0.7.2)
- irb (1.14.0)
+ io-console (0.8.2)
+ irb (1.17.0)
+ pp (>= 0.6.0)
+ prism (>= 1.3.0)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
jmespath (1.6.2)
- jquery-rails (4.6.0)
+ jquery-rails (4.6.1)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
jslint_on_rails (1.1.1)
- json (2.7.2)
+ json (2.19.3)
json_spec (1.1.5)
multi_json (~> 1.0)
rspec (>= 2.0, < 4.0)
@@ -306,65 +319,74 @@ GEM
activerecord
kaminari-core (= 1.2.2)
kaminari-core (1.2.2)
- language_server-protocol (3.17.0.3)
+ language_server-protocol (3.17.0.5)
launchy (2.4.3)
addressable (~> 2.3)
- listen (3.9.0)
+ lint_roller (1.1.0)
+ listen (3.10.0)
+ logger
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
- logger (1.6.0)
- loofah (2.24.0)
+ logger (1.7.0)
+ loofah (2.25.1)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
- mail (2.8.1)
+ mail (2.9.0)
+ logger
mini_mime (>= 0.1.1)
net-imap
net-pop
net-smtp
marcel (1.0.4)
- matrix (0.4.2)
- mini_magick (4.13.2)
+ matrix (0.4.3)
+ mini_magick (5.3.1)
+ logger
mini_mime (1.1.5)
- mini_portile2 (2.8.8)
- minitest (5.24.1)
- mobility (1.2.9)
+ mini_portile2 (2.8.9)
+ minitest (6.0.3)
+ drb (~> 2.0)
+ prism (~> 1.5)
+ mize (0.6.1)
+ mobility (1.3.2)
i18n (>= 0.6.10, < 2)
request_store (~> 1.0)
- msgpack (1.7.2)
- multi_json (1.15.0)
- multi_xml (0.6.0)
- mutex_m (0.2.0)
+ msgpack (1.8.0)
+ multi_json (1.19.1)
+ multi_xml (0.8.1)
+ bigdecimal (>= 3.1, < 5)
nested-hstore (0.1.2)
activerecord
activesupport
nested_form (0.3.2)
- net-imap (0.4.20)
+ net-imap (0.6.3)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.2)
timeout
- net-scp (4.0.0)
+ net-scp (4.1.0)
net-ssh (>= 2.6.5, < 8.0.0)
net-sftp (4.0.0)
net-ssh (>= 5.0.0, < 8.0.0)
- net-smtp (0.5.0)
+ net-smtp (0.5.1)
net-protocol
- net-ssh (7.2.3)
- nio4r (2.7.3)
- nokogiri (1.18.8)
+ net-ssh (7.3.2)
+ nio4r (2.7.5)
+ nokogiri (1.19.2)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
numerizer (0.1.1)
- oj (3.16.4)
+ oj (3.16.16)
bigdecimal (>= 3.0)
+ ostruct (>= 0.2)
orm_adapter (0.5.0)
- paper_trail (15.1.0)
- activerecord (>= 6.1)
+ ostruct (0.6.3)
+ paper_trail (17.0.0)
+ activerecord (>= 7.1)
request_store (~> 1.4)
- parallel (1.25.1)
- parser (3.3.4.0)
+ parallel (2.0.0)
+ parser (3.3.11.1)
ast (~> 2.4.1)
racc
pdf-reader (1.4.1)
@@ -374,69 +396,75 @@ GEM
ruby-rc4
ttfunk
pdfkit (0.8.7.3)
- pg (1.5.7)
+ pg (1.6.3-x86_64-linux)
pg_array_parser (0.0.9)
- pg_search (2.3.6)
- activerecord (>= 5.2)
- activesupport (>= 5.2)
+ pg_search (2.3.7)
+ activerecord (>= 6.1)
+ activesupport (>= 6.1)
+ pp (0.6.3)
+ prettyprint
prawn (0.13.2)
pdf-reader (~> 1.2)
ruby-rc4
ttfunk (~> 1.0.3)
- psych (5.1.2)
+ prettyprint (0.2.0)
+ prism (1.9.0)
+ psych (5.3.1)
+ date
stringio
- public_suffix (6.0.1)
- puma (5.6.8)
+ public_suffix (7.0.5)
+ puma (5.6.9)
nio4r (~> 2.0)
raabro (1.4.0)
racc (1.8.1)
- rack (2.2.14)
+ rack (2.2.23)
rack-cors (2.0.2)
rack (>= 2.0.0)
- rack-mini-profiler (2.3.4)
+ rack-mini-profiler (4.0.1)
rack (>= 1.2.0)
rack-session (1.0.2)
rack (< 3)
- rack-test (2.1.0)
+ rack-test (2.2.0)
rack (>= 1.3)
- rackup (1.0.0)
+ rackup (1.0.1)
rack (< 3)
webrick
- rails (7.1.3.4)
- actioncable (= 7.1.3.4)
- actionmailbox (= 7.1.3.4)
- actionmailer (= 7.1.3.4)
- actionpack (= 7.1.3.4)
- actiontext (= 7.1.3.4)
- actionview (= 7.1.3.4)
- activejob (= 7.1.3.4)
- activemodel (= 7.1.3.4)
- activerecord (= 7.1.3.4)
- activestorage (= 7.1.3.4)
- activesupport (= 7.1.3.4)
+ rails (8.0.5)
+ actioncable (= 8.0.5)
+ actionmailbox (= 8.0.5)
+ actionmailer (= 8.0.5)
+ actionpack (= 8.0.5)
+ actiontext (= 8.0.5)
+ actionview (= 8.0.5)
+ activejob (= 8.0.5)
+ activemodel (= 8.0.5)
+ activerecord (= 8.0.5)
+ activestorage (= 8.0.5)
+ activesupport (= 8.0.5)
bundler (>= 1.15.0)
- railties (= 7.1.3.4)
+ railties (= 8.0.5)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
activesupport (>= 5.0.1.rc1)
- rails-dom-testing (2.2.0)
+ rails-dom-testing (2.3.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
- rails-html-sanitizer (1.6.1)
- loofah (~> 2.21)
+ rails-html-sanitizer (1.7.0)
+ loofah (~> 2.25)
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
- railties (7.1.3.4)
- actionpack (= 7.1.3.4)
- activesupport (= 7.1.3.4)
- irb
+ railties (8.0.5)
+ actionpack (= 8.0.5)
+ activesupport (= 8.0.5)
+ irb (~> 1.13)
rackup (>= 1.0.0)
rake (>= 12.2)
thor (~> 1.0, >= 1.2.2)
+ tsort (>= 0.2)
zeitwerk (~> 2.6)
rainbow (3.1.1)
- rake (13.2.1)
+ rake (13.3.1)
rb-fsevent (0.11.2)
rb-inotify (0.11.1)
ffi (~> 1.0)
@@ -444,96 +472,110 @@ GEM
ffi
rbnacl-libsodium (1.0.16)
rbnacl (>= 3.0.1)
- rdoc (6.7.0)
+ rdoc (7.2.0)
+ erb
psych (>= 4.0.0)
+ tsort
+ readline (0.0.4)
+ reline
redis (4.8.1)
- regexp_parser (2.9.2)
- reline (0.5.9)
+ regexp_parser (2.12.0)
+ reline (0.6.3)
io-console (~> 0.5)
request_store (1.7.0)
rack (>= 1.4)
- responders (3.1.1)
- actionpack (>= 5.2)
- railties (>= 5.2)
- rexml (3.3.9)
- rspec (3.13.0)
+ responders (3.2.0)
+ actionpack (>= 7.0)
+ railties (>= 7.0)
+ rexml (3.4.4)
+ rspec (3.13.2)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-collection_matchers (1.2.1)
rspec-expectations (>= 2.99.0.beta1)
- rspec-core (3.13.0)
+ rspec-core (3.13.6)
rspec-support (~> 3.13.0)
- rspec-expectations (3.13.1)
+ rspec-expectations (3.13.5)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
- rspec-mocks (3.13.1)
+ rspec-mocks (3.13.8)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
- rspec-rails (6.1.3)
- actionpack (>= 6.1)
- activesupport (>= 6.1)
- railties (>= 6.1)
+ rspec-rails (7.1.1)
+ actionpack (>= 7.0)
+ activesupport (>= 7.0)
+ railties (>= 7.0)
rspec-core (~> 3.13)
rspec-expectations (~> 3.13)
rspec-mocks (~> 3.13)
rspec-support (~> 3.13)
- rspec-support (3.13.1)
- rubocop (1.65.1)
+ rspec-support (3.13.7)
+ rubocop (1.86.1)
json (~> 2.3)
- language_server-protocol (>= 3.17.0)
- parallel (~> 1.10)
+ language_server-protocol (~> 3.17.0.2)
+ lint_roller (~> 1.1.0)
+ parallel (>= 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
- regexp_parser (>= 2.4, < 3.0)
- rexml (>= 3.2.5, < 4.0)
- rubocop-ast (>= 1.31.1, < 2.0)
+ regexp_parser (>= 2.9.3, < 3.0)
+ rubocop-ast (>= 1.49.0, < 2.0)
ruby-progressbar (~> 1.7)
- unicode-display_width (>= 2.4.0, < 3.0)
- rubocop-ast (1.31.3)
- parser (>= 3.3.1.0)
- rubocop-capybara (2.21.0)
- rubocop (~> 1.41)
- rubocop-factory_bot (2.26.1)
- rubocop (~> 1.61)
- rubocop-minitest (0.35.1)
- rubocop (>= 1.61, < 2.0)
- rubocop-ast (>= 1.31.1, < 2.0)
- rubocop-performance (1.21.1)
- rubocop (>= 1.48.1, < 2.0)
- rubocop-ast (>= 1.31.1, < 2.0)
- rubocop-rails (2.25.1)
+ unicode-display_width (>= 2.4.0, < 4.0)
+ rubocop-ast (1.49.1)
+ parser (>= 3.3.7.2)
+ prism (~> 1.7)
+ rubocop-capybara (2.22.1)
+ lint_roller (~> 1.1)
+ rubocop (~> 1.72, >= 1.72.1)
+ rubocop-factory_bot (2.28.0)
+ lint_roller (~> 1.1)
+ rubocop (~> 1.72, >= 1.72.1)
+ rubocop-performance (1.26.1)
+ lint_roller (~> 1.1)
+ rubocop (>= 1.75.0, < 2.0)
+ rubocop-ast (>= 1.47.1, < 2.0)
+ rubocop-rails (2.34.3)
activesupport (>= 4.2.0)
+ lint_roller (~> 1.1)
rack (>= 1.1)
- rubocop (>= 1.33.0, < 2.0)
- rubocop-ast (>= 1.31.1, < 2.0)
- rubocop-rails-omakase (1.0.0)
- rubocop
- rubocop-minitest
- rubocop-performance
- rubocop-rails
- rubocop-rspec (3.0.3)
- rubocop (~> 1.61)
- rubocop-rspec_rails (2.30.0)
- rubocop (~> 1.61)
- rubocop-rspec (~> 3, >= 3.0.1)
+ rubocop (>= 1.75.0, < 2.0)
+ rubocop-ast (>= 1.44.0, < 2.0)
+ rubocop-rails-omakase (1.1.0)
+ rubocop (>= 1.72)
+ rubocop-performance (>= 1.24)
+ rubocop-rails (>= 2.30)
+ rubocop-rspec (3.9.0)
+ lint_roller (~> 1.1)
+ rubocop (~> 1.81)
+ rubocop-rspec_rails (2.32.0)
+ lint_roller (~> 1.1)
+ rubocop (~> 1.72, >= 1.72.1)
+ rubocop-rspec (~> 3.5)
ruby-progressbar (1.13.0)
ruby-rc4 (0.1.5)
- ruby-vips (2.2.2)
+ ruby-vips (2.3.0)
ffi (~> 1.12)
logger
- rubyzip (2.3.2)
- safely_block (0.4.0)
+ rubyzip (2.4.1)
+ safely_block (1.0.0)
sass (3.4.25)
- sass-rails (5.1.0)
- railties (>= 5.2.0)
- sass (~> 3.1)
- sprockets (>= 2.8, < 4.0)
- sprockets-rails (>= 2.0, < 4.0)
- tilt (>= 1.1, < 3)
- selenium-webdriver (4.16.0)
+ sass-rails (6.0.0)
+ sassc-rails (~> 2.1, >= 2.1.1)
+ sassc (2.4.0)
+ ffi (~> 1.9)
+ sassc-rails (2.1.2)
+ railties (>= 4.0.0)
+ sassc (>= 2.0)
+ sprockets (> 3.0)
+ sprockets-rails
+ tilt
+ securerandom (0.4.1)
+ selenium-webdriver (4.42.0)
+ base64 (~> 0.2)
+ logger (~> 1.4)
rexml (~> 3.2, >= 3.2.5)
- rubyzip (>= 1.2.2, < 3.0)
+ rubyzip (>= 1.2.2, < 4.0)
websocket (~> 1.0)
sidekiq (6.5.12)
connection_pool (>= 2.2.5, < 3)
@@ -556,86 +598,96 @@ GEM
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
- simplecov-html (0.12.3)
+ simplecov-html (0.13.2)
simplecov_json_formatter (0.1.4)
sitemap_generator (6.3.0)
builder (~> 3.0)
slackistrano (0.1.9)
capistrano (>= 3.0.1)
json
- spring (4.2.1)
- sprockets (3.7.2)
+ spring (4.4.2)
+ sprockets (4.0.3)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.5.2)
actionpack (>= 6.1)
activesupport (>= 6.1)
sprockets (>= 3.0.0)
- sshkit (1.23.0)
+ sshkit (1.25.0)
base64
+ logger
net-scp (>= 1.1.2)
net-sftp (>= 2.1.2)
net-ssh (>= 2.8.0)
- ssrf_filter (1.1.2)
- stringio (3.1.1)
+ ostruct
+ ssrf_filter (1.5.0)
+ stringio (3.2.0)
strong_migrations (1.8.0)
activerecord (>= 5.2)
susy (2.2.14)
sass (>= 3.3.0, < 3.5)
sync (0.5.0)
- term-ansicolor (1.11.1)
- tins (~> 1.0)
- terser (1.2.3)
+ term-ansicolor (1.11.3)
+ tins (~> 1)
+ terser (1.2.7)
execjs (>= 0.3.0, < 3)
- thor (1.3.2)
- tilt (2.4.0)
- timeout (0.4.3)
- tins (1.33.0)
+ thor (1.5.0)
+ tilt (2.7.0)
+ timeout (0.6.1)
+ tins (1.52.0)
bigdecimal
+ mize (~> 0.6)
+ readline
sync
+ tsort (0.2.0)
ttfunk (1.0.3)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
- unicode-display_width (2.5.0)
+ unicode-display_width (3.2.0)
+ unicode-emoji (~> 4.1)
+ unicode-emoji (4.2.0)
+ uri (1.1.1)
+ useragent (0.16.11)
uuidtools (2.2.0)
warden (1.2.9)
rack (>= 2.0.9)
- web-console (4.2.1)
- actionview (>= 6.0.0)
- activemodel (>= 6.0.0)
+ web-console (4.3.0)
+ actionview (>= 8.0.0)
bindex (>= 0.4.0)
- railties (>= 6.0.0)
+ railties (>= 8.0.0)
webdrivers (5.2.0)
nokogiri (~> 1.6)
rubyzip (>= 1.3.0)
selenium-webdriver (~> 4.0)
- webrick (1.8.2)
+ webrick (1.9.2)
websocket (1.2.11)
- websocket-driver (0.7.6)
+ websocket-driver (0.8.0)
+ base64
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
wicked (2.0.0)
railties (>= 3.0.7)
- wkhtmltopdf-binary (0.12.6.7)
+ wkhtmltopdf-binary (0.12.6.10)
xpath (3.2.0)
nokogiri (~> 1.8)
- zeitwerk (2.6.17)
+ zeitwerk (2.7.5)
PLATFORMS
- ruby
+ x86_64-linux-gnu
DEPENDENCIES
active_model_serializers (= 0.8.4)
active_storage_validations (~> 2.0)
- acts-as-taggable-on (~> 10.0)
+ acts-as-taggable-on (~> 12.0)
ahoy_matey (~> 5.0, >= 5.0.2)
- annotaterb (~> 4.10.2)
+ annotaterb (~> 4.22.0)
appsignal (~> 3.13.1)
aws-sdk-s3 (~> 1.143)
- base64 (= 0.1.1)
+ base64 (= 0.2.0)
bcrypt_pbkdf (= 1.1.0)
bootsnap (>= 1.4.4)
bootstrap-sass (= 2.3.2.2)
+ brakeman
byebug
cancancan (~> 3.5)
capistrano (= 3.18.0)
@@ -651,6 +703,7 @@ DEPENDENCIES
chartkick (~> 5.0, >= 5.0.5)
coffee-rails (~> 5.0)
coveralls_reborn (~> 0.28.0)
+ csv (~> 3.3.5)
database_cleaner (~> 2.0, >= 2.0.2)
devise (~> 4.9, >= 4.9.3)
dotenv-rails (= 2.0.1)
@@ -658,7 +711,8 @@ DEPENDENCIES
ember-data-source (= 1.13.0)
ember-rails (~> 0.21.0)
ember-source (= 1.8.0)
- factory_bot_rails (= 5.2.0)
+ erb (~> 6.0.2)
+ factory_bot_rails (~> 6.5.1)
file_exists (~> 0.2.0)
geoip (= 1.3.5)
gon (~> 6.4)
@@ -670,13 +724,14 @@ DEPENDENCIES
json_spec (~> 1.1, >= 1.1.5)
kaminari (~> 1.2, >= 1.2.2)
launchy (= 2.4.3)
- listen (~> 3.3)
+ listen (~> 3.10.0)
mobility (~> 1.2, >= 1.2.9)
nested-hstore (~> 0.1.2)
nested_form (~> 0.3.2)
+ net-ssh (= 7.3.2)
nokogiri (~> 1.18)
oj (~> 3.16, >= 3.16.3)
- paper_trail (= 15.1.0)
+ paper_trail (~> 17.0.0)
pdfkit (~> 0.8.7.3)
pg (~> 1.5, >= 1.5.4)
pg_array_parser (~> 0.0.9)
@@ -684,8 +739,8 @@ DEPENDENCIES
prawn (= 0.13.2)
puma (~> 5.0)
rack-cors
- rack-mini-profiler (~> 2.0)
- rails (= 7.1.3.4)
+ rack-mini-profiler (~> 4.0.1)
+ rails (= 8.0.5)
rails-controller-testing
rbnacl (= 4.0.2)
rbnacl-libsodium (= 1.0.16)
@@ -693,7 +748,7 @@ DEPENDENCIES
request_store (~> 1.5, >= 1.5.1)
responders (~> 3.1, >= 3.1.1)
rspec-collection_matchers (~> 1.2, >= 1.2.1)
- rspec-rails (~> 6.1, >= 6.1.1)
+ rspec-rails (~> 7.1)
rubocop
rubocop-capybara
rubocop-factory_bot
@@ -702,8 +757,8 @@ DEPENDENCIES
rubocop-rspec
rubocop-rspec_rails
rubyzip (~> 2.3, >= 2.3.2)
- sass-rails (~> 5.0)
- selenium-webdriver (>= 4.0.0.rc1)
+ sass-rails (~> 6)
+ selenium-webdriver (~> 4.41)
sidekiq (< 7)
sidekiq-cron (~> 1.12)
sidekiq-status (~> 3.0, >= 3.0.3)
@@ -712,19 +767,19 @@ DEPENDENCIES
sitemap_generator (~> 6.3)
slackistrano (= 0.1.9)
spring
- sprockets (= 3.7.2)
+ sprockets (~> 4)
sprockets-rails
strong_migrations (~> 1.7)
susy (~> 2.2, >= 2.2.14)
terser (~> 1.2.3)
uuidtools (~> 2.2)
- web-console (>= 4.1.0)
+ web-console
webdrivers
wicked (= 2.0.0)
wkhtmltopdf-binary (~> 0.12.6.6)
RUBY VERSION
- ruby 3.2.5p208
+ ruby 3.4.9p82
BUNDLED WITH
- 2.5.17
+ 4.0.10
diff --git a/app/assets/config/mainfest.js b/app/assets/config/manifest.js
similarity index 100%
rename from app/assets/config/mainfest.js
rename to app/assets/config/manifest.js
diff --git a/app/assets/javascripts/species/controllers/taxon_concept_controller.js.coffee b/app/assets/javascripts/species/controllers/taxon_concept_controller.js.coffee
index c36238569..496512aec 100644
--- a/app/assets/javascripts/species/controllers/taxon_concept_controller.js.coffee
+++ b/app/assets/javascripts/species/controllers/taxon_concept_controller.js.coffee
@@ -255,10 +255,6 @@ Species.TaxonConceptController = Ember.ObjectController.extend Species.SearchCon
if @get('nomenclatureNoteEn') == null || @get('nomenclatureNoteEn').length <= 0 then no else yes
).property('nomenclatureNoteEn')
- nomenclatureChangesHappened: ( ->
- @get('nomenclatureNotification')
- ).property('nomenclatureNotification')
-
actions:
openSearchPage: (taxonFullName) ->
@get("controllers.search").openSearchPage taxonFullName
diff --git a/app/assets/javascripts/species/models/taxon_concept.js.coffee b/app/assets/javascripts/species/models/taxon_concept.js.coffee
index 4fe14a219..7af123bfb 100644
--- a/app/assets/javascripts/species/models/taxon_concept.js.coffee
+++ b/app/assets/javascripts/species/models/taxon_concept.js.coffee
@@ -31,7 +31,6 @@ Species.TaxonConcept = DS.Model.extend
nomenclatureNoteEn: DS.attr("string")
nomenclatureNoteFr: DS.attr("string")
nomenclatureNoteEs: DS.attr("string")
- nomenclatureNotification: DS.attr("boolean")
matchingNamesForDisplay: ( ->
if @get('matchingNames') != undefined && @get('matchingNames').length > 0
diff --git a/app/assets/javascripts/species/templates/_tabs.handlebars b/app/assets/javascripts/species/templates/_tabs.handlebars
index dd6fa8448..c2332c334 100644
--- a/app/assets/javascripts/species/templates/_tabs.handlebars
+++ b/app/assets/javascripts/species/templates/_tabs.handlebars
@@ -1,12 +1,3 @@
-{{#if nomenclatureChangesHappened}}
-
-
-
- Changes to nomenclature have been made following changes adopted at the Seventeenth meeting of the Conference of the Parties to CITES
-
-
-{{/if}}
-
-
{{#link-to 'index'}}Search for Species{{/link-to}}
diff --git a/app/assets/stylesheets/mobile/mobile.scss b/app/assets/stylesheets/mobile/mobile.scss
index b4a7ddb10..efff1051d 100644
--- a/app/assets/stylesheets/mobile/mobile.scss
+++ b/app/assets/stylesheets/mobile/mobile.scss
@@ -1,6 +1,4 @@
// Settings (mobile-first)
-@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700&display=swap');
-
$navy: #253848;
$black: #2D2D2D;
$medium-grey: #dddddd;
diff --git a/app/assets/stylesheets/species/all.scss b/app/assets/stylesheets/species/all.scss
index b28ec7f5e..a18e844fb 100755
--- a/app/assets/stylesheets/species/all.scss
+++ b/app/assets/stylesheets/species/all.scss
@@ -3,7 +3,6 @@
License: none (public domain)
*/
-@import url(https://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,600,700);
@import './variables';
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
diff --git a/app/assets/stylesheets/species/nomenclature_changes_notification.scss b/app/assets/stylesheets/species/nomenclature_changes_notification.scss
deleted file mode 100644
index 430e00b1a..000000000
--- a/app/assets/stylesheets/species/nomenclature_changes_notification.scss
+++ /dev/null
@@ -1,13 +0,0 @@
-div#nomenclature_banner {
- background: #2D3237;
- margin: 30px 0;
- opacity: 0.8;
-}
-
-div#nomenclature_banner p {
- color: #fff;
- opacity: 1;
- text-align: center;
- margin: 0;
- padding: 10px 40px 10px 25px;
-}
diff --git a/app/channels/application_cable/channel.rb b/app/channels/application_cable/channel.rb
deleted file mode 100644
index d67269728..000000000
--- a/app/channels/application_cable/channel.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-module ApplicationCable
- class Channel < ActionCable::Channel::Base
- end
-end
diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb
deleted file mode 100644
index 0ff5442f4..000000000
--- a/app/channels/application_cable/connection.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-module ApplicationCable
- class Connection < ActionCable::Connection::Base
- end
-end
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 815be2559..dbb08db6e 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -1,4 +1,7 @@
class ApplicationController < ActionController::Base
+ # Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has.
+ allow_browser versions: :modern
+
before_action :track_who_does_it_current_user
before_action :set_locale
before_action :configure_permitted_parameters, if: :devise_controller?
diff --git a/app/models/ahoy/visit.rb b/app/models/ahoy/visit.rb
index 648a62e0e..fb3bfdeca 100644
--- a/app/models/ahoy/visit.rb
+++ b/app/models/ahoy/visit.rb
@@ -48,6 +48,8 @@ class Visit < ApplicationRecord
# (https://github.com/ankane/ahoy/blob/v1.0.1/lib/generators/ahoy/stores/templates/active_record_visits_migration.rb)
# However it has changed since version 1.4.0, from `id` to `visit_token`, and from `visitor_id` to `visitor_token`.
# (https://github.com/ankane/ahoy/blob/v1.4.0/lib/generators/ahoy/stores/templates/active_record_visits_migration.rb)
+ # Note that this will bypass custom methods on the original attribute, which thankfully we don't have:
+ # (https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#alias-attribute-now-bypasses-custom-methods-on-the-original-attribute)
alias_attribute :visit_token, :id
alias_attribute :visitor_token, :visitor_id
end
diff --git a/app/serializers/dashboard_stats_serializer.rb b/app/serializers/dashboard_stats_serializer.rb
index c35a0cfba..19fea08b9 100644
--- a/app/serializers/dashboard_stats_serializer.rb
+++ b/app/serializers/dashboard_stats_serializer.rb
@@ -18,7 +18,7 @@ def meta
end
def cache_key
- key = [
+ [
self.class.name,
@object.geo_entity.id,
@object.kingdom,
@@ -26,7 +26,5 @@ def cache_key
@object.time_range_start,
@object.time_range_end
]
- Rails.logger.debug { "CACHE KEY: #{key.inspect}" }
- key
end
end
diff --git a/app/serializers/species/show_taxon_concept_serializer.rb b/app/serializers/species/show_taxon_concept_serializer.rb
index 83daf20a6..72d17ee7f 100644
--- a/app/serializers/species/show_taxon_concept_serializer.rb
+++ b/app/serializers/species/show_taxon_concept_serializer.rb
@@ -4,7 +4,7 @@ class Species::ShowTaxonConceptSerializer < ActiveModel::Serializer
attributes :id, :parent_id, :full_name, :author_year, :standard_references,
:common_names, :distributions, :subspecies, :distribution_references,
:taxonomy, :kingdom_name, :phylum_name, :order_name, :class_name, :family_name,
- :genus_name, :species_name, :rank_name, :name_status, :nomenclature_note_en, :nomenclature_notification
+ :genus_name, :species_name, :rank_name, :name_status, :nomenclature_note_en
has_many :accepted_names, serializer: Species::AcceptedNameSerializer
has_many :synonyms, serializer: Species::SynonymSerializer
@@ -17,12 +17,6 @@ def include_parent_id?
@options[:trimmed] == 'false'
end
- def include_nomenclature_notification?
- return true unless @options[:trimmed]
-
- @options[:trimmed] == 'false'
- end
-
def include_kingdom_name?
return true unless @options[:trimmed]
@@ -165,7 +159,7 @@ def distribution_references
end
def cache_key
- key = [
+ [
self.class.name,
self.id,
object.updated_at,
@@ -174,20 +168,5 @@ def cache_key
scope.current_user ? true : false,
@options[:trimmed] == 'true'
]
- Rails.logger.debug { "CACHE KEY: #{key.inspect}" }
- key
- end
-
- def nomenclature_notification
- outputs = NomenclatureChange::Output.includes(:nomenclature_change).references(:nomenclature_change).where(
- "
- (taxon_concept_id = ? OR new_taxon_concept_id = ?) AND
- nomenclature_changes.created_at > ? AND nomenclature_changes.status = 'submitted'
- AND nomenclature_changes.created_at < ?
- ",
- object.id, object.id, 6.months.ago, Date.new(2017, 8, 1)
- )
-
- outputs.present?
end
end
diff --git a/app/views/layouts/mobile.html.erb b/app/views/layouts/mobile.html.erb
index f37c2e414..eef38bf48 100644
--- a/app/views/layouts/mobile.html.erb
+++ b/app/views/layouts/mobile.html.erb
@@ -7,6 +7,10 @@
+
+
<%= stylesheet_link_tag "mobile" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
diff --git a/app/views/layouts/species.html.erb b/app/views/layouts/species.html.erb
index 054f63979..10a4f6590 100644
--- a/app/views/layouts/species.html.erb
+++ b/app/views/layouts/species.html.erb
@@ -8,7 +8,11 @@
- <%= stylesheet_link_tag "species" %>
+
+
+ <%= stylesheet_link_tag "species" %>
diff --git a/bin/brakeman b/bin/brakeman
new file mode 100755
index 000000000..ace1c9ba0
--- /dev/null
+++ b/bin/brakeman
@@ -0,0 +1,7 @@
+#!/usr/bin/env ruby
+require "rubygems"
+require "bundler/setup"
+
+ARGV.unshift("--ensure-latest")
+
+load Gem.bin_path("brakeman", "brakeman")
diff --git a/bin/dev b/bin/dev
new file mode 100755
index 000000000..5f91c2054
--- /dev/null
+++ b/bin/dev
@@ -0,0 +1,2 @@
+#!/usr/bin/env ruby
+exec "./bin/rails", "server", *ARGV
diff --git a/bin/docker-entrypoint b/bin/docker-entrypoint
index cd970544f..af841e1eb 100755
--- a/bin/docker-entrypoint
+++ b/bin/docker-entrypoint
@@ -4,6 +4,12 @@ if [[ "${@}" =~ "rails server" ]]; then
rm -f ./tmp/pids/server.pid;
fi
+# Enable jemalloc for reduced memory usage and latency.
+if [ -z "${LD_PRELOAD+x}" ]; then
+ LD_PRELOAD=$(find /usr/lib -name libjemalloc.so.2 -print -quit)
+ export LD_PRELOAD
+fi
+
bundle install
mkdir -p {./,spec/}public/downloads/checklist
@@ -31,7 +37,7 @@ mkdir -p {./,spec/}public/downloads/taxon_concepts_distributions
mkdir -p {./,spec/}public/downloads/taxon_concepts_names
# If running the rails server then create or migrate existing database
-# if [ "${1}" == "./bin/rails" ] && [ "${2}" == "server" ]; then
+# if [ "${@: -2:1}" == "./bin/rails" ] && [ "${@: -1:1}" == "server" ]; then
# ./bin/rails db:prepare
# fi
diff --git a/bin/rubocop b/bin/rubocop
new file mode 100755
index 000000000..40330c0ff
--- /dev/null
+++ b/bin/rubocop
@@ -0,0 +1,8 @@
+#!/usr/bin/env ruby
+require "rubygems"
+require "bundler/setup"
+
+# explicit rubocop config increases performance slightly while avoiding config confusion.
+ARGV.unshift("--config", File.expand_path("../.rubocop.yml", __dir__))
+
+load Gem.bin_path("rubocop", "rubocop")
diff --git a/bin/setup b/bin/setup
index 3cd5a9d78..2311239cd 100755
--- a/bin/setup
+++ b/bin/setup
@@ -3,6 +3,7 @@ require "fileutils"
# path to your application root.
APP_ROOT = File.expand_path("..", __dir__)
+APP_NAME = "sapi"
def system!(*args)
system(*args, exception: true)
@@ -14,7 +15,6 @@ FileUtils.chdir APP_ROOT do
# Add necessary setup steps to this file.
puts "== Installing dependencies =="
- system! "gem install bundler --conservative"
system("bundle check") || system!("bundle install")
# puts "\n== Copying sample files =="
@@ -28,6 +28,9 @@ FileUtils.chdir APP_ROOT do
puts "\n== Removing old logs and tempfiles =="
system! "bin/rails log:clear tmp:clear"
- puts "\n== Restarting application server =="
- system! "bin/rails restart"
+ unless ARGV.include?("--skip-server")
+ puts "\n== Starting development server =="
+ STDOUT.flush # flush the output before exec(2) so that it displays
+ exec "bin/dev"
+ end
end
diff --git a/config/application.rb b/config/application.rb
index d08af56ef..852a14403 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -11,7 +11,7 @@
module SAPI
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
- config.load_defaults 7.1
+ config.load_defaults 8.0
# Since Rails 5, on submit, submission buttons in `form_for` are disabled.
# However, if errors are thrown and the whole form is not rerendered, then
diff --git a/config/deploy.rb b/config/deploy.rb
index ce0f0d011..f0a1295f9 100644
--- a/config/deploy.rb
+++ b/config/deploy.rb
@@ -20,7 +20,7 @@
# set :format, :pretty
set :rvm_type, :user
-set :rvm_ruby_version, '3.2.5'
+set :rvm_ruby_version, '3.4.9'
# Sidekiq config
set :sidekiq_service_unit_user, :system
diff --git a/config/environments/development.rb b/config/environments/development.rb
index f994d2d70..df7e38c40 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -3,9 +3,7 @@
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
- # In the development environment your application's code is reloaded any time
- # it changes. This slows down response time but is perfect for development
- # since you don't have to restart the web server when you make code changes.
+ # Make code changes take effect immediately without server restart.
config.enable_reloading = true
# Do not eager load code on boot.
@@ -40,6 +38,8 @@
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
+ # Disable caching for Action Mailer templates even if Action Controller
+ # caching is enabled.
config.action_mailer.perform_caching = false
# Print deprecation notices to the Rails logger.
@@ -61,12 +61,12 @@
# Lets keep this for now, its development mode only.
config.assets.debug = true
+ # Append comments with runtime information tags to SQL queries in logs.
+ config.active_record.query_log_tags_enabled = true
+
# Highlight code that enqueued background job in logs.
config.active_job.verbose_enqueue_logs = true
- # Suppress logger output for asset requests.
- config.assets.quiet = true
-
# Enable DNS rebinding protection and other `Host` header attacks.
# config.hosts = [
# "example.com", # Allow requests from example.com
@@ -80,12 +80,12 @@
# config.i18n.raise_on_missing_translations = true
# Annotate rendered view with file names.
- # config.action_view.annotate_rendered_view_with_filenames = true
+ config.action_view.annotate_rendered_view_with_filenames = true
# Uncomment if you wish to allow Action Cable access from any origin.
# config.action_cable.disable_request_forgery_protection = true
- # Raise error when a before_action's only/except options reference missing actions
+ # Raise error when a before_action's only/except options reference missing actions.
config.action_controller.raise_on_missing_callback_actions = true
###
diff --git a/config/environments/production.rb b/config/environments/production.rb
index d93986aa5..9c8d37da7 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -6,19 +6,14 @@
# Code is not reloaded between requests.
config.enable_reloading = false
- # Eager load code on boot. This eager loads most of Rails and
- # your application in memory, allowing both threaded web servers
- # and those relying on copy on write to perform better.
- # Rake tasks automatically ignore this option for performance.
+ # Eager load code on boot for better performance and memory savings (ignored by Rake tasks).
config.eager_load = true
- # Full error reports are disabled and caching is turned on.
+ # Full error reports are disabled.
config.consider_all_requests_local = false
- config.action_controller.perform_caching = true
- # Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment
- # key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files).
- # config.require_master_key = true
+ # Turn on fragment caching in view templates
+ config.action_controller.perform_caching = true
# Disable serving static files from `public/`, relying on NGINX/Apache to do so instead.
config.public_file_server.enabled = false
@@ -29,8 +24,10 @@
# Compress CSS using a preprocessor.
# config.assets.css_compressor = :sass
- # Do not fall back to assets pipeline if a precompiled asset is missed.
- config.assets.compile = false
+ # Cache assets for far-future expiry since they are all digest stamped.
+ config.public_file_server.headers = {
+ 'cache-control' => "public, max-age=#{1.year.to_i}"
+ }
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.asset_host = "http://assets.example.com"
@@ -77,14 +74,18 @@
# Prepend all log lines with the following tags.
config.log_tags = [ :request_id ]
- # "info" includes generic and useful information about system operation, but avoids logging too much
- # information to avoid inadvertent exposure of personally identifiable information (PII). If you
- # want to log everything, set the level to "debug".
+ # Change to "debug" to log everything (including potentially personally-identifiable information!)
# config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
# Leonardo: override default behaviour and hard-code warn.
# @see https://github.com/heartcombo/devise#password-reset-tokens-and-rails-logs
config.log_level = 'warn'
+ # Prevent health checks from clogging up the logs.
+ config.silence_healthcheck_path = '/up'
+
+ # Don't log any deprecations.
+ config.active_support.report_deprecations = false
+
# Use a redis instance as a cache store on production.
config.cache_store = :redis_cache_store, { url: ENV.fetch('SAPI_SIDEKIQ_REDIS_CACHE_URL', Rails.application.credentials.dig(:redis_cache, :url)) }
@@ -103,9 +104,6 @@
# config.i18n.fallbacks = true
config.i18n.fallbacks = false
- # Don't log any deprecations.
- config.active_support.report_deprecations = false
-
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
@@ -114,6 +112,7 @@
# "example.com", # Allow requests from example.com
# /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
# ]
+ #
# Skip DNS rebinding protection for the default health check endpoint.
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
config.hosts += ENV['ALLOWED_HOSTS'].split(',') if ENV['ALLOWED_HOSTS'].present?
diff --git a/config/environments/test.rb b/config/environments/test.rb
index 0ecd0a654..3d9eb940e 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -1,5 +1,3 @@
-require 'active_support/core_ext/integer/time'
-
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
@@ -29,6 +27,9 @@
config.action_controller.perform_caching = false
config.cache_store = :null_store
+ # https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#all-tests-now-respect-the-active-job-queue-adapter-config
+ config.active_job.queue_adapter = :test
+
# Render exception templates for rescuable exceptions and raise for other exceptions.
config.action_dispatch.show_exceptions = :rescuable
@@ -38,6 +39,8 @@
# Store uploaded files on the local file system in a temporary directory.
config.active_storage.service = :test
+ # Disable caching for Action Mailer templates even if Action Controller
+ # caching is enabled.
config.action_mailer.perform_caching = false
# Tell Action Mailer not to deliver emails to the real world.
@@ -60,7 +63,7 @@
# Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = true
- # Raise error when a before_action's only/except options reference missing actions
+ # Raise error when a before_action's only/except options reference missing actions.
config.action_controller.raise_on_missing_callback_actions = true
###
diff --git a/config/initializers/cors.rb b/config/initializers/cors.rb
index ab670b5e6..0c5dd99ac 100644
--- a/config/initializers/cors.rb
+++ b/config/initializers/cors.rb
@@ -1,14 +1,16 @@
-Rails.application.config.middleware.insert_before 0, Rack::Cors do
- allow do
- app_cors_origins =
- Rails.application.credentials.dig(
- :cors, :origins
- ) || []
+# Be sure to restart your server when you modify this file.
- origins app_cors_origins&.map(&:strip)
+# Avoid CORS issues when API is called from the frontend app.
+# Handle Cross-Origin Resource Sharing (CORS) in order to accept cross-origin Ajax requests.
- resource '*', headers: :any, methods: [
- :get, :post, :patch, :put, :delete
- ]
- end
-end
+# Read more: https://github.com/cyu/rack-cors
+
+# Rails.application.config.middleware.insert_before 0, Rack::Cors do
+# allow do
+# origins "example.com"
+#
+# resource "*",
+# headers: :any,
+# methods: [:get, :post, :put, :patch, :delete, :options, :head]
+# end
+# end
diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb
index c2d89e28a..c0b717f7e 100644
--- a/config/initializers/filter_parameter_logging.rb
+++ b/config/initializers/filter_parameter_logging.rb
@@ -4,5 +4,5 @@
# Use this to limit dissemination of sensitive information.
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
Rails.application.config.filter_parameters += [
- :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
+ :passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc
]
diff --git a/config/puma.rb b/config/puma.rb
index 58e1c205b..a248513b2 100644
--- a/config/puma.rb
+++ b/config/puma.rb
@@ -1,35 +1,41 @@
# This configuration file will be evaluated by Puma. The top-level methods that
# are invoked here are part of Puma's configuration DSL. For more information
# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
-
-# Puma can serve each request in a thread from an internal thread pool.
-# The `threads` method setting takes two numbers: a minimum and maximum.
-# Any libraries that use thread pools should be configured to match
-# the maximum value specified for Puma. Default is set to 5 threads for minimum
-# and maximum; this matches the default thread size of Active Record.
-max_threads_count = ENV.fetch('RAILS_MAX_THREADS') { 5 }
-min_threads_count = ENV.fetch('RAILS_MIN_THREADS') { max_threads_count }
-threads min_threads_count, max_threads_count
-
-# Specifies that the worker count should equal the number of processors in production.
-if ENV['RAILS_ENV'] == 'production'
- require 'concurrent-ruby'
- worker_count = Integer(ENV.fetch('WEB_CONCURRENCY') { Concurrent.physical_processor_count })
- workers worker_count if worker_count > 1
-end
-
-# Specifies the `worker_timeout` threshold that Puma will use to wait before
-# terminating a worker in development environments.
-worker_timeout 3600 if ENV.fetch('RAILS_ENV', 'development') == 'development'
+#
+# Puma starts a configurable number of processes (workers) and each process
+# serves each request in a thread from an internal thread pool.
+#
+# You can control the number of workers using ENV["WEB_CONCURRENCY"]. You
+# should only set this value when you want to run 2 or more workers. The
+# default is already 1.
+#
+# The ideal number of threads per worker depends both on how much time the
+# application spends waiting for IO operations and on how much you wish to
+# prioritize throughput over latency.
+#
+# As a rule of thumb, increasing the number of threads will increase how much
+# traffic a given process can handle (throughput), but due to CRuby's
+# Global VM Lock (GVL) it has diminishing returns and will degrade the
+# response time (latency) of the application.
+#
+# The default is set to 3 threads as it's deemed a decent compromise between
+# throughput and latency for the average Rails application.
+#
+# Any libraries that use a connection pool or another resource pool should
+# be configured to provide at least as many connections as the number of
+# threads. This includes Active Record's `pool` parameter in `database.yml`.
+threads_count = ENV.fetch("RAILS_MAX_THREADS", 3)
+threads threads_count, threads_count
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
-port ENV.fetch('PORT') { 3000 }
+port ENV.fetch("PORT", 3000)
-# Specifies the `environment` that Puma will run in.
-environment ENV.fetch('RAILS_ENV') { 'development' }
+# Allow puma to be restarted by `bin/rails restart` command.
+plugin :tmp_restart
-# Specifies the `pidfile` that Puma will use.
-pidfile ENV.fetch('PIDFILE') { 'tmp/pids/server.pid' }
+# Run the Solid Queue supervisor inside of Puma for single-server deployments
+plugin :solid_queue if ENV["SOLID_QUEUE_IN_PUMA"]
-# Allow puma to be restarted by `rails restart` command.
-plugin :tmp_restart
+# Specify the PID file. Defaults to tmp/pids/server.pid in development.
+# In other environments, only set the PID file if requested.
+pidfile ENV["PIDFILE"] if ENV["PIDFILE"]
diff --git a/public/400.html b/public/400.html
new file mode 100644
index 000000000..282dbc8cc
--- /dev/null
+++ b/public/400.html
@@ -0,0 +1,114 @@
+
+
+
+
+
+
+ The server cannot process the request due to a client error (400 Bad Request)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
The server cannot process the request due to a client error. Please check the request and try again. If you’re the application owner check the logs for more information.
+
+
+
+
+
+
diff --git a/public/404.html b/public/404.html
index f028a6e83..c0670bc87 100644
--- a/public/404.html
+++ b/public/404.html
@@ -1,69 +1,114 @@
-
-
-
-
- The page you were looking for doesn't exist (404)
-
-
-
-
-
-
-
-
-
The page you were looking for doesn't exist.
-
You may have mistyped the address or the page may have moved.
-
-
If you are the application owner check the logs for more information.
-
-
+
+
+
+
+
+
+ The page you were looking for doesn’t exist (404 Not found)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The page you were looking for doesn’t exist. You may have mistyped the address or the page may have moved. If you’re the application owner check the logs for more information.
+
+
+
+
diff --git a/public/406-unsupported-browser.html b/public/406-unsupported-browser.html
new file mode 100644
index 000000000..9532a9ccd
--- /dev/null
+++ b/public/406-unsupported-browser.html
@@ -0,0 +1,114 @@
+
+
+
+
+
+
+ Your browser is not supported (406 Not Acceptable)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Your browser is not supported.
Please upgrade your browser to continue.
+
+
+
+
+
+
diff --git a/public/422.html b/public/422.html
index 33dda348e..8bcf06014 100644
--- a/public/422.html
+++ b/public/422.html
@@ -1,69 +1,114 @@
-
-
-
-
- The change you wanted was rejected (422)
-
-
-
-
-
-
-
-
-
The change you wanted was rejected.
-
Maybe you tried to change something you didn't have access to.
-
-
If you are the application owner check the logs for more information.
-
-
+
+
+
+
+
+
+ The change you wanted was rejected (422 Unprocessable Entity)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The change you wanted was rejected. Maybe you tried to change something you didn’t have access to. If you’re the application owner check the logs for more information.
+
+
+
+
diff --git a/public/500.html b/public/500.html
index 90beade75..d77718c3a 100644
--- a/public/500.html
+++ b/public/500.html
@@ -1,68 +1,114 @@
-
-
-
-
- We're sorry, but something went wrong (500)
-
-
-
-
-
-
-
-
-
We're sorry, but something went wrong.
-
-
If you are the application owner check the logs for more information.
-
-
+
+
+
+
+
+
+ We’re sorry, but something went wrong (500 Internal Server Error)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ We’re sorry, but something went wrong.
If you’re the application owner check the logs for more information.
+
+
+
+
diff --git a/spec/controllers/api/taxon_concepts_controller_spec.rb b/spec/controllers/api/taxon_concepts_controller_spec.rb
index 020da670f..7ba8bca1e 100644
--- a/spec/controllers/api/taxon_concepts_controller_spec.rb
+++ b/spec/controllers/api/taxon_concepts_controller_spec.rb
@@ -124,7 +124,6 @@
'distribution_references' => [],
'name_status' => 'A',
'nomenclature_note_en' => nil,
- 'nomenclature_notification' => false,
'cites_listing' => nil,
'eu_listing' => nil,
'accepted_names' => [],
diff --git a/spec/serializers/show_taxon_concept_serializer_spec.rb b/spec/serializers/show_taxon_concept_serializer_spec.rb
index ceab6ee2c..39f1add94 100644
--- a/spec/serializers/show_taxon_concept_serializer_spec.rb
+++ b/spec/serializers/show_taxon_concept_serializer_spec.rb
@@ -1,90 +1,5 @@
require 'spec_helper'
describe Species::ShowTaxonConceptSerializer do
- # At the moment, we need to change the starting date of nomenclature_notification every time
- pending 'when species is output of recent nomenclature changes' do
- let(:species) { create_cites_eu_species }
- let(:nomenclature_change) do
- create(
- :nomenclature_change,
- status: 'submitted',
- created_at: 5.months.ago
- )
- end
- let!(:output) do
- create(
- :nomenclature_change_output,
- nomenclature_change_id: nomenclature_change.id,
- taxon_concept_id: species.id
- )
- end
- specify do
- expect(described_class.new(species).nomenclature_notification).to eq(true)
- end
- end
- pending 'when new species is output of recent nomenclature changes' do
- let(:species) { create_cites_eu_species }
- let(:nomenclature_change) do
- create(
- :nomenclature_change,
- status: 'submitted',
- created_at: 5.months.ago
- )
- end
- let!(:output) do
- create(
- :nomenclature_change_output,
- nomenclature_change_id: nomenclature_change.id,
- new_taxon_concept_id: species.id
- )
- end
- specify do
- expect(described_class.new(species).nomenclature_notification).to eq(true)
- end
- end
- context 'when species is output of old nomenclature changes' do
- let(:species) { create_cites_eu_species }
- let(:nomenclature_change) do
- create(
- :nomenclature_change,
- status: 'submitted',
- created_at: 7.months.ago
- )
- end
- let!(:output) do
- create(
- :nomenclature_change_output,
- nomenclature_change_id: nomenclature_change.id,
- taxon_concept_id: species.id
- )
- end
- specify do
- expect(described_class.new(species).nomenclature_notification).to eq(false)
- end
- end
- context 'when species is not output of nomenclature changes' do
- let(:species) { create_cites_eu_species }
- specify do
- expect(described_class.new(species).nomenclature_notification).to eq(false)
- end
- end
- context 'when nomenclature changes is not yet submitted' do
- let(:species) { create_cites_eu_species }
- let(:nomenclature_change) do
- create(
- :nomenclature_change,
- created_at: 5.months.ago
- )
- end
- let!(:output) do
- create(
- :nomenclature_change_output,
- nomenclature_change_id: nomenclature_change.id,
- taxon_concept_id: species.id
- )
- end
- specify do
- expect(described_class.new(species).nomenclature_notification).to eq(false)
- end
- end
+ # This used to test the method nomenclature_notification which no longer exists
end
diff --git a/spec/services/species/common_names_export_spec.rb b/spec/services/species/common_names_export_spec.rb
index 32466886d..acb01d1d4 100644
--- a/spec/services/species/common_names_export_spec.rb
+++ b/spec/services/species/common_names_export_spec.rb
@@ -4,40 +4,57 @@
subject do
Species::CommonNamesExport.new({})
end
- specify { expect(subject.path).to eq('public/downloads/common_names/') }
+
+ specify do
+ expect(subject.path).to eq('public/downloads/common_names/')
+ end
end
- describe :export do
+
+ describe :export, cache: true do
context 'when no results' do
subject do
Species::CommonNamesExport.new({})
end
- specify { expect(subject.export).to be_falsey }
+
+ specify do
+ expect(subject.export).to be_falsey
+ end
end
+
context 'when results' do
before(:each) do
- species = create_cites_eu_species
+ create_cites_eu_species
+
FileUtils.mkpath(
File.expand_path('spec/public/downloads/common_names')
)
+
allow_any_instance_of(Species::CommonNamesExport).to receive(:path).
and_return('spec/public/downloads/common_names/')
end
+
after(:each) do
FileUtils.remove_dir('spec/public/downloads/common_names', true)
end
+
subject do
Species::CommonNamesExport.new({})
end
+
context 'when file not cached' do
specify do
subject.export
+
expect(File.file?(subject.file_name)).to be_truthy
end
end
+
context 'when file cached' do
specify do
FileUtils.touch(subject.file_name)
+
expect(subject).not_to receive(:to_csv)
+
subject.export
end
end
diff --git a/spec/services/species/documents_export_spec.rb b/spec/services/species/documents_export_spec.rb
index eda298ce6..2269105be 100644
--- a/spec/services/species/documents_export_spec.rb
+++ b/spec/services/species/documents_export_spec.rb
@@ -4,10 +4,15 @@
subject do
Species::DocumentsExport.new({})
end
- specify { expect(subject.path).to eq('public/downloads/documents/') }
+
+ specify do
+ expect(subject.path).to eq('public/downloads/documents/')
+ end
end
+
SPEC_DOCUMENTS_DOWNLOAD_PATH = 'spec/public/downloads/documents'
- describe :export do
+
+ describe :export, cache: true do
before(:each) do
FileUtils.mkpath(
File.expand_path("#{SPEC_DOCUMENTS_DOWNLOAD_PATH}")
@@ -15,20 +20,25 @@
allow_any_instance_of(Species::DocumentsExport).to receive(:path).
and_return("#{SPEC_DOCUMENTS_DOWNLOAD_PATH}/")
end
+
after(:each) do
FileUtils.remove_dir("#{SPEC_DOCUMENTS_DOWNLOAD_PATH}", true)
end
+
context 'when no results' do
before(:each) do
FileUtils.rm_rf(Dir.glob("#{SPEC_DOCUMENTS_DOWNLOAD_PATH}/*"))
end
+
subject do
Species::DocumentsExport.new({})
end
+
specify 'when file not cached it should not be generated' do
expect(subject.export).to be_falsey
end
end
+
context 'when results' do
# Commented as was causing issues and tests are pending anyway
# before(:each) {
@@ -43,6 +53,7 @@
expect(File.file?(subject.file_name)).to be_truthy
expect(File.size(subject.file_name)).to be > 0
end
+
pending 'when file cached it should not be generated' do
FileUtils.touch(subject.file_name)
expect(subject).not_to receive(:to_csv)
diff --git a/spec/services/species/hybrid_prefix_matcher_spec.rb b/spec/services/species/hybrid_prefix_matcher_spec.rb
index 662e0e569..8d8fca45a 100644
--- a/spec/services/species/hybrid_prefix_matcher_spec.rb
+++ b/spec/services/species/hybrid_prefix_matcher_spec.rb
@@ -13,8 +13,10 @@
}
)
end
+
specify { expect(subject.results).to include(@hybrid_ac) }
end
+
context 'when trade internal visibility' do
subject do
Species::TaxonConceptPrefixMatcher.new(
@@ -25,8 +27,10 @@
}
)
end
+
specify { expect(subject.results).to include(@hybrid_ac) }
end
+
context 'when speciesplus visibility' do
subject do
Species::TaxonConceptPrefixMatcher.new(
@@ -36,6 +40,7 @@
}
)
end
+
specify { expect(subject.results).to be_empty }
end
end
diff --git a/spec/services/species/listings_export_spec.rb b/spec/services/species/listings_export_spec.rb
index 54bc44562..dc7ada10f 100644
--- a/spec/services/species/listings_export_spec.rb
+++ b/spec/services/species/listings_export_spec.rb
@@ -9,9 +9,11 @@
}
)
end
+
specify { expect(subject.path).to eq('public/downloads/cites_listings/') }
end
- describe :export do
+
+ describe :export, cache: true do
context 'when no results' do
subject do
Species::ListingsExportFactory.new(
@@ -22,8 +24,10 @@
}
)
end
+
specify { expect(subject.export).to be_falsey }
end
+
context 'when results' do
before(:each) do
FileUtils.mkpath(
@@ -32,9 +36,11 @@
allow_any_instance_of(Species::ListingsExport).to receive(:path).
and_return('spec/public/downloads/cites_listings/')
end
+
after(:each) do
FileUtils.remove_dir('spec/public/downloads/cites_listings', true)
end
+
subject do
Species::ListingsExportFactory.new(
{
@@ -44,12 +50,14 @@
}
)
end
+
context 'when file not cached' do
specify do
subject.export
expect(File.file?(subject.file_name)).to be_truthy
end
end
+
context 'when file cached' do
specify do
FileUtils.touch(subject.file_name)
@@ -59,6 +67,7 @@
end
end
end
+
describe :query do
context 'when CITES' do
context 'when Appendix I' do
@@ -70,6 +79,7 @@
}
)
end
+
specify { expect(subject.query.to_a.size).to eq(1) }
context 'when Poland' do
@@ -82,6 +92,7 @@
}
)
end
+
specify { expect(subject.query.to_a.size).to eq(0) }
end
@@ -95,9 +106,11 @@
}
)
end
+
specify { expect(subject.query.to_a.size).to eq(1) }
end
end
+
context 'when higher taxon ids' do
subject do
Species::ListingsExportFactory.new(
@@ -107,8 +120,10 @@
}
)
end
+
specify { expect(subject.query.to_a.size).to eq(1) }
end
+
context 'when implicitly listed subspecies present' do
before(:each) do
create_cites_eu_subspecies(
@@ -116,6 +131,7 @@
)
SapiModule::StoredProcedures.rebuild_cites_taxonomy_and_listings
end
+
subject do
Species::ListingsExportFactory.new(
{
@@ -124,9 +140,11 @@
}
)
end
+
specify { expect(subject.query.to_a.size).to eq(1) }
end
end
+
context 'when EU' do
context 'when Annex A' do
subject do
@@ -137,6 +155,7 @@
}
)
end
+
specify { expect(subject.query.to_a.size).to eq(1) }
context 'when Spain' do
@@ -149,6 +168,7 @@
}
)
end
+
specify { expect(subject.query.to_a.size).to eq(0) }
end
@@ -162,9 +182,11 @@
}
)
end
+
specify { expect(subject.query.to_a.size).to eq(1) }
end
end
+
context 'when higher taxon ids' do
subject do
Species::ListingsExportFactory.new(
@@ -174,6 +196,7 @@
}
)
end
+
specify { expect(subject.query.to_a.size).to eq(1) }
end
end
diff --git a/spec/services/species/orphaned_taxon_concepts_export_spec.rb b/spec/services/species/orphaned_taxon_concepts_export_spec.rb
index a6bee4cb6..bf1f3833b 100644
--- a/spec/services/species/orphaned_taxon_concepts_export_spec.rb
+++ b/spec/services/species/orphaned_taxon_concepts_export_spec.rb
@@ -4,41 +4,55 @@
subject do
Species::OrphanedTaxonConceptsExport.new({})
end
+
specify { expect(subject.path).to eq('public/downloads/orphaned_taxon_concepts/') }
end
- describe :export do
+
+ describe :export, cache: true do
context 'when no results' do
subject do
Species::OrphanedTaxonConceptsExport.new({})
end
+
specify { expect(subject.export).to be_falsey }
end
+
context 'when results' do
before(:each) do
tc = create(:taxon_concept)
+
tc.update_attribute(:parent_id, nil) # skipping validations
+
FileUtils.mkpath(
File.expand_path('spec/public/downloads/orphaned_taxon_concepts')
)
+
allow_any_instance_of(Species::OrphanedTaxonConceptsExport).to receive(:path).
and_return('spec/public/downloads/orphaned_taxon_concepts/')
end
+
after(:each) do
FileUtils.remove_dir('spec/public/downloads/orphaned_taxon_concepts', true)
end
+
subject do
Species::OrphanedTaxonConceptsExport.new({})
end
+
context 'when file not cached' do
specify do
subject.export
+
expect(File.file?(subject.file_name)).to be_truthy
end
end
+
context 'when file cached' do
specify do
FileUtils.touch(subject.file_name)
+
expect(subject).not_to receive(:to_csv)
+
subject.export
end
end
diff --git a/spec/services/species/search_spec.rb b/spec/services/species/search_spec.rb
index 90b680057..94c9f21af 100644
--- a/spec/services/species/search_spec.rb
+++ b/spec/services/species/search_spec.rb
@@ -1,20 +1,24 @@
require 'spec_helper'
describe Species::Search do
include_context 'Canis lupus'
+
describe :results do
context 'when searching by scientific name' do
context 'when regular query' do
subject { Species::Search.new({ taxon_concept_query: 'canis' }).results }
specify { expect(subject).to include(@species) }
end
+
context 'when malicious query' do
subject { Species::Search.new({ taxon_concept_query: 'canis\'' }).results }
specify { expect(subject).to be_empty }
end
+
context 'when leading whitespace' do
subject { Species::Search.new({ taxon_concept_query: ' canis' }).results }
specify { expect(subject).to include(@species) }
end
+
context 'when trailing whitespace' do
subject { Species::Search.new({ taxon_concept_query: 'canis ' }).results }
specify { expect(subject).to include(@species) }
diff --git a/spec/services/species/species_reference_output_spec.rb b/spec/services/species/species_reference_output_spec.rb
index 3f133ffe7..0a812a1e8 100644
--- a/spec/services/species/species_reference_output_spec.rb
+++ b/spec/services/species/species_reference_output_spec.rb
@@ -4,40 +4,53 @@
subject do
Species::SpeciesReferenceOutputExport.new({})
end
+
specify { expect(subject.path).to eq('public/downloads/species_reference_output/') }
end
- describe :export do
+
+ describe :export, cache: true do
context 'when no results' do
subject do
Species::SpeciesReferenceOutputExport.new({})
end
+
specify { expect(subject.export).to be_falsey }
end
+
context 'when results' do
before(:each) do
- species = create_cites_eu_species
+ create_cites_eu_species
+
FileUtils.mkpath(
File.expand_path('spec/public/downloads/species_reference_output')
)
+
allow_any_instance_of(Species::SpeciesReferenceOutputExport).to receive(:path).
and_return('spec/public/downloads/species_reference_output/')
end
+
after(:each) do
FileUtils.remove_dir('spec/public/downloads/species_reference_output', true)
end
+
subject do
Species::SpeciesReferenceOutputExport.new({})
end
+
context 'when file not cached' do
specify do
subject.export
+
expect(File.file?(subject.file_name)).to be_truthy
end
end
+
context 'when file cached' do
specify do
FileUtils.touch(subject.file_name)
+
expect(subject).not_to receive(:to_csv)
+
subject.export
end
end
diff --git a/spec/services/species/standard_reference_output_spec.rb b/spec/services/species/standard_reference_output_spec.rb
index 5fa7898de..1b916875f 100644
--- a/spec/services/species/standard_reference_output_spec.rb
+++ b/spec/services/species/standard_reference_output_spec.rb
@@ -4,40 +4,53 @@
subject do
Species::StandardReferenceOutputExport.new({})
end
+
specify { expect(subject.path).to eq('public/downloads/standard_reference_output/') }
end
- describe :export do
+
+ describe :export, cache: true do
context 'when no results' do
subject do
Species::StandardReferenceOutputExport.new({})
end
+
specify { expect(subject.export).to be_falsey }
end
+
context 'when results' do
before(:each) do
- species = create_cites_eu_species
+ create_cites_eu_species
+
FileUtils.mkpath(
File.expand_path('spec/public/downloads/standard_reference_output')
)
+
allow_any_instance_of(Species::StandardReferenceOutputExport).to receive(:path).
and_return('spec/public/downloads/standard_reference_output/')
end
+
after(:each) do
FileUtils.remove_dir('spec/public/downloads/standard_reference_output', true)
end
+
subject do
Species::StandardReferenceOutputExport.new({})
end
+
context 'when file not cached' do
specify do
subject.export
+
expect(File.file?(subject.file_name)).to be_truthy
end
end
+
context 'when file cached' do
specify do
FileUtils.touch(subject.file_name)
+
expect(subject).not_to receive(:to_csv)
+
subject.export
end
end
diff --git a/spec/services/species/synonyms_and_trade_names_export_spec.rb b/spec/services/species/synonyms_and_trade_names_export_spec.rb
index 8f41f07b5..5e815ab1c 100644
--- a/spec/services/species/synonyms_and_trade_names_export_spec.rb
+++ b/spec/services/species/synonyms_and_trade_names_export_spec.rb
@@ -4,15 +4,19 @@
subject do
Species::SynonymsAndTradeNamesExport.new({})
end
+
specify { expect(subject.path).to eq('public/downloads/synonyms_and_trade_names/') }
end
- describe :export do
+
+ describe :export, cache: true do
context 'when no results' do
subject do
Species::SynonymsAndTradeNamesExport.new({})
end
+
specify { expect(subject.export).to be_falsey }
end
+
context 'when results' do
before(:each) do
species = create_cites_eu_species
@@ -29,18 +33,22 @@
allow_any_instance_of(Species::SynonymsAndTradeNamesExport).to receive(:path).
and_return('spec/public/downloads/synonyms_and_trade_names/')
end
+
after(:each) do
FileUtils.remove_dir('spec/public/downloads/synonyms_and_trade_names', true)
end
+
subject do
Species::SynonymsAndTradeNamesExport.new({})
end
+
context 'when file not cached' do
specify do
subject.export
expect(File.file?(subject.file_name)).to be_truthy
end
end
+
context 'when file cached' do
specify do
FileUtils.touch(subject.file_name)
diff --git a/spec/services/species/taxon_concept_prefix_matcher_spec.rb b/spec/services/species/taxon_concept_prefix_matcher_spec.rb
index 663fb7179..60f6f8765 100644
--- a/spec/services/species/taxon_concept_prefix_matcher_spec.rb
+++ b/spec/services/species/taxon_concept_prefix_matcher_spec.rb
@@ -12,8 +12,10 @@
}
)
end
+
specify { expect(subject.results).to include(@species_ac) }
end
+
context 'when searching by hyphenated common name without hyphens' do
subject do
Species::TaxonConceptPrefixMatcher.new(
@@ -23,8 +25,10 @@
}
)
end
+
specify { expect(subject.results).to include(@species_ac) }
end
+
context 'when searching by part of hyphenated common name' do
subject do
Species::TaxonConceptPrefixMatcher.new(
@@ -34,9 +38,11 @@
}
)
end
+
specify { expect(subject.results).to include(@species_ac) }
end
end
+
context 'when searching by scientific name' do
context 'when regular query' do
subject do
@@ -47,8 +53,10 @@
}
)
end
+
specify { expect(subject.results).to include(@species_ac) }
end
+
context 'when malicious query' do
subject do
Species::TaxonConceptPrefixMatcher.new(
@@ -58,8 +66,10 @@
}
)
end
+
specify { expect(subject.results).to be_empty }
end
+
context 'when leading whitespace' do
subject do
Species::TaxonConceptPrefixMatcher.new(
@@ -69,8 +79,10 @@
}
)
end
+
specify { expect(subject.results).to include(@species_ac) }
end
+
context 'when trailing whitespace' do
subject do
Species::TaxonConceptPrefixMatcher.new(
@@ -80,8 +92,10 @@
}
)
end
+
specify { expect(subject.results).to include(@species_ac) }
end
+
context 'when implicitly listed subspecies' do
subject do
Species::TaxonConceptPrefixMatcher.new(
@@ -91,8 +105,10 @@
}
)
end
+
specify { expect(subject.results).not_to include(@subspecies2_ac) }
end
+
context 'when explicitly listed subspecies' do
subject do
Species::TaxonConceptPrefixMatcher.new(
@@ -102,8 +118,10 @@
}
)
end
+
specify { expect(subject.results).to include(@subspecies1_ac) }
end
+
context 'when implicitly listed higher taxon (without an explicitly listed ancestor)' do
subject do
Species::TaxonConceptPrefixMatcher.new(
@@ -113,8 +131,10 @@
}
)
end
+
specify { expect(subject.results).to include(@order_ac) }
end
+
context 'when explicitly listed higher taxon' do
subject do
Species::TaxonConceptPrefixMatcher.new(
@@ -124,6 +144,7 @@
}
)
end
+
specify { expect(subject.results).to include(@family_ac) }
end
# check ranks filtering
@@ -137,8 +158,10 @@
}
)
end
+
specify { expect(subject.results).to include(@family_ac) }
end
+
context 'when explicitly listed higher taxon but ranks expected SPECIES' do
subject do
Species::TaxonConceptPrefixMatcher.new(
@@ -149,8 +172,10 @@
}
)
end
+
specify { expect(subject.results).to be_empty }
end
+
context 'when searching for name that matches Species and Subspecies but ranks expected SUBSPECIES' do
subject do
Species::TaxonConceptPrefixMatcher.new(
@@ -161,6 +186,7 @@
}
)
end
+
specify do
expect(subject.results).not_to include(@species_ac)
expect(subject.results).to include(@subspecies1_ac)
diff --git a/spec/services/species/taxon_concepts_export_spec.rb b/spec/services/species/taxon_concepts_export_spec.rb
index 0947da1bf..7b1002e61 100644
--- a/spec/services/species/taxon_concepts_export_spec.rb
+++ b/spec/services/species/taxon_concepts_export_spec.rb
@@ -4,15 +4,19 @@
subject do
Species::TaxonConceptsNamesExport.new({})
end
+
specify { expect(subject.path).to eq('public/downloads/taxon_concepts_names/') }
end
- describe :export do
+
+ describe :export, cache: true do
context 'when no results' do
subject do
Species::TaxonConceptsNamesExport.new({})
end
+
specify { expect(subject.export).to be_falsey }
end
+
context 'when results' do
before(:each) do
create(:taxon_concept)
@@ -22,18 +26,22 @@
allow_any_instance_of(Species::TaxonConceptsNamesExport).to receive(:path).
and_return('spec/public/downloads/taxon_concepts_names/')
end
+
after(:each) do
FileUtils.remove_dir('spec/public/downloads/taxon_concepts_names', true)
end
+
subject do
Species::TaxonConceptsNamesExport.new({})
end
+
context 'when file not cached' do
specify do
subject.export
expect(File.file?(subject.file_name)).to be_truthy
end
end
+
context 'when file cached' do
specify do
FileUtils.touch(subject.file_name)
diff --git a/spec/services/species/trade_name_prefix_matcher_spec.rb b/spec/services/species/trade_name_prefix_matcher_spec.rb
index 1e6d753ab..ccbdefe2c 100644
--- a/spec/services/species/trade_name_prefix_matcher_spec.rb
+++ b/spec/services/species/trade_name_prefix_matcher_spec.rb
@@ -4,10 +4,12 @@
@accepted_name = create_cites_eu_genus(
taxon_name: create(:taxon_name, scientific_name: 'Pavona')
)
+
@trade_name = create_cites_eu_species(
taxon_name: create(:taxon_name, scientific_name: 'Pavona minor'),
name_status: 'T'
)
+
@status_N_species = create_cites_eu_species(
taxon_name: create(:taxon_name, scientific_name: 'Paradisaea'),
parent: create_cites_eu_genus(
@@ -15,18 +17,23 @@
),
name_status: 'N'
)
+
create(
:taxon_relationship,
taxon_concept: @accepted_name,
other_taxon_concept: @trade_name,
taxon_relationship_type: trade_name_relationship_type
)
+
create_cites_I_addition(taxon_concept: @accepted_name)
+
SapiModule::StoredProcedures.rebuild_cites_taxonomy_and_listings
+
@accepted_name_ac = MAutoCompleteTaxonConcept.find(@accepted_name.id)
@trade_name_ac = MAutoCompleteTaxonConcept.find(@trade_name.id)
@status_N_species_ac = MAutoCompleteTaxonConcept.find(@status_N_species.id)
end
+
describe :results do
context 'when searching for status N species' do
context 'when trade visibility' do
@@ -39,8 +46,10 @@
}
)
end
+
specify { expect(subject.results).to include(@status_N_species_ac) }
end
+
context 'when trade internal visibility' do
subject do
Species::TaxonConceptPrefixMatcher.new(
@@ -51,8 +60,10 @@
}
)
end
+
specify { expect(subject.results).to include(@status_N_species_ac) }
end
+
context 'when speciesplus visibility' do
subject do
Species::TaxonConceptPrefixMatcher.new(
@@ -62,9 +73,11 @@
}
)
end
+
specify { expect(subject.results).not_to include(@status_N_species_ac) }
end
end
+
context 'when searching for trade name' do
context 'when trade visibility' do
subject do
@@ -76,9 +89,11 @@
}
)
end
+
specify { expect(subject.results).not_to include(@trade_name_ac) }
specify { expect(subject.results).to include(@accepted_name_ac) }
end
+
context 'when trade internal visibility' do
subject do
Species::TaxonConceptPrefixMatcher.new(
@@ -89,9 +104,11 @@
}
)
end
+
specify { expect(subject.results).to include(@trade_name_ac) }
specify { expect(subject.results).to include(@accepted_name_ac) }
end
+
context 'when speciesplus visibility' do
subject do
Species::TaxonConceptPrefixMatcher.new(
@@ -101,6 +118,7 @@
}
)
end
+
specify { expect(subject.results).not_to include(@trade_name_ac) }
specify { expect(subject.results).to include(@accepted_name_ac) }
end
diff --git a/spec/services/taxon_concept_prefix_matcher_spec.rb b/spec/services/taxon_concept_prefix_matcher_spec.rb
index 0d0762b45..2ad678631 100644
--- a/spec/services/taxon_concept_prefix_matcher_spec.rb
+++ b/spec/services/taxon_concept_prefix_matcher_spec.rb
@@ -8,12 +8,14 @@
taxon_name: create(:taxon_name, scientific_name: 'Aaa')
)
end
+
let!(:taxon_concept2) do
create_cites_eu_family(
taxon_name: create(:taxon_name, scientific_name: 'Aac'),
parent: taxon_concept1
)
end
+
let!(:taxon_concept3) do
create_cites_eu_subfamily(
taxon_name: create(:taxon_name, scientific_name: 'Aab'),
@@ -32,23 +34,28 @@
parent: taxon_concept3
)
end
+
let!(:hybrid) do
- tmp = create_cites_eu_genus(
+ hybrid_genus = create_cites_eu_genus(
taxon_name: create(:taxon_name, scientific_name: 'Abc'),
name_status: 'H'
)
+
create(
:taxon_relationship,
taxon_concept: taxon_concept4,
- other_taxon_concept: tmp,
+ other_taxon_concept: hybrid_genus,
taxon_relationship_type: hybrid_relationship_type
)
- tmp
+
+ hybrid_genus
end
+
context 'when name status not specified' do
let(:matcher_params) do
SearchParams.new(taxonomy: { id: taxonomy.id }, scientific_name: 'Ab')
end
+
let(:matcher) { TaxonConceptPrefixMatcher.new matcher_params }
specify { expect(matcher.taxon_concepts).to include(taxon_concept4) }
specify { expect(matcher.taxon_concepts).not_to include(hybrid) }
@@ -58,7 +65,9 @@
let(:matcher_params) do
SearchParams.new(taxonomy: { id: taxonomy.id }, scientific_name: 'Ab', name_status: 'H')
end
+
let(:matcher) { TaxonConceptPrefixMatcher.new matcher_params }
+
specify { expect(matcher.taxon_concepts).not_to include(taxon_concept4) }
specify { expect(matcher.taxon_concepts).to include(hybrid) }
end
@@ -71,6 +80,7 @@
scientific_name: 'A'
)
end
+
let(:parent_matcher) do
TaxonConceptPrefixMatcher.new parent_matcher_params
end
@@ -88,6 +98,7 @@
scientific_name: 'AAA'
)
end
+
let(:ancestor_matcher) do
TaxonConceptPrefixMatcher.new ancestor_matcher_params
end
@@ -105,6 +116,7 @@
scientific_name: 'AAA'
)
end
+
let(:self_and_ancestor_matcher) do
TaxonConceptPrefixMatcher.new self_and_ancestor_matcher_params
end
@@ -140,6 +152,7 @@
scientific_name: 'A'
)
end
+
let(:descendant_matcher) do
TaxonConceptPrefixMatcher.new descendant_matcher_params
end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 70102c3bd..7c3aa80af 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -103,6 +103,20 @@
Sidekiq::Testing.fake!
end
end
+
+ config.before(:each) do |example|
+ if example.metadata[:cache]
+ memory_store = ActiveSupport::Cache.lookup_store(:memory_store)
+
+ allow(
+ Rails.application.config.action_controller
+ ).to receive(:perform_caching).and_return(true)
+
+ allow(Rails).to receive(:cache).and_return(memory_store)
+
+ Rails.cache.clear
+ end
+ end
end
def build_attributes(*args)