Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dummy app test setup improvements #57

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/dummy-app-setup ${{ 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
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 => "../../../../"
3 changes: 3 additions & 0 deletions spec/dummy_app_config/gemfiles/Gemfile-rails-6.0
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6.0.0'

gem 'bootsnap'
gem 'webpacker'
Loading