diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6bdfe5e..fe80aed 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -53,22 +53,8 @@ jobs: bundle bundle exec rake - name: Set up new Rails dummy app - working-directory: ./spec - env: - RAILS_NEW_GEMFILE: dummy_app_config/gemfiles/Gemfile-rails-${{ matrix.rails-version }} run: | - bundle config set --local path '/tmp/system-tests' - BUNDLE_GEMFILE=$RAILS_NEW_GEMFILE bundle - rails new dummy_app --database=sqlite3 --skip-active-storage --skip-action-cable --skip-spring --skip-listen --skip-test - cat dummy_app_config/Gemfile.append >> dummy_app/Gemfile - cd dummy_app - bundle - rails g rspec:install - cp -rf ../dummy_app_config/shared_source/all/* ./ - cp -rf ../dummy_app_config/shared_source/${{ matrix.rails-version }}/* ./ - yarn install + bin/set-up-dummy-app ${{ matrix.rails-version }} - name: Run Rails dummy app tests - working-directory: ./spec/dummy_app run: | - rake db:drop db:create db:migrate - rake + bundle exec rails db:drop db:create db:migrate spec diff --git a/README.md b/README.md index 5f335d5..ceb2146 100644 --- a/README.md +++ b/README.md @@ -590,6 +590,16 @@ Other Ruby libraries that offer passwordless authentication: * [passwordless](https://github.com/mikker/passwordless) * [magic-link](https://github.com/dvanderbeek/magic-link) +## Gem development + +### Running tests + +``` +bin/dummy-app-setup 6.1 +cd spec/tmp/dummy_app-rails-6.1/dummy_app +bundle exec rails db:drop db:create db:migrate spec +``` + ## License The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). diff --git a/bin/dummy-app-setup b/bin/dummy-app-setup new file mode 100755 index 0000000..da49701 --- /dev/null +++ b/bin/dummy-app-setup @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -xeuo pipefail + +DIRECTORY=spec/tmp/dummy_app-rails-$1 + +mkdir -p $DIRECTORY +cp spec/dummy_app_config/gemfiles/Gemfile-rails-$1 $DIRECTORY/Gemfile +cd $DIRECTORY +bundle config set --local path gems +bundle install +bundle exec rails new dummy_app --database=sqlite3 --skip-active-storage --skip-action-cable --skip-spring --skip-listen --skip-test --skip-bootsnap +cat ../../dummy_app_config/Gemfile.append >> dummy_app/Gemfile +cd dummy_app +bundle install +bundle exec rails generate rspec:install +cp -rf ../../../dummy_app_config/shared_source/all/* ./ +cp -rf ../../../dummy_app_config/shared_source/$1/* ./ +yarn install diff --git a/spec/dummy_app_config/Gemfile.append b/spec/dummy_app_config/Gemfile.append index 02a55d8..de46b52 100644 --- a/spec/dummy_app_config/Gemfile.append +++ b/spec/dummy_app_config/Gemfile.append @@ -7,4 +7,4 @@ group :development, :test do end gem "devise" -gem "devise-passwordless", :path => "../../../" +gem "devise-passwordless", :path => "../../../../"