From 31cdbc0744bbfc663ce502ca1d8623e0345f20b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20S=C3=A4lgstr=C3=B6m=20Peterson?= Date: Mon, 25 Mar 2019 11:32:45 -0400 Subject: [PATCH 01/21] Update dependencies --- Gemfile.lock | 156 +++++++++++++++++++++++++-------------------------- 1 file changed, 77 insertions(+), 79 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 6695f5b..2ce8167 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,112 +7,110 @@ PATH GEM remote: http://rubygems.org/ specs: - actioncable (5.0.0.beta3) - actionpack (= 5.0.0.beta3) - nio4r (~> 1.2) + actioncable (5.0.7.2) + actionpack (= 5.0.7.2) + nio4r (>= 1.2, < 3.0) websocket-driver (~> 0.6.1) - actionmailer (5.0.0.beta3) - actionpack (= 5.0.0.beta3) - actionview (= 5.0.0.beta3) - activejob (= 5.0.0.beta3) + actionmailer (5.0.7.2) + actionpack (= 5.0.7.2) + actionview (= 5.0.7.2) + activejob (= 5.0.7.2) mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (5.0.0.beta3) - actionview (= 5.0.0.beta3) - activesupport (= 5.0.0.beta3) - rack (~> 2.x) + rails-dom-testing (~> 2.0) + actionpack (5.0.7.2) + actionview (= 5.0.7.2) + activesupport (= 5.0.7.2) + rack (~> 2.0) rack-test (~> 0.6.3) - rails-dom-testing (~> 1.0, >= 1.0.5) + rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.0.0.beta3) - activesupport (= 5.0.0.beta3) + actionview (5.0.7.2) + activesupport (= 5.0.7.2) builder (~> 3.1) erubis (~> 2.7.0) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - activejob (5.0.0.beta3) - activesupport (= 5.0.0.beta3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activejob (5.0.7.2) + activesupport (= 5.0.7.2) globalid (>= 0.3.6) - activemodel (5.0.0.beta3) - activesupport (= 5.0.0.beta3) - activerecord (5.0.0.beta3) - activemodel (= 5.0.0.beta3) - activesupport (= 5.0.0.beta3) + activemodel (5.0.7.2) + activesupport (= 5.0.7.2) + activerecord (5.0.7.2) + activemodel (= 5.0.7.2) + activesupport (= 5.0.7.2) arel (~> 7.0) - activesupport (5.0.0.beta3) - concurrent-ruby (~> 1.0) - i18n (~> 0.7) + activesupport (5.0.7.2) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) - arel (7.0.0) - builder (3.2.2) - concurrent-ruby (1.0.1) + arel (7.1.4) + builder (3.2.3) + concurrent-ruby (1.1.5) + crass (1.0.4) erubis (2.7.0) - globalid (0.3.6) - activesupport (>= 4.1.0) - i18n (0.7.0) - jquery-rails (4.1.1) + globalid (0.4.2) + activesupport (>= 4.2.0) + i18n (1.6.0) + concurrent-ruby (~> 1.0) + jquery-rails (4.3.3) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - json (1.8.3) - loofah (2.0.3) + loofah (2.2.3) + crass (~> 1.0.2) nokogiri (>= 1.5.9) - mail (2.6.3) - mime-types (>= 1.16, < 3) - method_source (0.8.2) - mime-types (2.99.1) - mini_portile2 (2.0.0) - minitest (5.8.4) - nio4r (1.2.1) - nokogiri (1.6.7.2) - mini_portile2 (~> 2.0.0.rc2) - rack (2.0.0.alpha) - json + mail (2.7.1) + mini_mime (>= 0.1.1) + method_source (0.9.2) + mini_mime (1.0.1) + mini_portile2 (2.4.0) + minitest (5.11.3) + nio4r (2.3.1) + nokogiri (1.10.2) + mini_portile2 (~> 2.4.0) + rack (2.0.6) rack-test (0.6.3) rack (>= 1.0) - rails (5.0.0.beta3) - actioncable (= 5.0.0.beta3) - actionmailer (= 5.0.0.beta3) - actionpack (= 5.0.0.beta3) - actionview (= 5.0.0.beta3) - activejob (= 5.0.0.beta3) - activemodel (= 5.0.0.beta3) - activerecord (= 5.0.0.beta3) - activesupport (= 5.0.0.beta3) - bundler (>= 1.3.0, < 2.0) - railties (= 5.0.0.beta3) + rails (5.0.7.2) + actioncable (= 5.0.7.2) + actionmailer (= 5.0.7.2) + actionpack (= 5.0.7.2) + actionview (= 5.0.7.2) + activejob (= 5.0.7.2) + activemodel (= 5.0.7.2) + activerecord (= 5.0.7.2) + activesupport (= 5.0.7.2) + bundler (>= 1.3.0) + railties (= 5.0.7.2) sprockets-rails (>= 2.0.0) - rails-deprecated_sanitizer (1.0.3) - activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.7) - activesupport (>= 4.2.0.beta, < 5.0) - nokogiri (~> 1.6.0) - rails-deprecated_sanitizer (>= 1.0.1) - rails-html-sanitizer (1.0.3) - loofah (~> 2.0) - railties (5.0.0.beta3) - actionpack (= 5.0.0.beta3) - activesupport (= 5.0.0.beta3) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.0.4) + loofah (~> 2.2, >= 2.2.2) + railties (5.0.7.2) + actionpack (= 5.0.7.2) + activesupport (= 5.0.7.2) method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (11.1.1) - sprockets (3.5.2) + rake (12.3.2) + sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.0.4) + sprockets-rails (3.2.1) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - sqlite3 (1.3.11) - thor (0.19.1) - thread_safe (0.3.5) - tzinfo (1.2.2) + sqlite3 (1.4.0) + thor (0.20.3) + thread_safe (0.3.6) + tzinfo (1.2.5) thread_safe (~> 0.1) - websocket-driver (0.6.3) + websocket-driver (0.6.5) websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.2) + websocket-extensions (0.1.3) PLATFORMS ruby @@ -123,4 +121,4 @@ DEPENDENCIES sqlite3 BUNDLED WITH - 1.11.2 + 2.0.1 From 62a4726c7e9e686b85955034f523ec590b0e71bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20S=C3=A4lgstr=C3=B6m=20Peterson?= Date: Mon, 25 Mar 2019 11:42:58 -0400 Subject: [PATCH 02/21] Add circle config --- .circleci/config.yml | 159 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..26e5ca3 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,159 @@ +version: 2.1 + +defaults: &defaults + working_directory: ~/couponable-build + docker: + - image: circleci/ruby:2.4-node-browsers + environment: + BUNDLE_JOBS: 3 + BUNDLE_RETRY: 3 + BUNDLE_PATH: vendor/bundle + PGHOST: 127.0.0.1 + PGUSER: ubuntu + RAILS_ENV: test + - image: circleci/postgres:9.6-alpine + environment: + POSTGRES_USER: ubuntu + POSTGRES_DB: barkbox_test + +aliases: + # Shallow Git Clone + # https://discuss.circleci.com/t/shallow-clone-for-circleci-2-0-builds/20200 + - &checkout-shallow + name: Checkout + command: | + #!/bin/sh + set -e + + # Workaround old docker images with incorrect $HOME + # check https://github.com/docker/docker/issues/2968 for details + if [ "${HOME}" = "/" ] + then + export HOME=$(getent passwd $(id -un) | cut -d: -f6) + fi + + mkdir -p ~/.ssh + + echo 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== + bitbucket.org ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAubiN81eDcafrgMeLzaFPsw2kNvEcqTKl/VqLat/MaB33pZy0y3rJZtnqwR2qOOvbwKZYKiEO1O6VqNEBxKvJJelCq0dTXWT5pbO2gDXC6h6QDXCaHo6pOHGPUy+YBaGQRGuSusMEASYiWunYN0vCAI8QaXnWMXNMdFP3jHAJH0eDsoiGnLPBlBp4TNm6rYI74nMzgz3B9IikW4WVK+dc8KZJZWYjAuORU3jc1c/NPskD2ASinf8v3xnfXeukU0sJ5N6m5E8VLjObPEO+mN2t/FZTMZLiFqPWc/ALSqnMnnhwrNi2rbfg/rd/IpL8Le3pSBne8+seeFVBoGqzHM9yXw== + ' >> ~/.ssh/known_hosts + + (umask 077; touch ~/.ssh/id_rsa) + chmod 0600 ~/.ssh/id_rsa + (cat \< ~/.ssh/id_rsa + $CHECKOUT_KEY + EOF + ) + + # use git+ssh instead of https + git config --global url."ssh://git@github.com".insteadOf "https://github.com" || true + + if [ -e ~/couponable-build/.git ] + then + cd ~/couponable-build + git remote set-url origin "$CIRCLE_REPOSITORY_URL" || true + else + mkdir -p ~/couponable-build + cd ~/couponable-build + git clone --depth=1 "$CIRCLE_REPOSITORY_URL" . + fi + + if [ -n "$CIRCLE_TAG" ] + then + git fetch --depth=10 --force origin "refs/tags/${CIRCLE_TAG}" + elif [[ "$CIRCLE_BRANCH" =~ ^pull\/* ]] + then + # For PR from Fork + git fetch --depth=10 --force origin "$CIRCLE_BRANCH/head:remotes/origin/$CIRCLE_BRANCH" + else + git fetch --depth=10 --force origin "$CIRCLE_BRANCH:remotes/origin/$CIRCLE_BRANCH" + fi + + if [ -n "$CIRCLE_TAG" ] + then + git reset --hard "$CIRCLE_SHA1" + git checkout -q "$CIRCLE_TAG" + elif [ -n "$CIRCLE_BRANCH" ] + then + git reset --hard "$CIRCLE_SHA1" + git checkout -q -B "$CIRCLE_BRANCH" + fi + + git reset --hard "$CIRCLE_SHA1" + +jobs: + checkout_code: + <<: *defaults + steps: + - run: *checkout-shallow + - add_ssh_keys + - attach_workspace: + at: ~/couponable-build + - run: + name: Which bundler? + command: bundle -v + - restore_cache: + keys: + - v1-couponable-v2.4.4-{{ checksum "Gemfile.lock" }} + - v1-couponable-v2.4.4- + - run: + name: Bundle Install + command: bundle check --path vendor/bundle || bundle install --path vendor/bundle + - save_cache: + key: v1-couponable-v2.4.4-{{ checksum "Gemfile.lock" }} + paths: + - vendor/bundle + - persist_to_workspace: + root: ~/couponable-build + paths: + - . + + rspec_test: + <<: *defaults + parallelism: 1 +# total parallelism should be 10 for rspec_test and flaky_rspec_test, if one is taking signifigantly longer than the other these should be adjusted + steps: + - attach_workspace: + at: ~/couponable-build + - run: bundle --path vendor/bundle + - run: + name: Install psql + command: | + wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - + sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" >> /etc/apt/sources.list.d/postgresql.list' + sudo apt update -y + sudo apt-get install postgresql-client-9.5 -y + - run: + name: Swap Database Config + command: cp config/database.yml.ci config/database.yml + - run: + name: Wait for DB + command: dockerize -wait tcp://localhost:5432 -timeout 1m + - run: + name: Database Setup + command: | + bundle exec rake db:structure:load + - run: | + mkdir -p ~/couponable-build/tmp + bundle exec rspec \ + --color \ + --format documentation \ + --profile \ + --format RspecJunitFormatter \ + --out test_results/rspec.xml \ + $(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings) + - store_test_results: + path: test_results + +experimental: + notify: + branches: + only: + - master + +workflows: + version: 2 + build-and-test: + jobs: + - checkout_code + - rspec_test From af3d40d7a50d2d5aa0dc3300557b4aedaca21e69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20S=C3=A4lgstr=C3=B6m=20Peterson?= Date: Mon, 25 Mar 2019 11:45:33 -0400 Subject: [PATCH 03/21] Add bundler version string --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 26e5ca3..92f83ef 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,6 +5,7 @@ defaults: &defaults docker: - image: circleci/ruby:2.4-node-browsers environment: + BUNDLER_VERSION: 2.0.1 BUNDLE_JOBS: 3 BUNDLE_RETRY: 3 BUNDLE_PATH: vendor/bundle From 781d1b68d241c4c003dbf9e2e054285cc624ad37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20S=C3=A4lgstr=C3=B6m=20Peterson?= Date: Mon, 25 Mar 2019 11:47:46 -0400 Subject: [PATCH 04/21] Force install bundler 2 --- .circleci/config.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 92f83ef..58ede90 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -90,6 +90,13 @@ jobs: - add_ssh_keys - attach_workspace: at: ~/couponable-build + - run: + name: Install Bundler + command: | + echo 'export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ")' >> $BASH_ENV + source $BASH_ENV + gem install bundler + - run: name: Which bundler? command: bundle -v From b62926fcf921a8913da172d8c3bcb0bf97421f7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20S=C3=A4lgstr=C3=B6m=20Peterson?= Date: Mon, 25 Mar 2019 11:49:48 -0400 Subject: [PATCH 05/21] Require checkout_code for rspec_test --- .circleci/config.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 58ede90..939bf3a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -164,4 +164,6 @@ workflows: build-and-test: jobs: - checkout_code - - rspec_test + - rspec_test: + requires: + - checkout_code From 83f228493d421cf3e397ce1f876c36785f60dca7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20S=C3=A4lgstr=C3=B6m=20Peterson?= Date: Mon, 25 Mar 2019 11:50:34 -0400 Subject: [PATCH 06/21] Fix indenting --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 939bf3a..c093cf7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -165,5 +165,5 @@ workflows: jobs: - checkout_code - rspec_test: - requires: - - checkout_code + requires: + - checkout_code From 3aa61a48d328bbf63db23f6b30347d68f64533ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20S=C3=A4lgstr=C3=B6m=20Peterson?= Date: Mon, 25 Mar 2019 11:52:32 -0400 Subject: [PATCH 07/21] Force right bundler for rspec step --- .circleci/config.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c093cf7..62e80d3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -96,7 +96,6 @@ jobs: echo 'export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ")' >> $BASH_ENV source $BASH_ENV gem install bundler - - run: name: Which bundler? command: bundle -v @@ -123,6 +122,12 @@ jobs: steps: - attach_workspace: at: ~/couponable-build + - run: + name: Install Bundler + command: | + echo 'export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ")' >> $BASH_ENV + source $BASH_ENV + gem install bundler - run: bundle --path vendor/bundle - run: name: Install psql From 091426bf244ee250d8bb20ec0c4cef71324a3c89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20S=C3=A4lgstr=C3=B6m=20Peterson?= Date: Mon, 25 Mar 2019 12:08:03 -0400 Subject: [PATCH 08/21] Try some more setup --- .circleci/config.yml | 19 ++++++++----------- Gemfile.lock | 6 ++++++ couponable.gemspec | 2 ++ test/dummy/config/database.yml.ci | 6 ++++++ 4 files changed, 22 insertions(+), 11 deletions(-) create mode 100644 test/dummy/config/database.yml.ci diff --git a/.circleci/config.yml b/.circleci/config.yml index 62e80d3..571ac65 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -115,7 +115,7 @@ jobs: paths: - . - rspec_test: + test: <<: *defaults parallelism: 1 # total parallelism should be 10 for rspec_test and flaky_rspec_test, if one is taking signifigantly longer than the other these should be adjusted @@ -138,23 +138,20 @@ jobs: sudo apt-get install postgresql-client-9.5 -y - run: name: Swap Database Config - command: cp config/database.yml.ci config/database.yml + command: cp test/dummy/config/database.yml.ci test/dummy/config/database.yml - run: name: Wait for DB command: dockerize -wait tcp://localhost:5432 -timeout 1m - run: name: Database Setup command: | - bundle exec rake db:structure:load + cd test/dummy && bundle exec rake db:schema:load - run: | mkdir -p ~/couponable-build/tmp - bundle exec rspec \ - --color \ - --format documentation \ - --profile \ - --format RspecJunitFormatter \ - --out test_results/rspec.xml \ - $(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings) + bundle exec rake test \ + --junit \ + --junit-filename=test_results/test.xml + $(circleci tests glob "test/**/*_test.rb" | circleci tests split --split-by=timings) - store_test_results: path: test_results @@ -169,6 +166,6 @@ workflows: build-and-test: jobs: - checkout_code - - rspec_test: + - test: requires: - checkout_code diff --git a/Gemfile.lock b/Gemfile.lock index 2ce8167..20780ca 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -66,9 +66,13 @@ GEM mini_mime (1.0.1) mini_portile2 (2.4.0) minitest (5.11.3) + minitest-junit (0.2.0) + builder (~> 3.2) + minitest (~> 5.0) nio4r (2.3.1) nokogiri (1.10.2) mini_portile2 (~> 2.4.0) + pg (1.1.4) rack (2.0.6) rack-test (0.6.3) rack (>= 1.0) @@ -118,6 +122,8 @@ PLATFORMS DEPENDENCIES couponable! jquery-rails + minitest-junit + pg sqlite3 BUNDLED WITH diff --git a/couponable.gemspec b/couponable.gemspec index 45bb843..e6e90e7 100644 --- a/couponable.gemspec +++ b/couponable.gemspec @@ -19,4 +19,6 @@ Gem::Specification.new do |s| s.add_dependency "rails", '>= 5.0.0.beta3', '< 5.1' s.add_development_dependency "sqlite3" + s.add_development_dependency "minitest-junit" + s.add_development_dependency "pg" end diff --git a/test/dummy/config/database.yml.ci b/test/dummy/config/database.yml.ci new file mode 100644 index 0000000..ef67477 --- /dev/null +++ b/test/dummy/config/database.yml.ci @@ -0,0 +1,6 @@ +test: + adapter: postgresql + database: couponable_test + username: ubuntu + encoding: unicode + pool: 5 From 64df755d7356b1ce68cf01366515356e4b6fad21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20S=C3=A4lgstr=C3=B6m=20Peterson?= Date: Mon, 25 Mar 2019 12:12:20 -0400 Subject: [PATCH 09/21] remove whitelist call --- test/dummy/config/application.rb | 6 ------ 1 file changed, 6 deletions(-) diff --git a/test/dummy/config/application.rb b/test/dummy/config/application.rb index 9d34409..9f5b074 100644 --- a/test/dummy/config/application.rb +++ b/test/dummy/config/application.rb @@ -43,12 +43,6 @@ class Application < Rails::Application # like if you have constraints or database-specific column types # config.active_record.schema_format = :sql - # Enforce whitelist mode for mass assignment. - # This will create an empty whitelist of attributes available for mass-assignment for all models - # in your app. As such, your models will need to explicitly whitelist or blacklist accessible - # parameters by using an attr_accessible or attr_protected declaration. - config.active_record.whitelist_attributes = true - # Enable the asset pipeline config.assets.enabled = true From 7de859a2a6edfcc7f4bcb368dd9041d32c6d729d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20S=C3=A4lgstr=C3=B6m=20Peterson?= Date: Mon, 25 Mar 2019 12:15:15 -0400 Subject: [PATCH 10/21] Remove mass_assignment_sanitizer call --- test/dummy/config/environments/development.rb | 3 --- test/dummy/config/environments/test.rb | 3 --- 2 files changed, 6 deletions(-) diff --git a/test/dummy/config/environments/development.rb b/test/dummy/config/environments/development.rb index 82c74d1..4db6d36 100644 --- a/test/dummy/config/environments/development.rb +++ b/test/dummy/config/environments/development.rb @@ -22,9 +22,6 @@ # Only use best-standards-support built into browsers config.action_dispatch.best_standards_support = :builtin - # Raise exception on mass assignment protection for Active Record models - config.active_record.mass_assignment_sanitizer = :strict - # Log the query plan for queries taking more than this (works # with SQLite, MySQL, and PostgreSQL) config.active_record.auto_explain_threshold_in_seconds = 0.5 diff --git a/test/dummy/config/environments/test.rb b/test/dummy/config/environments/test.rb index f1a4814..2a0783b 100644 --- a/test/dummy/config/environments/test.rb +++ b/test/dummy/config/environments/test.rb @@ -29,9 +29,6 @@ # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test - # Raise exception on mass assignment protection for Active Record models - config.active_record.mass_assignment_sanitizer = :strict - # Print deprecation notices to the stderr config.active_support.deprecation = :stderr end From 2f5caf7c6cf75d25f88e3183eca032f65a4cf689 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20S=C3=A4lgstr=C3=B6m=20Peterson?= Date: Mon, 25 Mar 2019 12:17:29 -0400 Subject: [PATCH 11/21] Use setup --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 571ac65..2de6c74 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -145,7 +145,7 @@ jobs: - run: name: Database Setup command: | - cd test/dummy && bundle exec rake db:schema:load + cd test/dummy && bundle exec rake db:setup - run: | mkdir -p ~/couponable-build/tmp bundle exec rake test \ From 158dfa62ae02c9cb0b42dafc915f98c5e1304b01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20S=C3=A4lgstr=C3=B6m=20Peterson?= Date: Mon, 25 Mar 2019 12:24:06 -0400 Subject: [PATCH 12/21] Try reconfiguring test command --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2de6c74..5b18df6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -148,10 +148,10 @@ jobs: cd test/dummy && bundle exec rake db:setup - run: | mkdir -p ~/couponable-build/tmp - bundle exec rake test \ + bundle exec ruby $(circleci tests glob "test/**/*_test.rb" | circleci tests split --split-by=timings)\ --junit \ --junit-filename=test_results/test.xml - $(circleci tests glob "test/**/*_test.rb" | circleci tests split --split-by=timings) + - store_test_results: path: test_results From ec202be5ec91845f7321cf63fea97195f09941d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20S=C3=A4lgstr=C3=B6m=20Peterson?= Date: Mon, 25 Mar 2019 12:25:26 -0400 Subject: [PATCH 13/21] Make test_helper path local --- test/couponable_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/couponable_test.rb b/test/couponable_test.rb index c92826e..be2cebc 100644 --- a/test/couponable_test.rb +++ b/test/couponable_test.rb @@ -1,4 +1,4 @@ -require 'test_helper' +require './test_helper' class CouponableTest < ActiveSupport::TestCase test "truth" do From 1468752f7309111edcda0f88ee288252ee4c6caf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20S=C3=A4lgstr=C3=B6m=20Peterson?= Date: Mon, 25 Mar 2019 12:27:14 -0400 Subject: [PATCH 14/21] Add test to load path --- .circleci/config.yml | 2 +- test/couponable_test.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5b18df6..737d4b9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -148,7 +148,7 @@ jobs: cd test/dummy && bundle exec rake db:setup - run: | mkdir -p ~/couponable-build/tmp - bundle exec ruby $(circleci tests glob "test/**/*_test.rb" | circleci tests split --split-by=timings)\ + bundle exec ruby -Itest $(circleci tests glob "test/**/*_test.rb" | circleci tests split --split-by=timings)\ --junit \ --junit-filename=test_results/test.xml diff --git a/test/couponable_test.rb b/test/couponable_test.rb index be2cebc..c92826e 100644 --- a/test/couponable_test.rb +++ b/test/couponable_test.rb @@ -1,4 +1,4 @@ -require './test_helper' +require 'test_helper' class CouponableTest < ActiveSupport::TestCase test "truth" do From c790c2fea952bde2327bbfd62d305ad81270403c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20S=C3=A4lgstr=C3=B6m=20Peterson?= Date: Mon, 25 Mar 2019 12:30:16 -0400 Subject: [PATCH 15/21] Try explicitly setting environment --- .circleci/config.yml | 2 +- Rakefile | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 737d4b9..e6e6284 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -145,7 +145,7 @@ jobs: - run: name: Database Setup command: | - cd test/dummy && bundle exec rake db:setup + cd test/dummy && bundle exec rake db:setup RAILS_ENV=test - run: | mkdir -p ~/couponable-build/tmp bundle exec ruby -Itest $(circleci tests glob "test/**/*_test.rb" | circleci tests split --split-by=timings)\ diff --git a/Rakefile b/Rakefile index 83db91e..d3ee201 100644 --- a/Rakefile +++ b/Rakefile @@ -22,8 +22,6 @@ end APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__) load 'rails/tasks/engine.rake' - - Bundler::GemHelper.install_tasks require 'rake/testtask' From 2ee149ab3bbfab82447748932b1328a5c633ed45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20S=C3=A4lgstr=C3=B6m=20Peterson?= Date: Mon, 25 Mar 2019 12:32:14 -0400 Subject: [PATCH 16/21] Try not cding --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e6e6284..841c696 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -145,7 +145,7 @@ jobs: - run: name: Database Setup command: | - cd test/dummy && bundle exec rake db:setup RAILS_ENV=test + bundle exec rake db:setup RAILS_ENV=test - run: | mkdir -p ~/couponable-build/tmp bundle exec ruby -Itest $(circleci tests glob "test/**/*_test.rb" | circleci tests split --split-by=timings)\ From ea320f3f3f957c5e68574e2ca146270b1007b157 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20S=C3=A4lgstr=C3=B6m=20Peterson?= Date: Mon, 25 Mar 2019 12:33:59 -0400 Subject: [PATCH 17/21] explicitly migrate --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 841c696..5e9d748 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -145,7 +145,7 @@ jobs: - run: name: Database Setup command: | - bundle exec rake db:setup RAILS_ENV=test + bundle exec rake db:setup RAILS_ENV=test && bundle exec rake db:migrate RAILS_ENV=test - run: | mkdir -p ~/couponable-build/tmp bundle exec ruby -Itest $(circleci tests glob "test/**/*_test.rb" | circleci tests split --split-by=timings)\ From 1ab611efaf8196acfbde183e65a3d5e7fab98eb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20S=C3=A4lgstr=C3=B6m=20Peterson?= Date: Mon, 25 Mar 2019 12:35:30 -0400 Subject: [PATCH 18/21] Try using rails db form --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5e9d748..4fdcf6d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -145,7 +145,7 @@ jobs: - run: name: Database Setup command: | - bundle exec rake db:setup RAILS_ENV=test && bundle exec rake db:migrate RAILS_ENV=test + bundle exec rails db:setup RAILS_ENV=test && bundle exec rails db:migrate RAILS_ENV=test - run: | mkdir -p ~/couponable-build/tmp bundle exec ruby -Itest $(circleci tests glob "test/**/*_test.rb" | circleci tests split --split-by=timings)\ From a01b605c4508e391a70351334be3a347dd99bb52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20S=C3=A4lgstr=C3=B6m=20Peterson?= Date: Mon, 25 Mar 2019 12:37:13 -0400 Subject: [PATCH 19/21] Try something else :S --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4fdcf6d..917094b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -145,7 +145,7 @@ jobs: - run: name: Database Setup command: | - bundle exec rails db:setup RAILS_ENV=test && bundle exec rails db:migrate RAILS_ENV=test + bundle exec rails db:create db:migrate RAILS_ENV=test - run: | mkdir -p ~/couponable-build/tmp bundle exec ruby -Itest $(circleci tests glob "test/**/*_test.rb" | circleci tests split --split-by=timings)\ From 9e785bd3c617b889d991cb585c14c9298855c53f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20S=C3=A4lgstr=C3=B6m=20Peterson?= Date: Mon, 25 Mar 2019 12:39:25 -0400 Subject: [PATCH 20/21] Make test results dir --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 917094b..1802bee 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -148,6 +148,7 @@ jobs: bundle exec rails db:create db:migrate RAILS_ENV=test - run: | mkdir -p ~/couponable-build/tmp + mkdir -p ~/couponable-build/test_results bundle exec ruby -Itest $(circleci tests glob "test/**/*_test.rb" | circleci tests split --split-by=timings)\ --junit \ --junit-filename=test_results/test.xml From a0aa75b4d12022e00030fd6e20991cc2889156d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20S=C3=A4lgstr=C3=B6m=20Peterson?= Date: Fri, 3 May 2019 15:20:37 -0400 Subject: [PATCH 21/21] Allow 5.1 --- couponable.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couponable.gemspec b/couponable.gemspec index e6e90e7..84965c9 100644 --- a/couponable.gemspec +++ b/couponable.gemspec @@ -16,7 +16,7 @@ Gem::Specification.new do |s| s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.md"] s.test_files = Dir["test/**/*"] - s.add_dependency "rails", '>= 5.0.0.beta3', '< 5.1' + s.add_dependency "rails", '>= 5.0.0.beta3' s.add_development_dependency "sqlite3" s.add_development_dependency "minitest-junit"