Skip to content

Commit

Permalink
Added a script to set up the dummy app for running the dummy app test…
Browse files Browse the repository at this point in the history
… suite locally and changed the GitHub Actions workflow to leverage the new setup script.
  • Loading branch information
codyrobbins committed Apr 16, 2024
1 parent 904eb53 commit 4af59cd
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 17 deletions.
18 changes: 2 additions & 16 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
19 changes: 19 additions & 0 deletions bin/dummy-app-setup
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion spec/dummy_app_config/Gemfile.append
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ group :development, :test do
end

gem "devise"
gem "devise-passwordless", :path => "../../../"
gem "devise-passwordless", :path => "../../../../"

0 comments on commit 4af59cd

Please sign in to comment.