Skip to content

Commit

Permalink
Move example app to specs
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkhan committed Aug 17, 2024
1 parent 35d2455 commit 5e93687
Show file tree
Hide file tree
Showing 106 changed files with 144 additions and 314 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Example Schema Snapshot Test
name: RSpec

on:
pull_request:
Expand All @@ -9,10 +9,6 @@ jobs:
test:
runs-on: ubuntu-latest

defaults:
run:
working-directory: example

env:
RAILS_ENV: test
DATABASE_URL: postgres://postgres:postgres@localhost:5432
Expand All @@ -35,13 +31,13 @@ jobs:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
working-directory: example
bundler-cache: true

- name: Set up database
working-directory: spec/example
run: |
bin/rails db:create
bin/rails db:schema:load
- name: Run tests
run: bin/rails test -b
run: bundle exec rspec
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.3.2
16 changes: 16 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,19 @@ source "https://rubygems.org"
ruby "3.3.2"

gemspec

gem "jsonapi-resources", "~> 0.1"

# Use postgresql as the database for Active Record
gem "pg", "~> 1.1"

# Use the Puma web server [https://github.com/puma/puma]
gem "puma", ">= 5.0"

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: %i[ windows jruby ]

group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem "debug", platforms: %i[ mri windows ]
end
11 changes: 11 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ GEM
connection_pool (2.4.1)
crass (1.0.6)
date (3.3.4)
debug (1.9.2)
irb (~> 1.10)
reline (>= 0.3.8)
diff-lcs (1.5.1)
drb (2.2.1)
erubi (1.13.0)
Expand Down Expand Up @@ -134,8 +137,11 @@ GEM
racc (~> 1.4)
nokogiri (1.16.7-x86_64-linux)
racc (~> 1.4)
pg (1.5.7)
psych (5.1.2)
stringio
puma (6.4.2)
nio4r (~> 2.0)
racc (1.8.1)
rack (3.1.7)
rack-session (2.0.0)
Expand Down Expand Up @@ -219,8 +225,13 @@ PLATFORMS
x86_64-linux

DEPENDENCIES
debug
jsonapi-resources (~> 0.1)
jsonapi-resources-anchor!
pg (~> 1.1)
puma (>= 5.0)
rspec-rails (~> 6.0)
tzinfo-data
yard

RUBY VERSION
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ types defined in `Anchor::Types`, see [Annotations](#annotations).
This gem provides TypeScript and JSON Schema generators with
`Anchor::TypeScript::SchemaGenerator` and `Anchor::JSONSchema::SchemaGenerator`.

See the [example](./example) Rails app for a fully functional example using
`Anchor`. See [schema_test.rb](./example/test/models/schema_test.rb) for
See the [example](./spec/example) Rails app for a fully functional example using
`Anchor`. See [schema_test.rb](./spec/example/test/models/schema_test.rb) for
`Schema` generation examples.

## Inference
Expand All @@ -35,7 +35,7 @@ then mapped to an `Anchor::Type` in
`Anchor::Types::Inference::ActiveRecord::SQL.from`.

- `Anchor.config.ar_column_to_type` allows custom mappings, see
[example/initializers/anchor.rb](./examples/initializers/anchor.rb)
[spec/example/initializers/anchor.rb](./spec/examples/initializers/anchor.rb)
- `Anchor.config.use_active_record_presence` can be set to `true` to infer
nullable attributes (i.e. fields that do not specify `null: false` in
schema.rb) as non-null when an unconditional
Expand Down
31 changes: 0 additions & 31 deletions example/Gemfile

This file was deleted.

231 changes: 0 additions & 231 deletions example/Gemfile.lock

This file was deleted.

24 changes: 0 additions & 24 deletions example/README.md

This file was deleted.

Loading

0 comments on commit 5e93687

Please sign in to comment.