mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-23 20:26:49 +00:00
Compare commits
44 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6c219b31a3 | ||
|
|
83c7764456 | ||
|
|
23c3573b8f | ||
|
|
7c8a3bd7c9 | ||
|
|
9d33402d9e | ||
|
|
abf8d44935 | ||
|
|
fb15b19e88 | ||
|
|
e5c6ff433c | ||
|
|
bb35629960 | ||
|
|
c4e75dc557 | ||
|
|
10d1d2066e | ||
|
|
3c53214daa | ||
|
|
40a9c36c85 | ||
|
|
48ecbaaa16 | ||
|
|
ef7684e079 | ||
|
|
04c3b8b9cf | ||
|
|
fd3a54a904 | ||
|
|
236abe485a | ||
|
|
8fb11b9151 | ||
|
|
b9471d4f01 | ||
|
|
b5da120805 | ||
|
|
da5976d85d | ||
|
|
9e1047288f | ||
|
|
ff9985dd88 | ||
|
|
e62eca93c1 | ||
|
|
8d532ae262 | ||
|
|
d2f28e2095 | ||
|
|
dbd5186dfa | ||
|
|
61cb7c4402 | ||
|
|
ccfb83d2cd | ||
|
|
d6aa0168b2 | ||
|
|
2a8ef5a45e | ||
|
|
c423641102 | ||
|
|
22559a755f | ||
|
|
e877f94e07 | ||
|
|
820fff0528 | ||
|
|
204295dc91 | ||
|
|
4ed71f1883 | ||
|
|
92585b65c5 | ||
|
|
099f75befb | ||
|
|
2eaf79b149 | ||
|
|
4b3465de78 | ||
|
|
c1c0a72184 | ||
|
|
cb1b24695e |
334
.github/workflows/build.yml
vendored
334
.github/workflows/build.yml
vendored
@@ -8,7 +8,7 @@ on:
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
DISABLE_KNAPSACK: true
|
||||
DISABLE_KNAPSACK_PRO: false
|
||||
TIMEZONE: UTC
|
||||
COVERAGE: true
|
||||
RAILS_ENV: test
|
||||
@@ -17,7 +17,7 @@ permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
rspec:
|
||||
knapsack_rspec_controllers:
|
||||
runs-on: ubuntu-20.04
|
||||
services:
|
||||
postgres:
|
||||
@@ -33,19 +33,15 @@ jobs:
|
||||
POSTGRES_USER: ofn
|
||||
POSTGRES_PASSWORD: f00d
|
||||
strategy:
|
||||
matrix:
|
||||
specs:
|
||||
- "spec/controllers"
|
||||
- "spec/models"
|
||||
- "spec/lib"
|
||||
- "spec/migrations"
|
||||
- "spec/serializers"
|
||||
- "spec/system/admin/[a-o0-9]*"
|
||||
- "spec/system/admin/[p-z]*"
|
||||
- "spec/system/consumer/[a-o0-9]*"
|
||||
- "spec/system/consumer/[p-z]*"
|
||||
- "engines/*/spec"
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# [n] - where the n is a number of parallel jobs you want to run your tests on.
|
||||
# Use a higher number if you have slow tests to split them between more parallel jobs.
|
||||
# Remember to update the value of the `ci_node_index` below to (0..n-1).
|
||||
ci_node_total: [8]
|
||||
# Indexes for parallel jobs (starting from zero).
|
||||
# E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc.
|
||||
ci_node_index: [0, 1, 2, 3, 4, 5, 6, 7]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
@@ -72,7 +68,161 @@ jobs:
|
||||
bundle exec rake db:schema:load
|
||||
|
||||
- name: Run tests
|
||||
run: bundle exec rspec --profile -- ${{ matrix.specs }}
|
||||
|
||||
env:
|
||||
KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: 864ef557d85ea8e603e086c0387d5154
|
||||
KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }}
|
||||
KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }}
|
||||
KNAPSACK_PRO_LOG_LEVEL: info
|
||||
# if you use Knapsack Pro Queue Mode you must set below env variable
|
||||
# to be able to retry CI build and run previously recorded tests
|
||||
# https://github.com/KnapsackPro/knapsack_pro-ruby#knapsack_pro_fixed_queue_split-remember-queue-split-on-retry-ci-node
|
||||
# KNAPSACK_PRO_FIXED_QUEUE_SPLIT: false
|
||||
# RSpec split test files by test examples feature - it's optional
|
||||
# https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it
|
||||
#KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true
|
||||
KNAPSACK_PRO_TEST_FILE_PATTERN: "spec/controllers/**/*_spec.rb"
|
||||
|
||||
run: |
|
||||
bundle exec rake knapsack_pro:rspec
|
||||
|
||||
knapsack_rspec_models:
|
||||
runs-on: ubuntu-20.04
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:10
|
||||
ports: ["5432:5432"]
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
env:
|
||||
POSTGRES_DB: open_food_network_test
|
||||
POSTGRES_USER: ofn
|
||||
POSTGRES_PASSWORD: f00d
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# [n] - where the n is a number of parallel jobs you want to run your tests on.
|
||||
# Use a higher number if you have slow tests to split them between more parallel jobs.
|
||||
# Remember to update the value of the `ci_node_index` below to (0..n-1).
|
||||
ci_node_total: [7]
|
||||
# Indexes for parallel jobs (starting from zero).
|
||||
# E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc.
|
||||
ci_node_index: [0, 1, 2, 3, 4, 5, 6]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup redis
|
||||
uses: supercharge/redis-github-action@1.4.0
|
||||
with:
|
||||
redis-version: 6
|
||||
|
||||
- name: Set up Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
|
||||
- name: Install JS dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
|
||||
- name: Set up database
|
||||
run: |
|
||||
bundle exec rake db:create
|
||||
bundle exec rake db:schema:load
|
||||
|
||||
- name: Run tests
|
||||
|
||||
env:
|
||||
KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: 09476e2ce491c12083df62768667c674
|
||||
KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }}
|
||||
KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }}
|
||||
KNAPSACK_PRO_LOG_LEVEL: info
|
||||
# if you use Knapsack Pro Queue Mode you must set below env variable
|
||||
# to be able to retry CI build and run previously recorded tests
|
||||
# https://github.com/KnapsackPro/knapsack_pro-ruby#knapsack_pro_fixed_queue_split-remember-queue-split-on-retry-ci-node
|
||||
# KNAPSACK_PRO_FIXED_QUEUE_SPLIT: false
|
||||
# RSpec split test files by test examples feature - it's optional
|
||||
# https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it
|
||||
#KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true
|
||||
KNAPSACK_PRO_TEST_FILE_PATTERN: "spec/models/**/*_spec.rb"
|
||||
|
||||
run: |
|
||||
bundle exec rake knapsack_pro:rspec
|
||||
|
||||
knapsack_rspec_system:
|
||||
runs-on: ubuntu-20.04
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:10
|
||||
ports: ["5432:5432"]
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
env:
|
||||
POSTGRES_DB: open_food_network_test
|
||||
POSTGRES_USER: ofn
|
||||
POSTGRES_PASSWORD: f00d
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# [n] - where the n is a number of parallel jobs you want to run your tests on.
|
||||
# Use a higher number if you have slow tests to split them between more parallel jobs.
|
||||
# Remember to update the value of the `ci_node_index` below to (0..n-1).
|
||||
ci_node_total: [30]
|
||||
# Indexes for parallel jobs (starting from zero).
|
||||
# E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc.
|
||||
ci_node_index: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup redis
|
||||
uses: supercharge/redis-github-action@1.4.0
|
||||
with:
|
||||
redis-version: 6
|
||||
|
||||
- name: Set up Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
|
||||
- name: Install JS dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
|
||||
- name: Set up database
|
||||
run: |
|
||||
bundle exec rake db:create
|
||||
bundle exec rake db:schema:load
|
||||
|
||||
- name: Run tests
|
||||
|
||||
env:
|
||||
KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: ff2456e64c9f2aa5157eb0daf711d3c3
|
||||
KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }}
|
||||
KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }}
|
||||
KNAPSACK_PRO_LOG_LEVEL: info
|
||||
# if you use Knapsack Pro Queue Mode you must set below env variable
|
||||
# to be able to retry CI build and run previously recorded tests
|
||||
# https://github.com/KnapsackPro/knapsack_pro-ruby#knapsack_pro_fixed_queue_split-remember-queue-split-on-retry-ci-node
|
||||
KNAPSACK_PRO_FIXED_QUEUE_SPLIT: true
|
||||
# RSpec split test files by test examples feature - it's optional
|
||||
# https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it
|
||||
#KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true
|
||||
KNAPSACK_PRO_TEST_FILE_PATTERN: "spec/system/**/*_spec.rb"
|
||||
|
||||
run: |
|
||||
bundle exec rake knapsack_pro:queue:rspec
|
||||
|
||||
- name: Archive failed tests screenshots
|
||||
if: failure()
|
||||
@@ -83,7 +233,155 @@ jobs:
|
||||
retention-days: 7
|
||||
if-no-files-found: ignore
|
||||
|
||||
test-the-rest:
|
||||
knapsack_rspec_engines:
|
||||
runs-on: ubuntu-20.04
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:10
|
||||
ports: ["5432:5432"]
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
env:
|
||||
POSTGRES_DB: open_food_network_test
|
||||
POSTGRES_USER: ofn
|
||||
POSTGRES_PASSWORD: f00d
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# [n] - where the n is a number of parallel jobs you want to run your tests on.
|
||||
# Use a higher number if you have slow tests to split them between more parallel jobs.
|
||||
# Remember to update the value of the `ci_node_index` below to (0..n-1).
|
||||
ci_node_total: [5]
|
||||
# Indexes for parallel jobs (starting from zero).
|
||||
# E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc.
|
||||
ci_node_index: [0, 1, 2, 3, 4]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup redis
|
||||
uses: supercharge/redis-github-action@1.4.0
|
||||
with:
|
||||
redis-version: 6
|
||||
|
||||
- name: Set up Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
|
||||
- name: Install JS dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
|
||||
- name: Set up database
|
||||
run: |
|
||||
bundle exec rake db:create
|
||||
bundle exec rake db:schema:load
|
||||
|
||||
- name: Run tests
|
||||
|
||||
env:
|
||||
KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: 09476e2ce491c12083df62768667c674
|
||||
KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }}
|
||||
KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }}
|
||||
KNAPSACK_PRO_LOG_LEVEL: info
|
||||
# if you use Knapsack Pro Queue Mode you must set below env variable
|
||||
# to be able to retry CI build and run previously recorded tests
|
||||
# https://github.com/KnapsackPro/knapsack_pro-ruby#knapsack_pro_fixed_queue_split-remember-queue-split-on-retry-ci-node
|
||||
# KNAPSACK_PRO_FIXED_QUEUE_SPLIT: false
|
||||
# RSpec split test files by test examples feature - it's optional
|
||||
# https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it
|
||||
#KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true
|
||||
KNAPSACK_PRO_TEST_FILE_PATTERN: "{spec/lib/**/*_spec.rb, spec/migrations/**/*_spec.rb, spec/serializers/**/*_spec.rb, engines/**/*_spec.rb}"
|
||||
|
||||
run: |
|
||||
bundle exec rake knapsack_pro:rspec
|
||||
|
||||
- name: Archive failed tests screenshots
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: failed-tests-screenshots
|
||||
path: tmp/capybara/screenshots/*.png
|
||||
retention-days: 7
|
||||
if-no-files-found: ignore
|
||||
|
||||
knapsack_rspec_test_the_rest:
|
||||
runs-on: ubuntu-20.04
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:10
|
||||
ports: ["5432:5432"]
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
env:
|
||||
POSTGRES_DB: open_food_network_test
|
||||
POSTGRES_USER: ofn
|
||||
POSTGRES_PASSWORD: f00d
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# [n] - where the n is a number of parallel jobs you want to run your tests on.
|
||||
# Use a higher number if you have slow tests to split them between more parallel jobs.
|
||||
# Remember to update the value of the `ci_node_index` below to (0..n-1).
|
||||
ci_node_total: [5]
|
||||
# Indexes for parallel jobs (starting from zero).
|
||||
# E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc.
|
||||
ci_node_index: [0, 1, 2, 3, 4]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup redis
|
||||
uses: supercharge/redis-github-action@1.4.0
|
||||
with:
|
||||
redis-version: 6
|
||||
|
||||
- name: Set up Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
|
||||
- name: Install JS dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
|
||||
- name: Set up database
|
||||
run: |
|
||||
bundle exec rake db:create
|
||||
bundle exec rake db:schema:load
|
||||
|
||||
- name: Run tests
|
||||
|
||||
env:
|
||||
KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: e3b8800198d2d89b70c7edbdd85f8fd8
|
||||
KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }}
|
||||
KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }}
|
||||
KNAPSACK_PRO_LOG_LEVEL: info
|
||||
# if you use Knapsack Pro Queue Mode you must set below env variable
|
||||
# to be able to retry CI build and run previously recorded tests
|
||||
# https://github.com/KnapsackPro/knapsack_pro-ruby#knapsack_pro_fixed_queue_split-remember-queue-split-on-retry-ci-node
|
||||
# KNAPSACK_PRO_FIXED_QUEUE_SPLIT: false
|
||||
# RSpec split test files by test examples feature - it's optional
|
||||
# https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it
|
||||
#KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true
|
||||
KNAPSACK_PRO_TEST_FILE_EXCLUDE_PATTERN: "{engines/**{,/*/**}/*_spec.rb,spec/models/**{,/*/**}/*_spec.rb,spec/controllers/**{,/*/**}/*_spec.rb,spec/serializers/**{,/*/**}/*_spec.rb,spec/lib/**{,/*/**}/*_spec.rb,spec/migrations/**{,/*/**}/*_spec.rb,spec/system/**{,/*/**}/*_spec.rb}"
|
||||
|
||||
|
||||
run: |
|
||||
bundle exec rake knapsack_pro:rspec
|
||||
|
||||
non_knapsack_jest_karma:
|
||||
runs-on: ubuntu-20.04
|
||||
services:
|
||||
postgres:
|
||||
@@ -122,12 +420,8 @@ jobs:
|
||||
run: |
|
||||
bundle exec rake db:create
|
||||
bundle exec rake db:schema:load
|
||||
|
||||
- name: Run JS tests
|
||||
run: bundle exec rake karma:run
|
||||
|
||||
- name: Run jest tests
|
||||
run: yarn jest
|
||||
|
||||
- name: Run all other tests
|
||||
run: bundle exec rspec --exclude-pattern "./models/**/*_spec.rb, ./controllers/**/*_spec.rb, ./serializers/**/*_spec.rb, ./lib/**/*_spec.rb, ./migrations/**/*_spec.rb, ./system/**/*_spec.rb"
|
||||
|
||||
4
Gemfile
4
Gemfile
@@ -136,6 +136,8 @@ gem 'flipper-ui'
|
||||
|
||||
gem "view_component"
|
||||
|
||||
gem 'mini_portile2', '~> 2.8'
|
||||
|
||||
group :production, :staging do
|
||||
gem 'ddtrace'
|
||||
gem 'rack-timeout'
|
||||
@@ -150,7 +152,7 @@ group :test, :development do
|
||||
gem "factory_bot_rails", '6.2.0', require: false
|
||||
gem 'fuubar', '~> 2.5.1'
|
||||
gem 'json_spec', '~> 1.1.4'
|
||||
gem 'knapsack', require: false
|
||||
gem 'knapsack_pro'
|
||||
gem 'letter_opener', '>= 1.4.1'
|
||||
gem 'rspec-rails', ">= 3.5.2"
|
||||
gem 'rspec-retry', require: false
|
||||
|
||||
19
Gemfile.lock
19
Gemfile.lock
@@ -177,7 +177,7 @@ GEM
|
||||
bigdecimal (3.0.2)
|
||||
bindata (2.4.12)
|
||||
bindex (0.8.1)
|
||||
bootsnap (1.13.0)
|
||||
bootsnap (1.14.0)
|
||||
msgpack (~> 1.2)
|
||||
bugsnag (6.24.2)
|
||||
concurrent-ruby (~> 1.0)
|
||||
@@ -375,7 +375,7 @@ GEM
|
||||
jsonapi-serializer (2.2.0)
|
||||
activesupport (>= 4.2)
|
||||
jwt (2.5.0)
|
||||
knapsack (4.0.0)
|
||||
knapsack_pro (3.4.1)
|
||||
rake
|
||||
launchy (2.5.0)
|
||||
addressable (~> 2.7)
|
||||
@@ -409,7 +409,7 @@ GEM
|
||||
money (~> 6.12)
|
||||
money (6.16.0)
|
||||
i18n (>= 0.6.4, <= 2)
|
||||
msgpack (1.5.4)
|
||||
msgpack (1.6.0)
|
||||
multi_json (1.15.0)
|
||||
multi_xml (0.6.0)
|
||||
net-protocol (0.1.3)
|
||||
@@ -545,7 +545,7 @@ GEM
|
||||
ffi (~> 1.0)
|
||||
redcarpet (3.5.1)
|
||||
redis (4.8.0)
|
||||
regexp_parser (2.6.0)
|
||||
regexp_parser (2.6.1)
|
||||
reline (0.3.1)
|
||||
io-console (~> 0.5)
|
||||
request_store (1.5.0)
|
||||
@@ -589,14 +589,14 @@ GEM
|
||||
rspec-retry (0.6.2)
|
||||
rspec-core (> 3.3)
|
||||
rspec-support (3.10.3)
|
||||
rswag-api (2.7.0)
|
||||
rswag-api (2.8.0)
|
||||
railties (>= 3.1, < 7.1)
|
||||
rswag-specs (2.8.0)
|
||||
activesupport (>= 3.1, < 7.1)
|
||||
json-schema (>= 2.2, < 4.0)
|
||||
railties (>= 3.1, < 7.1)
|
||||
rspec-core (>= 2.14)
|
||||
rswag-ui (2.7.0)
|
||||
rswag-ui (2.8.0)
|
||||
actionpack (>= 3.1, < 7.1)
|
||||
railties (>= 3.1, < 7.1)
|
||||
rubocop (1.39.0)
|
||||
@@ -611,7 +611,7 @@ GEM
|
||||
unicode-display_width (>= 1.4.0, < 3.0)
|
||||
rubocop-ast (1.23.0)
|
||||
parser (>= 3.1.1.0)
|
||||
rubocop-rails (2.17.2)
|
||||
rubocop-rails (2.17.3)
|
||||
activesupport (>= 4.2.0)
|
||||
rack (>= 1.1)
|
||||
rubocop (>= 1.33.0, < 2.0)
|
||||
@@ -711,7 +711,7 @@ GEM
|
||||
activemodel (>= 3.0.0)
|
||||
public_suffix
|
||||
vcr (6.1.0)
|
||||
view_component (2.76.0)
|
||||
view_component (2.77.0)
|
||||
activesupport (>= 5.0.0, < 8.0)
|
||||
concurrent-ruby (~> 1.0)
|
||||
method_source (~> 1.0)
|
||||
@@ -818,11 +818,12 @@ DEPENDENCIES
|
||||
json_spec (~> 1.1.4)
|
||||
jsonapi-serializer
|
||||
jwt (~> 2.3)
|
||||
knapsack
|
||||
knapsack_pro
|
||||
letter_opener (>= 1.4.1)
|
||||
listen
|
||||
mime-types
|
||||
mimemagic (> 0.3.5)
|
||||
mini_portile2 (~> 2.8)
|
||||
mini_racer (= 0.4.0)
|
||||
monetize (~> 1.11)
|
||||
oauth2 (~> 1.4.7)
|
||||
|
||||
3
Rakefile
3
Rakefile
@@ -8,6 +8,3 @@ require_relative 'config/application'
|
||||
|
||||
Openfoodnetwork::Application.load_tasks
|
||||
|
||||
if !ENV['DISABLE_KNAPSACK'] && defined?(Knapsack)
|
||||
Knapsack.load_tasks
|
||||
end
|
||||
|
||||
@@ -102,7 +102,6 @@
|
||||
= af.label :latitude, t(:latitude)
|
||||
\/
|
||||
= af.label :longitude, t(:longitude)
|
||||
%span.required *
|
||||
%div{'ofn-with-tip' => t('latitude_longitude_tip')}
|
||||
%a= t('admin.whats_this')
|
||||
.four.columns
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
= af.label :latitude, t(:latitude)
|
||||
\/
|
||||
= af.label :longitude, t(:longitude)
|
||||
%span.required *
|
||||
= render partial: 'admin/shared/tooltip', locals: {tooltip_text: t('latitude_longitude_tip')}
|
||||
.four.columns
|
||||
= af.text_field :latitude, { placeholder: t(:latitude_placeholder) }
|
||||
|
||||
13
bin/knapsack_pro_rspec
Executable file
13
bin/knapsack_pro_rspec
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
if [ "$KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC" = "" ]; then
|
||||
KNAPSACK_PRO_ENDPOINT=https://api-disabled-for-fork.knapsackpro.com \
|
||||
KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC=disabled-for-fork \
|
||||
KNAPSACK_PRO_MAX_REQUEST_RETRIES=0 \
|
||||
bundle exec rake knapsack_pro:rspec # use Regular Mode here always
|
||||
else
|
||||
# Regular Mode
|
||||
bundle exec rake knapsack_pro:rspec
|
||||
|
||||
# or you can use Queue Mode instead of Regular Mode if you like
|
||||
# bundle exec rake knapsack_pro:queue:rspec
|
||||
fi
|
||||
@@ -155,15 +155,17 @@ module Openfoodnetwork
|
||||
|
||||
initializer "ofn.reports" do |app|
|
||||
module ::Reporting; end
|
||||
loader = Zeitwerk::Loader.new
|
||||
loader.push_dir("#{Rails.root}/lib/reporting", namespace: ::Reporting)
|
||||
loader.enable_reloading
|
||||
loader.setup
|
||||
loader.eager_load
|
||||
Rails.application.reloader.to_prepare do
|
||||
loader = Zeitwerk::Loader.new
|
||||
loader.push_dir("#{Rails.root}/lib/reporting", namespace: ::Reporting)
|
||||
loader.enable_reloading
|
||||
loader.setup
|
||||
loader.eager_load
|
||||
|
||||
if Rails.env.development?
|
||||
require 'listen'
|
||||
Listen.to("lib/reporting") { loader.reload }.start
|
||||
if Rails.env.development?
|
||||
require 'listen'
|
||||
Listen.to("lib/reporting") { loader.reload }.start
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -247,5 +249,7 @@ module Openfoodnetwork
|
||||
config.active_storage.variable_content_types += ["image/svg+xml"]
|
||||
|
||||
config.exceptions_app = self.routes
|
||||
|
||||
config.autoloader = :zeitwerk
|
||||
end
|
||||
end
|
||||
|
||||
@@ -30,6 +30,7 @@ en_CA:
|
||||
shipping_category_id: "Shipping Category"
|
||||
variant_unit: "Variant Unit"
|
||||
variant_unit_name: "Variant Unit Name"
|
||||
unit_value: "Unit value"
|
||||
spree/credit_card:
|
||||
base: "Credit Card"
|
||||
number: "Number"
|
||||
@@ -626,6 +627,7 @@ en_CA:
|
||||
conditional_blank: can't be blank if unit_type is blank
|
||||
no_product: did not match any products in the database
|
||||
not_found: not found in database
|
||||
category_not_found: doesn't match allowed categories. See the correct categories to choose from on the product import page, or check that there's no misspelling.
|
||||
not_updatable: cannot be updated on existing products via product import
|
||||
blank: can't be blank
|
||||
products_no_permission: you do not have permission to manage products for this enterprise
|
||||
@@ -882,7 +884,7 @@ en_CA:
|
||||
name: Name
|
||||
name_placeholder: eg. Professor Plum's Biodynamic Truffles
|
||||
groups: Groups
|
||||
groups_tip: Select any markets or groups that you are a member of. This will help customers find your enterprise.
|
||||
groups_tip: Select any markets, networks or groups that you are a member of. This will help customers find your enterprise.
|
||||
groups_placeholder: Start typing to search available markets or groups...
|
||||
primary_producer: Primary Producer?
|
||||
primary_producer_tip: Select 'Producer' if you are a primary producer, grower, maker or designer
|
||||
@@ -1579,7 +1581,7 @@ en_CA:
|
||||
menu_2_url: "/map"
|
||||
menu_3_title: "Producers"
|
||||
menu_3_url: "/producers"
|
||||
menu_4_title: "Markets"
|
||||
menu_4_title: "Networks"
|
||||
menu_4_url: "/groups"
|
||||
menu_5_title: "About"
|
||||
menu_5_url: "https://about.openfoodnetwork.ca"
|
||||
@@ -1641,7 +1643,7 @@ en_CA:
|
||||
label_map: "Map"
|
||||
label_producer: "Producer"
|
||||
label_producers: "Producers"
|
||||
label_groups: "Markets"
|
||||
label_groups: "Networks"
|
||||
label_about: "About"
|
||||
label_blog: "Blog"
|
||||
label_support: "Support"
|
||||
@@ -1980,7 +1982,7 @@ en_CA:
|
||||
shopping_tabs_about: "About"
|
||||
shopping_tabs_producers: "Producers"
|
||||
shopping_tabs_contact: "Contact"
|
||||
shopping_tabs_groups: "Markets"
|
||||
shopping_tabs_groups: "Networks"
|
||||
shopping_contact_address: "Address"
|
||||
shopping_contact_web: "Contact"
|
||||
shopping_contact_social: "Follow"
|
||||
@@ -2045,14 +2047,14 @@ en_CA:
|
||||
components_profiles_show: "Show profiles"
|
||||
components_filters_nofilters: "No filters"
|
||||
components_filters_clearfilters: "Clear all filters"
|
||||
groups_title: Markets
|
||||
groups_headline: 'Markets / Regions '
|
||||
groups_text: "Markets are collectives of producers, hubs and distributors who share something in common like location, farmers market or philosophy. This makes your shopping experience easier. So explore our groups and have the curating done for you."
|
||||
groups_title: Networks
|
||||
groups_headline: 'Networks / Regions '
|
||||
groups_text: "Networks are collectives of producers, hubs and distributors who share something in common like location, farmers market or philosophy. This makes your shopping experience easier. So explore our networks and have the curating done for you."
|
||||
groups_search: "Search name or keyword"
|
||||
groups_no_groups: "No groups found"
|
||||
groups_about: "About Us"
|
||||
groups_producers: "Our vendors"
|
||||
groups_hubs: "Go Shopping!"
|
||||
groups_producers: "Members"
|
||||
groups_hubs: "Go Shopping"
|
||||
groups_contact_web: Contact
|
||||
groups_contact_social: Follow
|
||||
groups_contact_address: Address
|
||||
|
||||
@@ -627,6 +627,7 @@ en_FR:
|
||||
conditional_blank: can't be blank if unit_type is blank
|
||||
no_product: did not match any products in the database
|
||||
not_found: not found in database
|
||||
category_not_found: doesn't match allowed categories. See the correct categories to choose from on the product import page, or check that there's no misspelling.
|
||||
not_updatable: cannot be updated on existing products via product import
|
||||
blank: can't be blank
|
||||
products_no_permission: you do not have permission to manage products for this enterprise
|
||||
|
||||
@@ -627,6 +627,7 @@ fr:
|
||||
conditional_blank: ne peut pas être vide si unit_type est vide
|
||||
no_product: n'a pu être associé à aucun produit existant dans la base de données
|
||||
not_found: non trouvé dans le base de données
|
||||
category_not_found: n'est pas conforme aux catégories utilisées. Merci de modifier les catégories en utilisant celles listées sur la page d'import ou vérifier qu'il n'y ait pas de faute de frappe ou d'espace à fin du mot.
|
||||
not_updatable: ne peut pas être mis à jour pour des produits existants via la fonctionnalité d'import de fichier produits
|
||||
blank: Champ obligatoire
|
||||
products_no_permission: vous n'avez pas l'autorisation de gérer les produits de cette entreprise
|
||||
|
||||
@@ -30,6 +30,7 @@ fr_CA:
|
||||
shipping_category_id: "Condition de transport"
|
||||
variant_unit: "Unité"
|
||||
variant_unit_name: "Unité de la variante"
|
||||
unit_value: "Nb unités"
|
||||
spree/credit_card:
|
||||
base: "Carte de crédit"
|
||||
number: "N° commande"
|
||||
@@ -627,6 +628,7 @@ fr_CA:
|
||||
conditional_blank: Champ obligatoire si le type d'unité est vide
|
||||
no_product: 'aucun produit trouvé '
|
||||
not_found: n'a pas été trouvé dans la base de donnée
|
||||
category_not_found: n'est pas conforme aux catégories utilisées. Merci de modifier les catégories en utilisant celles listées sur la page d'import ou vérifier qu'il n'y ait pas de faute de frappe ou d'espace à fin du mot.
|
||||
not_updatable: ne peut pas être mis à jour pour des produits existants via la fonctionnalité d'import de fichier produits
|
||||
blank: Champ obligatoire
|
||||
products_no_permission: vous n'avez pas les droits requis pour gérer les produits de cette entreprise
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
ActiveRecord::Schema.define(version: 2022_10_07_105052) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pg_stat_statements"
|
||||
enable_extension "plpgsql"
|
||||
|
||||
create_table "active_storage_attachments", force: :cascade do |t|
|
||||
|
||||
@@ -24,12 +24,15 @@ Shoulda::Matchers.configure do |config|
|
||||
end
|
||||
end
|
||||
|
||||
require 'knapsack_pro'
|
||||
KnapsackPro::Adapters::RSpecAdapter.bind
|
||||
|
||||
# Allow connections to selenium whilst raising errors when connecting to external sites
|
||||
require 'webmock/rspec'
|
||||
WebMock.enable!
|
||||
WebMock.disable_net_connect!(
|
||||
allow_localhost: true,
|
||||
allow: 'chromedriver.storage.googleapis.com'
|
||||
allow: ['chromedriver.storage.googleapis.com', 'api.knapsackpro.com']
|
||||
)
|
||||
|
||||
# Requires supporting ruby files with custom matchers and macros, etc,
|
||||
|
||||
51
spec/performance/shop_controller_spec.rb
Normal file
51
spec/performance/shop_controller_spec.rb
Normal file
@@ -0,0 +1,51 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
xdescribe ShopController, type: :controller, performance: true do
|
||||
include FileHelper
|
||||
|
||||
let(:d) { create(:distributor_enterprise) }
|
||||
let(:enterprise_fee) { create(:enterprise_fee) }
|
||||
let(:order_cycle) {
|
||||
create(:simple_order_cycle, distributors: [d], coordinator_fees: [enterprise_fee])
|
||||
}
|
||||
|
||||
before do
|
||||
allow(controller).to receive(:current_distributor) { d }
|
||||
allow(controller).to receive(:current_order_cycle) { order_cycle }
|
||||
Spree::Config.currency = 'AUD'
|
||||
end
|
||||
|
||||
describe "fetching products" do
|
||||
let(:exchange) { order_cycle.exchanges.to_enterprises(d).outgoing.first }
|
||||
let(:image) { white_logo_file }
|
||||
let(:cache_key_patterns) do
|
||||
[
|
||||
'api\/taxon_serializer\/spree\/taxons',
|
||||
'enterprise'
|
||||
]
|
||||
end
|
||||
|
||||
before do
|
||||
11.times do
|
||||
p = create(:simple_product)
|
||||
p.set_property 'Organic Certified', 'NASAA 12345'
|
||||
v1 = create(:variant, product: p)
|
||||
v2 = create(:variant, product: p)
|
||||
Spree::Image.create! viewable_id: p.master.id, viewable_type: 'Spree::Variant',
|
||||
attachment: image
|
||||
|
||||
exchange.variants << [v1, v2]
|
||||
end
|
||||
end
|
||||
|
||||
it "returns products via json" do
|
||||
pending("fixing failing performance specs")
|
||||
results = multi_benchmark(3, cache_key_patterns: cache_key_patterns) do
|
||||
get :products, xhr: true
|
||||
expect(response.status).to eq 200
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -5,14 +5,6 @@ require 'base_spec_helper'
|
||||
require 'database_cleaner'
|
||||
require 'view_component/test_helpers'
|
||||
|
||||
# This spec_helper.rb is being used by the custom engines in engines/. The engines are not set up to
|
||||
# use Knapsack, and this provides the option to disable it when running the tests in CI services.
|
||||
unless ENV['DISABLE_KNAPSACK']
|
||||
require 'knapsack'
|
||||
Knapsack.tracker.config(enable_time_offset_warning: false) unless ENV['CI']
|
||||
Knapsack::Adapters::RSpecAdapter.bind
|
||||
end
|
||||
|
||||
Capybara.javascript_driver = :chrome
|
||||
Capybara.default_max_wait_time = 30
|
||||
Capybara.disable_animation = true
|
||||
|
||||
@@ -9,4 +9,5 @@ VCR.configure do |config|
|
||||
config.configure_rspec_metadata!
|
||||
config.filter_sensitive_data('<HIDDEN_KEY>') { ENV['STRIPE_SECRET_TEST_API_KEY'] }
|
||||
config.filter_sensitive_data('<HIDDEN_CUSTOMER>') { ENV['STRIPE_CUSTOMER'] }
|
||||
config.ignore_hosts('localhost', '127.0.0.1', '0.0.0.0', 'api.knapsackpro.com')
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user