diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d6662c6..23ab831 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,6 +23,14 @@ jobs: uses: ruby/setup-ruby@v1 with: ruby-version: 3.0.0 + - name: Set up Node + uses: actions/setup-node@v2 + with: + node-version: 16.18.1 + - name: Install and Activate Yarn + run: | + npm install -g yarn + yarn set version 1.22.19 - name: Run the default task env: PGHOST: localhost @@ -33,6 +41,7 @@ jobs: sudo apt-get -yqq install libpq-dev gem install bundler -v 2.2.29 bundle install + cp config/database.yml.sample config/database.yml bundle exec rails db:create bundle exec rails db:migrate bundle exec rails db:seed diff --git a/Gemfile b/Gemfile index 4d50cbb..a345db1 100644 --- a/Gemfile +++ b/Gemfile @@ -3,6 +3,8 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby '3.0.0' +gem 'factory_bot_rails' +gem 'ffaker' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 6.0.4', '>= 6.0.4.8' # Use postgresql as the database for Active Record @@ -35,8 +37,6 @@ group :development, :test do gem 'byebug', platforms: %i[mri mingw x64_mingw] gem 'pry-byebug' gem 'rspec-rails' - gem 'ffaker' - gem 'factory_bot_rails' gem 'solargraph' end diff --git a/Gemfile.lock b/Gemfile.lock index 3c55e16..9045510 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -9,100 +9,97 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (6.0.4.8) - actionpack (= 6.0.4.8) + actioncable (6.0.6.1) + actionpack (= 6.0.6.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.0.4.8) - actionpack (= 6.0.4.8) - activejob (= 6.0.4.8) - activerecord (= 6.0.4.8) - activestorage (= 6.0.4.8) - activesupport (= 6.0.4.8) + actionmailbox (6.0.6.1) + actionpack (= 6.0.6.1) + activejob (= 6.0.6.1) + activerecord (= 6.0.6.1) + activestorage (= 6.0.6.1) + activesupport (= 6.0.6.1) mail (>= 2.7.1) - actionmailer (6.0.4.8) - actionpack (= 6.0.4.8) - actionview (= 6.0.4.8) - activejob (= 6.0.4.8) + actionmailer (6.0.6.1) + actionpack (= 6.0.6.1) + actionview (= 6.0.6.1) + activejob (= 6.0.6.1) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.0.4.8) - actionview (= 6.0.4.8) - activesupport (= 6.0.4.8) + actionpack (6.0.6.1) + actionview (= 6.0.6.1) + activesupport (= 6.0.6.1) rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.0.4.8) - actionpack (= 6.0.4.8) - activerecord (= 6.0.4.8) - activestorage (= 6.0.4.8) - activesupport (= 6.0.4.8) + actiontext (6.0.6.1) + actionpack (= 6.0.6.1) + activerecord (= 6.0.6.1) + activestorage (= 6.0.6.1) + activesupport (= 6.0.6.1) nokogiri (>= 1.8.5) - actionview (6.0.4.8) - activesupport (= 6.0.4.8) + actionview (6.0.6.1) + activesupport (= 6.0.6.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.0.4.8) - activesupport (= 6.0.4.8) + activejob (6.0.6.1) + activesupport (= 6.0.6.1) globalid (>= 0.3.6) - activemodel (6.0.4.8) - activesupport (= 6.0.4.8) - activerecord (6.0.4.8) - activemodel (= 6.0.4.8) - activesupport (= 6.0.4.8) - activestorage (6.0.4.8) - actionpack (= 6.0.4.8) - activejob (= 6.0.4.8) - activerecord (= 6.0.4.8) - marcel (~> 1.0.0) - activesupport (6.0.4.8) + activemodel (6.0.6.1) + activesupport (= 6.0.6.1) + activerecord (6.0.6.1) + activemodel (= 6.0.6.1) + activesupport (= 6.0.6.1) + activestorage (6.0.6.1) + actionpack (= 6.0.6.1) + activejob (= 6.0.6.1) + activerecord (= 6.0.6.1) + marcel (~> 1.0) + activesupport (6.0.6.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) zeitwerk (~> 2.2, >= 2.2.2) - acts_as_tenant (0.5.1) - rails (>= 5.2) - request_store (>= 1.0.5) - addressable (2.8.0) - public_suffix (>= 2.0.2, < 5.0) + acts_as_tenant (1.0.1) + rails (>= 6.0) + addressable (2.8.6) + public_suffix (>= 2.0.2, < 6.0) ast (2.4.2) - aws-eventstream (1.2.0) - aws-partitions (1.573.0) - aws-sdk-core (3.130.0) - aws-eventstream (~> 1, >= 1.0.2) - aws-partitions (~> 1, >= 1.525.0) + aws-eventstream (1.3.0) + aws-partitions (1.883.0) + aws-sdk-core (3.190.3) + aws-eventstream (~> 1, >= 1.3.0) + aws-partitions (~> 1, >= 1.651.0) + aws-sigv4 (~> 1.8) + jmespath (~> 1, >= 1.6.1) + aws-sdk-kms (1.76.0) + aws-sdk-core (~> 3, >= 3.188.0) aws-sigv4 (~> 1.1) - jmespath (~> 1.0) - aws-sdk-kms (1.55.0) - aws-sdk-core (~> 3, >= 3.127.0) - aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.113.0) - aws-sdk-core (~> 3, >= 3.127.0) + aws-sdk-s3 (1.142.0) + aws-sdk-core (~> 3, >= 3.189.0) aws-sdk-kms (~> 1) - aws-sigv4 (~> 1.4) - aws-sigv4 (1.4.0) + aws-sigv4 (~> 1.8) + aws-sigv4 (1.8.0) aws-eventstream (~> 1, >= 1.0.2) axiom-types (0.1.1) descendants_tracker (~> 0.0.4) ice_nine (~> 0.11.0) thread_safe (~> 0.3, >= 0.3.1) - axlsx_styler (1.1.0) - activesupport (>= 3.1) - caxlsx (>= 2.0.2) backport (1.2.0) - bcrypt (3.1.17) - benchmark (0.2.0) + bcrypt (3.1.20) + benchmark (0.3.0) + bigdecimal (3.1.6) bindex (0.8.1) - bootsnap (1.11.1) + bootsnap (1.17.1) msgpack (~> 1.2) builder (3.2.4) business (2.3.0) byebug (11.1.3) - capybara (3.36.0) + capybara (3.39.2) addressable matrix mini_mime (>= 0.1.3) @@ -111,23 +108,23 @@ GEM rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) - caxlsx (3.2.0) + caxlsx (3.4.1) htmlentities (~> 4.3, >= 4.3.4) marcel (~> 1.0) nokogiri (~> 1.10, >= 1.10.4) rubyzip (>= 1.3.0, < 3) - childprocess (4.1.0) chunky_png (1.4.0) cocoon (1.2.15) coderay (1.1.3) coercible (1.0.0) descendants_tracker (~> 0.0.1) - concurrent-ruby (1.1.10) - connection_pool (2.2.5) + concurrent-ruby (1.2.3) + connection_pool (2.4.1) crass (1.0.6) + date (3.3.4) descendants_tracker (0.0.4) thread_safe (~> 0.3, >= 0.3.1) - devise (4.8.1) + devise (4.9.3) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) @@ -135,174 +132,213 @@ GEM warden (~> 1.2.3) diff-lcs (1.5.0) docile (1.4.0) + dry-configurable (1.1.0) + dry-core (~> 1.0, < 2) + zeitwerk (~> 2.6) + dry-core (1.0.1) + concurrent-ruby (~> 1.0) + zeitwerk (~> 2.6) + dry-inflector (1.0.0) + dry-initializer (3.1.1) + dry-logic (1.5.0) + concurrent-ruby (~> 1.0) + dry-core (~> 1.0, < 2) + zeitwerk (~> 2.6) + dry-schema (1.13.3) + concurrent-ruby (~> 1.0) + dry-configurable (~> 1.0, >= 1.0.1) + dry-core (~> 1.0, < 2) + dry-initializer (~> 3.0) + dry-logic (>= 1.4, < 2) + dry-types (>= 1.7, < 2) + zeitwerk (~> 2.6) + dry-types (1.7.2) + bigdecimal (~> 3.0) + concurrent-ruby (~> 1.0) + dry-core (~> 1.0) + dry-inflector (~> 1.0) + dry-logic (~> 1.4) + zeitwerk (~> 2.6) e2mmap (0.1.0) - equalizer (0.0.11) - erubi (1.10.0) - erubis (2.7.0) - factory_bot (6.2.1) + erubi (1.12.0) + factory_bot (6.4.5) activesupport (>= 5.0.0) - factory_bot_rails (6.2.0) - factory_bot (~> 6.2.0) + factory_bot_rails (6.4.3) + factory_bot (~> 6.4) railties (>= 5.0.0) - ffaker (2.20.0) - ffi (1.15.5) - flay (2.12.1) - erubis (~> 2.7.0) + ffaker (2.23.0) + ffi (1.16.3) + flay (2.13.1) + erubi (~> 1.10) path_expander (~> 1.0) ruby_parser (~> 3.0) sexp_processor (~> 4.0) - flog (4.6.4) + flog (4.8.0) path_expander (~> 1.0) ruby_parser (~> 3.1, > 3.1.0) sexp_processor (~> 4.8) - geared_pagination (1.1.1) + geared_pagination (1.2.0) activesupport (>= 5.0) addressable (>= 2.5.0) - globalid (1.0.0) + globalid (1.1.0) activesupport (>= 5.0) htmlentities (4.3.4) - httparty (0.20.0) - mime-types (~> 3.0) + httparty (0.21.0) + mini_mime (>= 1.0.0) multi_xml (>= 0.5.2) - i18n (1.10.0) + i18n (1.14.1) concurrent-ruby (~> 1.0) ice_nine (0.11.2) - jaro_winkler (1.5.4) + jaro_winkler (1.5.6) jbuilder (2.11.5) actionview (>= 5.0.0) activesupport (>= 5.0.0) - jmespath (1.6.1) - jquery-rails (4.4.0) + jmespath (1.6.2) + jquery-rails (4.6.0) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) + json (2.7.1) jsonapi-serializer (2.2.0) activesupport (>= 4.2) - kramdown (2.3.2) + kramdown (2.4.0) rexml kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) - kwalify (0.7.2) - launchy (2.5.0) - addressable (~> 2.7) - listen (3.7.1) + language_server-protocol (3.17.0.3) + launchy (2.5.2) + addressable (~> 2.8) + listen (3.8.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - loofah (2.17.0) + loofah (2.22.0) crass (~> 1.0.2) - nokogiri (>= 1.5.9) - mail (2.7.1) + nokogiri (>= 1.12.0) + mail (2.8.1) mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp marcel (1.0.2) matrix (0.4.2) method_source (1.0.0) - mime-types (3.4.1) - mime-types-data (~> 3.2015) - mime-types-data (3.2022.0105) - mini_mime (1.1.2) - minitest (5.15.0) - msgpack (1.4.5) + mini_mime (1.1.5) + minitest (5.21.2) + msgpack (1.7.2) multi_xml (0.6.0) - nio4r (2.5.8) - nokogiri (1.13.4-x86_64-darwin) - racc (~> 1.4) - nokogiri (1.13.4-x86_64-linux) + net-imap (0.4.9.1) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.2) + timeout + net-smtp (0.4.0.1) + net-protocol + nio4r (2.7.0) + nokogiri (1.16.0-x86_64-linux) racc (~> 1.4) orm_adapter (0.5.0) pagy (3.11.0) - parallel (1.22.1) - parser (3.1.1.0) + parallel (1.24.0) + parser (3.2.2.4) ast (~> 2.4.1) - path_expander (1.1.0) - pg (1.3.5) + racc + path_expander (1.1.1) + pg (1.5.4) platform_agent (1.0.1) activesupport (>= 5.2.0) useragent (~> 0.16.3) - pry (0.13.1) + pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - pry-byebug (3.9.0) + pry-byebug (3.10.1) byebug (~> 11.0) - pry (~> 0.13.0) - public_suffix (4.0.6) + pry (>= 0.13, < 0.15) + public_suffix (5.0.4) puma (4.3.12) nio4r (~> 2.0) - racc (1.6.0) - rack (2.2.3) - rack-cors (1.1.1) + racc (1.7.3) + rack (2.2.8) + rack-cors (2.0.1) rack (>= 2.0.0) - rack-proxy (0.7.2) + rack-proxy (0.7.7) rack rack-ratelimit (1.2.1) - rack-test (1.1.0) - rack (>= 1.0, < 3) - rack-timeout (0.6.0) - rails (6.0.4.8) - actioncable (= 6.0.4.8) - actionmailbox (= 6.0.4.8) - actionmailer (= 6.0.4.8) - actionpack (= 6.0.4.8) - actiontext (= 6.0.4.8) - actionview (= 6.0.4.8) - activejob (= 6.0.4.8) - activemodel (= 6.0.4.8) - activerecord (= 6.0.4.8) - activestorage (= 6.0.4.8) - activesupport (= 6.0.4.8) + rack-test (2.1.0) + rack (>= 1.3) + rack-timeout (0.6.3) + rails (6.0.6.1) + actioncable (= 6.0.6.1) + actionmailbox (= 6.0.6.1) + actionmailer (= 6.0.6.1) + actionpack (= 6.0.6.1) + actiontext (= 6.0.6.1) + actionview (= 6.0.6.1) + activejob (= 6.0.6.1) + activemodel (= 6.0.6.1) + activerecord (= 6.0.6.1) + activestorage (= 6.0.6.1) + activesupport (= 6.0.6.1) bundler (>= 1.3.0) - railties (= 6.0.4.8) + railties (= 6.0.6.1) sprockets-rails (>= 2.0.0) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.4.2) - loofah (~> 2.3) + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) rails-i18n (6.0.0) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 7) - railties (6.0.4.8) - actionpack (= 6.0.4.8) - activesupport (= 6.0.4.8) + railties (6.0.6.1) + actionpack (= 6.0.6.1) + activesupport (= 6.0.6.1) method_source rake (>= 0.8.7) thor (>= 0.20.3, < 2.0) rainbow (3.1.1) - rake (13.0.6) - ransack (3.0.0) + rake (13.1.0) + ransack (3.1.0) activerecord (>= 6.0.4) activesupport (>= 6.0.4) i18n - rb-fsevent (0.11.1) + rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) - redis (4.6.0) - reek (6.1.0) - kwalify (~> 0.7.0) - parser (~> 3.1.0) + rbs (2.8.4) + redis (5.0.8) + redis-client (>= 0.17.0) + redis-client (0.19.1) + connection_pool + reek (6.2.0) + dry-schema (~> 1.13.0) + parser (~> 3.2.0) rainbow (>= 2.0, < 4.0) - regexp_parser (2.2.1) - request_store (1.5.1) - rack (>= 1.4) - responders (3.0.1) - actionpack (>= 5.0) - railties (>= 5.0) + rexml (~> 3.1) + regexp_parser (2.9.0) + responders (3.1.1) + actionpack (>= 5.2) + railties (>= 5.2) reverse_markdown (2.1.1) nokogiri - rexml (3.2.5) + rexml (3.2.6) rodf (1.2.0) builder (>= 3.0) rubyzip (>= 1.0) rqrcode (0.10.1) chunky_png (~> 1.0) - rspec-core (3.11.0) - rspec-support (~> 3.11.0) - rspec-expectations (3.11.0) + rspec-core (3.12.2) + rspec-support (~> 3.12.0) + rspec-expectations (3.12.3) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.11.0) - rspec-mocks (3.11.1) + rspec-support (~> 3.12.0) + rspec-mocks (3.12.6) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.11.0) - rspec-rails (5.1.1) + rspec-support (~> 3.12.0) + rspec-rails (5.1.2) actionpack (>= 5.2) activesupport (>= 5.2) railties (>= 5.2) @@ -310,32 +346,36 @@ GEM rspec-expectations (~> 3.10) rspec-mocks (~> 3.10) rspec-support (~> 3.10) - rspec-support (3.11.0) - rubocop (1.26.1) + rspec-support (3.12.1) + rubocop (1.59.0) + json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.1.0.0) + parser (>= 3.2.2.4) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) - rexml - rubocop-ast (>= 1.16.0, < 2.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.30.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.16.0) - parser (>= 3.1.1.0) - ruby-progressbar (1.11.0) - ruby_parser (3.19.0) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.30.0) + parser (>= 3.2.1.0) + ruby-progressbar (1.13.0) + ruby_parser (3.21.0) + racc (~> 1.5) sexp_processor (~> 4.16) - rubycritic (4.6.1) - flay (~> 2.8) - flog (~> 4.4) - launchy (>= 2.0.0) - parser (>= 2.6.0) - rainbow (~> 3.0) + rubycritic (4.9.0) + flay (~> 2.13) + flog (~> 4.7) + launchy (>= 2.5.2) + parser (>= 3.2.2.1) + rainbow (~> 3.1.1) reek (~> 6.0, < 7.0) - ruby_parser (~> 3.8) - simplecov (>= 0.17.0) - tty-which (~> 0.4.0) - virtus (~> 1.0) + rexml + ruby_parser (~> 3.20) + simplecov (>= 0.22.0) + tty-which (~> 0.5.0) + virtus (~> 2.0) rubyzip (2.3.2) sass-rails (6.0.0) sassc-rails (~> 2.1, >= 2.1.1) @@ -347,96 +387,94 @@ GEM sprockets (> 3.0) sprockets-rails tilt - selenium-webdriver (4.1.0) - childprocess (>= 0.5, < 5.0) + selenium-webdriver (4.10.0) rexml (~> 3.2, >= 3.2.5) - rubyzip (>= 1.2.2) + rubyzip (>= 1.2.2, < 3.0) + websocket (~> 1.0) serviceworker-rails (0.6.0) railties (>= 3.1) - sexp_processor (4.16.0) - shoulda-matchers (5.1.0) + sexp_processor (4.17.1) + shoulda-matchers (5.3.0) activesupport (>= 5.2.0) - sidekiq (6.4.1) - connection_pool (>= 2.2.2) - rack (~> 2.0) - redis (>= 4.2.0) - simplecov (0.21.2) + sidekiq (7.2.1) + concurrent-ruby (< 2) + connection_pool (>= 2.3.0) + rack (>= 2.2.4) + redis-client (>= 0.19.0) + simplecov (0.22.0) docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) simplecov-html (0.12.3) simplecov_json_formatter (0.1.4) - solargraph (0.44.3) + solargraph (0.50.0) backport (~> 1.2) benchmark - bundler (>= 1.17.2) + bundler (~> 2.0) diff-lcs (~> 1.4) e2mmap jaro_winkler (~> 1.5) kramdown (~> 2.3) kramdown-parser-gfm (~> 1.1) parser (~> 3.0) - reverse_markdown (>= 1.0.5, < 3) - rubocop (>= 0.52) + rbs (~> 2.0) + reverse_markdown (~> 2.0) + rubocop (~> 1.38) thor (~> 1.0) tilt (~> 2.0) yard (~> 0.9, >= 0.9.24) - spreadsheet_architect (4.2.0) - axlsx_styler (>= 1.0.0, < 2) - caxlsx (>= 2.0.2, < 4) + spreadsheet_architect (5.0.0) + caxlsx (>= 3.3.0, < 4) rodf (>= 1.0.0, < 2) spring (2.1.1) spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) spring (>= 1.2, < 3.0) - sprockets (4.0.3) + sprockets (4.2.1) concurrent-ruby (~> 1.0) - rack (> 1, < 3) + rack (>= 2.2.4, < 4) sprockets-rails (3.4.2) actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) - thor (1.2.1) + thor (1.3.0) thread_safe (0.3.6) - tilt (2.0.10) - tty-which (0.4.2) - tzinfo (1.2.9) + tilt (2.3.0) + timeout (0.4.1) + tty-which (0.5.0) + tzinfo (1.2.11) thread_safe (~> 0.1) - unicode-display_width (2.1.0) + unicode-display_width (2.5.0) useragent (0.16.10) - virtus (1.0.5) + virtus (2.0.0) axiom-types (~> 0.1) coercible (~> 1.0) descendants_tracker (~> 0.0, >= 0.0.3) - equalizer (~> 0.0, >= 0.0.9) warden (1.2.9) rack (>= 2.0.9) - web-console (4.2.0) + web-console (4.2.1) actionview (>= 6.0.0) activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webdrivers (5.0.0) + webdrivers (5.3.1) nokogiri (~> 1.6) rubyzip (>= 1.3.0) - selenium-webdriver (~> 4.0) + selenium-webdriver (~> 4.0, < 4.11) webpacker (4.3.0) activesupport (>= 4.2) rack-proxy (>= 0.6.1) railties (>= 4.2) - webrick (1.7.0) - websocket-driver (0.7.5) + websocket (1.2.10) + websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - yard (0.9.27) - webrick (~> 1.7.0) - zeitwerk (2.5.4) + yard (0.9.34) + zeitwerk (2.6.12) PLATFORMS - x86_64-darwin-19 - x86_64-darwin-20 x86_64-linux DEPENDENCIES @@ -489,4 +527,4 @@ RUBY VERSION ruby 3.0.0p0 BUNDLED WITH - 2.3.12 + 2.2.3 diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..528ca4b --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: bundle exec puma -C config/puma.rb \ No newline at end of file diff --git a/app/models/product.rb b/app/models/product.rb index 990dcdd..2e02e08 100644 --- a/app/models/product.rb +++ b/app/models/product.rb @@ -2,7 +2,7 @@ class Product < ApplicationRecord acts_as_tenant :account - belongs_to :category + belongs_to :category, optional: true has_many :purchase_products has_many :sale_products has_many :group_products diff --git a/app/serializers/product_serializer.rb b/app/serializers/product_serializer.rb index 06e33ed..d7baac6 100644 --- a/app/serializers/product_serializer.rb +++ b/app/serializers/product_serializer.rb @@ -16,7 +16,7 @@ class ProductSerializer end attribute :category do |object| - object.category.name + object.category.try(:name) end attribute :image_url do |object| diff --git a/app/views/products/show.html.erb b/app/views/products/show.html.erb index 5a18b2b..c695776 100644 --- a/app/views/products/show.html.erb +++ b/app/views/products/show.html.erb @@ -26,7 +26,7 @@
<%= t('products.highlight') %>:
<%= @product.highlight %>
<%= t('products.category') %>:
-
<%= @product.category.name %>
+
<%= @product.category.try(:name) %>
<%= t('products.active') %>:
<%= @product.active %>
diff --git a/config/database.yml.sample b/config/database.yml.sample new file mode 100644 index 0000000..036e316 --- /dev/null +++ b/config/database.yml.sample @@ -0,0 +1,20 @@ +default: &default + adapter: postgresql + encoding: unicode + pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> + username: <%= ENV['PGUSER'] %> + password: <%= ENV['PGPASSWORD'] %> + +development: + <<: *default + database: open_stock_development + +test: + <<: *default + database: open_stock_test + +production: + <<: *default + database: open_stock_production + username: <%= ENV['OPEN_STOCK_DATABASE_USERNAME'] %> + password: <%= ENV['OPEN_STOCK_DATABASE_PASSWORD'] %> \ No newline at end of file diff --git a/package.json b/package.json index ab138da..946110d 100644 --- a/package.json +++ b/package.json @@ -23,5 +23,9 @@ "version": "0.1.0", "devDependencies": { "webpack-dev-server": "^4.7.4" + }, + "engines": { + "node": "16.18.1", + "yarn": "1.22.19" } } diff --git a/spec/factories/products.rb b/spec/factories/products.rb index 12a8385..3898f96 100644 --- a/spec/factories/products.rb +++ b/spec/factories/products.rb @@ -9,8 +9,5 @@ image { FactoryHelpers.upload_file('spec/support/images/sem_imagem.jpeg', 'image/jpeg', true) } price { rand(100..400) } active { true } - - account_id { create(:account).id } - category_id { create(:category, account_id: account_id).id } end end diff --git a/spec/models/product_spec.rb b/spec/models/product_spec.rb index d48916c..3edbec3 100644 --- a/spec/models/product_spec.rb +++ b/spec/models/product_spec.rb @@ -4,7 +4,7 @@ it { should have_many(:group_products) } it { should have_many(:simplo_items) } it { should have_many(:sale_products) } - it { should belong_to(:category) } + it { should belong_to(:category).without_validating_presence } it { should validate_presence_of(:name) } end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index a76ca89..b0e7377 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -67,4 +67,6 @@ # arbitrary gems may also be filtered via: # config.filter_gems_from_backtrace("gem name") config.include FactoryBot::Syntax::Methods + config.include Devise::Test::ControllerHelpers, type: :controller + config.include Devise::Test::IntegrationHelpers, type: :request end diff --git a/spec/requests/products_spec.rb b/spec/requests/products_spec.rb index 664cc06..e5091bb 100644 --- a/spec/requests/products_spec.rb +++ b/spec/requests/products_spec.rb @@ -1,6 +1,31 @@ require 'rails_helper' -RSpec.describe 'Product' do +RSpec.describe 'Product', type: :request do + let!(:account) { create(:account) } + let(:valid_params) { { product: { name: FFaker.name } } } + + before { sign_in account.user } + + describe 'POST /product' do + it 'counts by 1' do + expect do + post products_path, params: valid_params + end.to change(Product, :count).by(1) + end + end + + describe 'GET /product' do + context 'when category is blank' do + let!(:product) { FactoryBot.create(:product, account_id: account.id, category: nil) } + + it 'shows' do + get product_path(product) + + expect(response).to be_successful + end + end + end + describe 'GET /products_defer' do let!(:account) { create(:account) } let(:url) { '/products_defer' } diff --git a/yarn.lock b/yarn.lock index 540ba2e..69393d3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1058,10 +1058,10 @@ resolved "https://registry.yarnpkg.com/@rails/actioncable/-/actioncable-6.1.5.tgz#c24ec8123a8e7e239ceabda29078df9c93752394" integrity sha512-bV4/Q7NweGFm7t3GvUFm19UF2WKmcvlOXy7AxMWEZCwDxQLagAXhUpKb1AJ6Rg88cPHqXSQHaGKr84lIMd607A== -"@rails/activestorage@^6.1.5": - version "6.1.5" - resolved "https://registry.yarnpkg.com/@rails/activestorage/-/activestorage-6.1.5.tgz#a43929573b2ffae54857ffa3b7ac1988af42b681" - integrity sha512-7L0eWqrguZIyvfPOpVoZRChuIgxbpBdwdVtprT6wrl5rUAbdyHr6AZczl1yS+5d6nBV0TqpVLaB1sGxi2aMbCQ== +"@rails/activestorage@^6.0.0": + version "6.1.7" + resolved "https://registry.yarnpkg.com/@rails/activestorage/-/activestorage-6.1.7.tgz#5aaae9f4d10800fdb4fd6fe26fd8b4218579c6e3" + integrity sha512-h++k8LBLns4O8AqzdaFp1TsCLP9VSc2hgWI37bjzJ+4D995X7Rd8kdkRmXRaNAUlHDJgy6RpnbhBJ5oiIgWTDw== dependencies: spark-md5 "^3.0.0"