diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4b0eef7..c32ce1a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,11 +43,8 @@ jobs: - name: Run tests env: - DATABASE_URL: "sqlite3:test" - RAILS_ENV: test - run: | - bundle exec rails db:test:prepare - bundle exec rails test + ADAPTER: sqlite3 + run: bundle exec rake test postgres: runs-on: ubuntu-latest @@ -74,8 +71,8 @@ jobs: image: postgres:12 env: POSTGRES_USER: postgres - POSTGRES_PASSWORD: password - POSTGRES_DB: test + POSTGRES_PASSWORD: postgres + POSTGRES_DB: sequenced_test ports: ['5432:5432'] steps: @@ -93,8 +90,5 @@ jobs: - name: Run tests env: - DATABASE_URL: postgres://postgres:password@localhost:5432/test - RAILS_ENV: test - run: | - bundle exec rails db:test:prepare - bundle exec rails test + ADAPTER: postgresql + run: bundle exec rake test diff --git a/.gitignore b/.gitignore index 2a1f56f..55576d6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,10 @@ .bundle/ .rvmrc Gemfile.lock +gemfiles/*.lock log/*.log pkg/ -test/dummy/db/*.sqlite3 -test/dummy/log/*.log -test/dummy/tmp/ -test/dummy/.sass-cache +*.sqlite3 *.gem .ruby-version .ruby-gemset diff --git a/Appraisals b/Appraisals index 00188dc..de16b61 100644 --- a/Appraisals +++ b/Appraisals @@ -1,19 +1,19 @@ appraise "rails-5-2" do - gem "rails", "~> 5.2.0" + gem "activerecord", "~> 5.2.0" end appraise "rails-6" do - gem "rails", "~> 6.0.0" + gem "activerecord", "~> 6.0.0" end appraise "rails-6-1" do - gem "rails", "~> 6.1.0" + gem "activerecord", "~> 6.1.0" end appraise "rails-7" do - gem "rails", "~> 7.0.0" + gem "activerecord", "~> 7.0.0" end appraise "rails-master" do - gem "rails", github: "rails/rails", branch: "main" + gem "activerecord", github: "rails/rails", branch: "main" end diff --git a/Gemfile b/Gemfile index 98de768..41d9a51 100644 --- a/Gemfile +++ b/Gemfile @@ -1,26 +1,15 @@ source "https://rubygems.org" -# Declare your gem's dependencies in sequenced.gemspec. -# Bundler will treat runtime dependencies like base dependencies, and -# development dependencies will be added by default to the :development group. gemspec gem "appraisal" gem "standardrb" - -group :development, :test do - gem "sqlite3", "~> 1.4.4" - # gem 'mysql2' - gem "pg" - gem "net-imap" - gem "net-pop" - gem "net-smtp" +gem "sqlite3", "~> 1.4.4" +gem "pg" + +if defined?(@ar_gem_requirement) + gem "activerecord", @ar_gem_requirement + gem "railties", @ar_gem_requirement +else + gem "activerecord" # latest end - -# Declare any dependencies that are still in development here instead of in -# your gemspec. These might include edge Rails or gems from your path or -# Git. Remember to move these dependencies to your gemspec before releasing -# your gem to rubygems.org. - -# To use debugger -# gem 'ruby-debug19', :require => 'ruby-debug' diff --git a/Rakefile b/Rakefile index 8bd8d57..dfb0f40 100644 --- a/Rakefile +++ b/Rakefile @@ -32,28 +32,3 @@ Rake::TestTask.new(:test) do |t| end task default: :test - -namespace :db do - task :create do - # File.expand_path is executed directory of generated Rails app - rakefile = File.expand_path("Rakefile", "test/dummy/") - command = "rake -f '%s' db:create" % rakefile - sh(command) - end - - task :drop do - # File.expand_path is executed directory of generated Rails app - rakefile = File.expand_path("Rakefile", "test/dummy/") - command = "rake -f '%s' db:drop" % rakefile - sh(command) - end - - namespace :test do - task :prepare do - # File.expand_path is executed directory of generated Rails app - rakefile = File.expand_path("Rakefile", "test/dummy/") - command = "rake -f '%s' db:test:prepare" % rakefile - sh(command) - end - end -end diff --git a/gemfiles/rails_5_2.gemfile b/gemfiles/rails_5_2.gemfile index 77d0340..6945cb2 100644 --- a/gemfiles/rails_5_2.gemfile +++ b/gemfiles/rails_5_2.gemfile @@ -4,14 +4,8 @@ source "https://rubygems.org" gem "appraisal" gem "standardrb" -gem "rails", "~> 5.2.0" - -group :development, :test do - gem "sqlite3", "~> 1.4.4" - gem "pg" - gem "net-imap" - gem "net-pop" - gem "net-smtp" -end +gem "sqlite3", "~> 1.4.4" +gem "pg" +gem "activerecord", "~> 5.2.0" gemspec path: "../" diff --git a/gemfiles/rails_5_2.gemfile.lock b/gemfiles/rails_5_2.gemfile.lock index ab059d2..c0892b9 100644 --- a/gemfiles/rails_5_2.gemfile.lock +++ b/gemfiles/rails_5_2.gemfile.lock @@ -8,42 +8,12 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (5.2.8.1) - actionpack (= 5.2.8.1) - nio4r (~> 2.0) - websocket-driver (>= 0.6.1) - actionmailer (5.2.8.1) - actionpack (= 5.2.8.1) - actionview (= 5.2.8.1) - activejob (= 5.2.8.1) - mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 2.0) - actionpack (5.2.8.1) - actionview (= 5.2.8.1) - activesupport (= 5.2.8.1) - rack (~> 2.0, >= 2.0.8) - rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.8.1) - activesupport (= 5.2.8.1) - builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.2.8.1) - activesupport (= 5.2.8.1) - globalid (>= 0.3.6) activemodel (5.2.8.1) activesupport (= 5.2.8.1) activerecord (5.2.8.1) activemodel (= 5.2.8.1) activesupport (= 5.2.8.1) arel (>= 9.0) - activestorage (5.2.8.1) - actionpack (= 5.2.8.1) - activerecord (= 5.2.8.1) - marcel (~> 1.0.0) activesupport (5.2.8.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) @@ -55,80 +25,16 @@ GEM thor (>= 0.14.0) arel (9.0.0) ast (2.4.2) - builder (3.2.4) + byebug (11.1.3) concurrent-ruby (1.1.10) - crass (1.0.6) - digest (3.1.0) - erubi (1.11.0) - globalid (1.0.0) - activesupport (>= 5.0) i18n (1.12.0) concurrent-ruby (~> 1.0) json (2.6.2) - loofah (2.18.0) - crass (~> 1.0.2) - nokogiri (>= 1.5.9) - mail (2.7.1) - mini_mime (>= 0.1.1) - marcel (1.0.2) - method_source (1.0.0) - mini_mime (1.1.2) - mini_portile2 (2.8.0) - minitest (5.16.2) - net-imap (0.2.3) - digest - net-protocol - strscan - net-pop (0.1.1) - digest - net-protocol - timeout - net-protocol (0.1.3) - timeout - net-smtp (0.3.1) - digest - net-protocol - timeout - nio4r (2.5.8) - nokogiri (1.13.8) - mini_portile2 (~> 2.8.0) - racc (~> 1.4) - nokogiri (1.13.8-arm64-darwin) - racc (~> 1.4) - nokogiri (1.13.8-x86_64-linux) - racc (~> 1.4) + minitest (5.16.3) parallel (1.22.1) parser (3.1.2.1) ast (~> 2.4.1) pg (1.4.3) - racc (1.6.0) - rack (2.2.4) - rack-test (2.0.2) - rack (>= 1.3) - rails (5.2.8.1) - actioncable (= 5.2.8.1) - actionmailer (= 5.2.8.1) - actionpack (= 5.2.8.1) - actionview (= 5.2.8.1) - activejob (= 5.2.8.1) - activemodel (= 5.2.8.1) - activerecord (= 5.2.8.1) - activestorage (= 5.2.8.1) - activesupport (= 5.2.8.1) - bundler (>= 1.3.0) - railties (= 5.2.8.1) - sprockets-rails (>= 2.0.0) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) - nokogiri (>= 1.6) - rails-html-sanitizer (1.4.3) - loofah (~> 2.3) - railties (5.2.8.1) - actionpack (= 5.2.8.1) - activesupport (= 5.2.8.1) - method_source - rake (>= 0.8.7) - thor (>= 0.19.0, < 2.0) rainbow (3.1.1) rake (13.0.6) regexp_parser (2.5.0) @@ -149,45 +55,30 @@ GEM rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) ruby-progressbar (1.11.0) - sprockets (4.1.1) - concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (3.4.2) - actionpack (>= 5.2) - activesupport (>= 5.2) - sprockets (>= 3.0.0) sqlite3 (1.4.4) standard (1.16.0) rubocop (= 1.35.0) rubocop-performance (= 1.14.3) standardrb (1.0.1) standard - strscan (3.0.4) thor (1.2.1) thread_safe (0.3.6) - timeout (0.3.0) tzinfo (1.2.10) thread_safe (~> 0.1) unicode-display_width (2.2.0) - websocket-driver (0.7.5) - websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.5) PLATFORMS - arm64-darwin-21 ruby - x86_64-linux + x86_64-darwin-20 DEPENDENCIES + activerecord (~> 5.2.0) appraisal - net-imap - net-pop - net-smtp + byebug pg - rails (~> 5.2.0) sequenced! sqlite3 (~> 1.4.4) standardrb BUNDLED WITH - 2.3.16 + 2.3.17 diff --git a/gemfiles/rails_6.gemfile b/gemfiles/rails_6.gemfile index 8ac956d..4d30b42 100644 --- a/gemfiles/rails_6.gemfile +++ b/gemfiles/rails_6.gemfile @@ -4,14 +4,8 @@ source "https://rubygems.org" gem "appraisal" gem "standardrb" -gem "rails", "~> 6.0.0" - -group :development, :test do - gem "sqlite3", "~> 1.4.4" - gem "pg" - gem "net-imap" - gem "net-pop" - gem "net-smtp" -end +gem "sqlite3", "~> 1.4.4" +gem "pg" +gem "activerecord", "~> 6.0.0" gemspec path: "../" diff --git a/gemfiles/rails_6.gemfile.lock b/gemfiles/rails_6.gemfile.lock index 3175f3f..4dfb819 100644 --- a/gemfiles/rails_6.gemfile.lock +++ b/gemfiles/rails_6.gemfile.lock @@ -8,55 +8,11 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (6.0.5.1) - actionpack (= 6.0.5.1) - nio4r (~> 2.0) - websocket-driver (>= 0.6.1) - actionmailbox (6.0.5.1) - actionpack (= 6.0.5.1) - activejob (= 6.0.5.1) - activerecord (= 6.0.5.1) - activestorage (= 6.0.5.1) - activesupport (= 6.0.5.1) - mail (>= 2.7.1) - actionmailer (6.0.5.1) - actionpack (= 6.0.5.1) - actionview (= 6.0.5.1) - activejob (= 6.0.5.1) - mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 2.0) - actionpack (6.0.5.1) - actionview (= 6.0.5.1) - activesupport (= 6.0.5.1) - rack (~> 2.0, >= 2.0.8) - rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.0.5.1) - actionpack (= 6.0.5.1) - activerecord (= 6.0.5.1) - activestorage (= 6.0.5.1) - activesupport (= 6.0.5.1) - nokogiri (>= 1.8.5) - actionview (6.0.5.1) - activesupport (= 6.0.5.1) - builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.0.5.1) - activesupport (= 6.0.5.1) - globalid (>= 0.3.6) activemodel (6.0.5.1) activesupport (= 6.0.5.1) activerecord (6.0.5.1) activemodel (= 6.0.5.1) activesupport (= 6.0.5.1) - activestorage (6.0.5.1) - actionpack (= 6.0.5.1) - activejob (= 6.0.5.1) - activerecord (= 6.0.5.1) - marcel (~> 1.0) activesupport (6.0.5.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) @@ -68,78 +24,16 @@ GEM rake thor (>= 0.14.0) ast (2.4.2) - builder (3.2.4) + byebug (11.1.3) concurrent-ruby (1.1.10) - crass (1.0.6) - digest (3.1.0) - erubi (1.11.0) - globalid (1.0.0) - activesupport (>= 5.0) i18n (1.12.0) concurrent-ruby (~> 1.0) json (2.6.2) - loofah (2.18.0) - crass (~> 1.0.2) - nokogiri (>= 1.5.9) - mail (2.7.1) - mini_mime (>= 0.1.1) - marcel (1.0.2) - method_source (1.0.0) - mini_mime (1.1.2) - minitest (5.16.2) - net-imap (0.2.3) - digest - net-protocol - strscan - net-pop (0.1.1) - digest - net-protocol - timeout - net-protocol (0.1.3) - timeout - net-smtp (0.3.1) - digest - net-protocol - timeout - nio4r (2.5.8) - nokogiri (1.13.8-arm64-darwin) - racc (~> 1.4) - nokogiri (1.13.8-x86_64-linux) - racc (~> 1.4) + minitest (5.16.3) parallel (1.22.1) parser (3.1.2.1) ast (~> 2.4.1) pg (1.4.3) - racc (1.6.0) - rack (2.2.4) - rack-test (2.0.2) - rack (>= 1.3) - rails (6.0.5.1) - actioncable (= 6.0.5.1) - actionmailbox (= 6.0.5.1) - actionmailer (= 6.0.5.1) - actionpack (= 6.0.5.1) - actiontext (= 6.0.5.1) - actionview (= 6.0.5.1) - activejob (= 6.0.5.1) - activemodel (= 6.0.5.1) - activerecord (= 6.0.5.1) - activestorage (= 6.0.5.1) - activesupport (= 6.0.5.1) - bundler (>= 1.3.0) - railties (= 6.0.5.1) - sprockets-rails (>= 2.0.0) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) - nokogiri (>= 1.6) - rails-html-sanitizer (1.4.3) - loofah (~> 2.3) - railties (6.0.5.1) - actionpack (= 6.0.5.1) - activesupport (= 6.0.5.1) - method_source - rake (>= 0.8.7) - thor (>= 0.20.3, < 2.0) rainbow (3.1.1) rake (13.0.6) regexp_parser (2.5.0) @@ -160,45 +54,31 @@ GEM rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) ruby-progressbar (1.11.0) - sprockets (4.1.1) - concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (3.4.2) - actionpack (>= 5.2) - activesupport (>= 5.2) - sprockets (>= 3.0.0) sqlite3 (1.4.4) standard (1.16.0) rubocop (= 1.35.0) rubocop-performance (= 1.14.3) standardrb (1.0.1) standard - strscan (3.0.4) thor (1.2.1) thread_safe (0.3.6) - timeout (0.3.0) tzinfo (1.2.10) thread_safe (~> 0.1) unicode-display_width (2.2.0) - websocket-driver (0.7.5) - websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.5) zeitwerk (2.6.0) PLATFORMS - arm64-darwin-21 - x86_64-linux + ruby + x86_64-darwin-20 DEPENDENCIES + activerecord (~> 6.0.0) appraisal - net-imap - net-pop - net-smtp + byebug pg - rails (~> 6.0.0) sequenced! sqlite3 (~> 1.4.4) standardrb BUNDLED WITH - 2.3.16 + 2.3.17 diff --git a/gemfiles/rails_6_1.gemfile b/gemfiles/rails_6_1.gemfile index 925ba6e..9bf4c9b 100644 --- a/gemfiles/rails_6_1.gemfile +++ b/gemfiles/rails_6_1.gemfile @@ -4,14 +4,8 @@ source "https://rubygems.org" gem "appraisal" gem "standardrb" -gem "rails", "~> 6.1.0" - -group :development, :test do - gem "sqlite3", "~> 1.4.4" - gem "pg" - gem "net-imap" - gem "net-pop" - gem "net-smtp" -end +gem "sqlite3", "~> 1.4.4" +gem "pg" +gem "activerecord", "~> 6.1.0" gemspec path: "../" diff --git a/gemfiles/rails_6_1.gemfile.lock b/gemfiles/rails_6_1.gemfile.lock index 0c7e31b..b068ab2 100644 --- a/gemfiles/rails_6_1.gemfile.lock +++ b/gemfiles/rails_6_1.gemfile.lock @@ -8,60 +8,12 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (6.1.6) - actionpack (= 6.1.6) - activesupport (= 6.1.6) - nio4r (~> 2.0) - websocket-driver (>= 0.6.1) - actionmailbox (6.1.6) - actionpack (= 6.1.6) - activejob (= 6.1.6) - activerecord (= 6.1.6) - activestorage (= 6.1.6) - activesupport (= 6.1.6) - mail (>= 2.7.1) - actionmailer (6.1.6) - actionpack (= 6.1.6) - actionview (= 6.1.6) - activejob (= 6.1.6) - activesupport (= 6.1.6) - mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 2.0) - actionpack (6.1.6) - actionview (= 6.1.6) - activesupport (= 6.1.6) - rack (~> 2.0, >= 2.0.9) - rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.6) - actionpack (= 6.1.6) - activerecord (= 6.1.6) - activestorage (= 6.1.6) - activesupport (= 6.1.6) - nokogiri (>= 1.8.5) - actionview (6.1.6) - activesupport (= 6.1.6) - builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.1.6) - activesupport (= 6.1.6) - globalid (>= 0.3.6) - activemodel (6.1.6) - activesupport (= 6.1.6) - activerecord (6.1.6) - activemodel (= 6.1.6) - activesupport (= 6.1.6) - activestorage (6.1.6) - actionpack (= 6.1.6) - activejob (= 6.1.6) - activerecord (= 6.1.6) - activesupport (= 6.1.6) - marcel (~> 1.0) - mini_mime (>= 1.1.0) - activesupport (6.1.6) + activemodel (6.1.6.1) + activesupport (= 6.1.6.1) + activerecord (6.1.6.1) + activemodel (= 6.1.6.1) + activesupport (= 6.1.6.1) + activesupport (6.1.6.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -72,78 +24,16 @@ GEM rake thor (>= 0.14.0) ast (2.4.2) - builder (3.2.4) + byebug (11.1.3) concurrent-ruby (1.1.10) - crass (1.0.6) - digest (3.1.0) - erubi (1.11.0) - globalid (1.0.0) - activesupport (>= 5.0) i18n (1.12.0) concurrent-ruby (~> 1.0) json (2.6.2) - loofah (2.18.0) - crass (~> 1.0.2) - nokogiri (>= 1.5.9) - mail (2.7.1) - mini_mime (>= 0.1.1) - marcel (1.0.2) - method_source (1.0.0) - mini_mime (1.1.2) - minitest (5.16.2) - net-imap (0.2.3) - digest - net-protocol - strscan - net-pop (0.1.1) - digest - net-protocol - timeout - net-protocol (0.1.3) - timeout - net-smtp (0.3.1) - digest - net-protocol - timeout - nio4r (2.5.8) - nokogiri (1.13.8-arm64-darwin) - racc (~> 1.4) - nokogiri (1.13.8-x86_64-linux) - racc (~> 1.4) + minitest (5.16.3) parallel (1.22.1) parser (3.1.2.1) ast (~> 2.4.1) pg (1.4.3) - racc (1.6.0) - rack (2.2.4) - rack-test (2.0.2) - rack (>= 1.3) - rails (6.1.6) - actioncable (= 6.1.6) - actionmailbox (= 6.1.6) - actionmailer (= 6.1.6) - actionpack (= 6.1.6) - actiontext (= 6.1.6) - actionview (= 6.1.6) - activejob (= 6.1.6) - activemodel (= 6.1.6) - activerecord (= 6.1.6) - activestorage (= 6.1.6) - activesupport (= 6.1.6) - bundler (>= 1.15.0) - railties (= 6.1.6) - sprockets-rails (>= 2.0.0) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) - nokogiri (>= 1.6) - rails-html-sanitizer (1.4.3) - loofah (~> 2.3) - railties (6.1.6) - actionpack (= 6.1.6) - activesupport (= 6.1.6) - method_source - rake (>= 12.2) - thor (~> 1.0) rainbow (3.1.1) rake (13.0.6) regexp_parser (2.5.0) @@ -164,44 +54,30 @@ GEM rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) ruby-progressbar (1.11.0) - sprockets (4.1.1) - concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (3.4.2) - actionpack (>= 5.2) - activesupport (>= 5.2) - sprockets (>= 3.0.0) sqlite3 (1.4.4) standard (1.16.0) rubocop (= 1.35.0) rubocop-performance (= 1.14.3) standardrb (1.0.1) standard - strscan (3.0.4) thor (1.2.1) - timeout (0.3.0) tzinfo (2.0.5) concurrent-ruby (~> 1.0) unicode-display_width (2.2.0) - websocket-driver (0.7.5) - websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.5) zeitwerk (2.6.0) PLATFORMS - arm64-darwin-21 - x86_64-linux + ruby + x86_64-darwin-20 DEPENDENCIES + activerecord (~> 6.1.0) appraisal - net-imap - net-pop - net-smtp + byebug pg - rails (~> 6.1.0) sequenced! sqlite3 (~> 1.4.4) standardrb BUNDLED WITH - 2.3.16 + 2.3.17 diff --git a/gemfiles/rails_7.gemfile b/gemfiles/rails_7.gemfile index 640b87a..7cce0f5 100644 --- a/gemfiles/rails_7.gemfile +++ b/gemfiles/rails_7.gemfile @@ -4,14 +4,8 @@ source "https://rubygems.org" gem "appraisal" gem "standardrb" -gem "rails", "~> 7.0.0" - -group :development, :test do - gem "sqlite3", "~> 1.4.4" - gem "pg" - gem "net-imap" - gem "net-pop" - gem "net-smtp" -end +gem "sqlite3", "~> 1.4.4" +gem "pg" +gem "activerecord", "~> 7.0.0" gemspec path: "../" diff --git a/gemfiles/rails_7.gemfile.lock b/gemfiles/rails_7.gemfile.lock index 70c7e7f..1fe6683 100644 --- a/gemfiles/rails_7.gemfile.lock +++ b/gemfiles/rails_7.gemfile.lock @@ -8,66 +8,11 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (7.0.3.1) - actionpack (= 7.0.3.1) - activesupport (= 7.0.3.1) - nio4r (~> 2.0) - websocket-driver (>= 0.6.1) - actionmailbox (7.0.3.1) - actionpack (= 7.0.3.1) - activejob (= 7.0.3.1) - activerecord (= 7.0.3.1) - activestorage (= 7.0.3.1) - activesupport (= 7.0.3.1) - mail (>= 2.7.1) - net-imap - net-pop - net-smtp - actionmailer (7.0.3.1) - actionpack (= 7.0.3.1) - actionview (= 7.0.3.1) - activejob (= 7.0.3.1) - activesupport (= 7.0.3.1) - mail (~> 2.5, >= 2.5.4) - net-imap - net-pop - net-smtp - rails-dom-testing (~> 2.0) - actionpack (7.0.3.1) - actionview (= 7.0.3.1) - activesupport (= 7.0.3.1) - rack (~> 2.0, >= 2.2.0) - rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.3.1) - actionpack (= 7.0.3.1) - activerecord (= 7.0.3.1) - activestorage (= 7.0.3.1) - activesupport (= 7.0.3.1) - globalid (>= 0.6.0) - nokogiri (>= 1.8.5) - actionview (7.0.3.1) - activesupport (= 7.0.3.1) - builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.3.1) - activesupport (= 7.0.3.1) - globalid (>= 0.3.6) activemodel (7.0.3.1) activesupport (= 7.0.3.1) activerecord (7.0.3.1) activemodel (= 7.0.3.1) activesupport (= 7.0.3.1) - activestorage (7.0.3.1) - actionpack (= 7.0.3.1) - activejob (= 7.0.3.1) - activerecord (= 7.0.3.1) - activesupport (= 7.0.3.1) - marcel (~> 1.0) - mini_mime (>= 1.1.0) activesupport (7.0.3.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) @@ -78,78 +23,16 @@ GEM rake thor (>= 0.14.0) ast (2.4.2) - builder (3.2.4) + byebug (11.1.3) concurrent-ruby (1.1.10) - crass (1.0.6) - digest (3.1.0) - erubi (1.11.0) - globalid (1.0.0) - activesupport (>= 5.0) i18n (1.12.0) concurrent-ruby (~> 1.0) json (2.6.2) - loofah (2.18.0) - crass (~> 1.0.2) - nokogiri (>= 1.5.9) - mail (2.7.1) - mini_mime (>= 0.1.1) - marcel (1.0.2) - method_source (1.0.0) - mini_mime (1.1.2) - minitest (5.16.2) - net-imap (0.2.3) - digest - net-protocol - strscan - net-pop (0.1.1) - digest - net-protocol - timeout - net-protocol (0.1.3) - timeout - net-smtp (0.3.1) - digest - net-protocol - timeout - nio4r (2.5.8) - nokogiri (1.13.8-arm64-darwin) - racc (~> 1.4) - nokogiri (1.13.8-x86_64-linux) - racc (~> 1.4) + minitest (5.16.3) parallel (1.22.1) parser (3.1.2.1) ast (~> 2.4.1) pg (1.4.3) - racc (1.6.0) - rack (2.2.4) - rack-test (2.0.2) - rack (>= 1.3) - rails (7.0.3.1) - actioncable (= 7.0.3.1) - actionmailbox (= 7.0.3.1) - actionmailer (= 7.0.3.1) - actionpack (= 7.0.3.1) - actiontext (= 7.0.3.1) - actionview (= 7.0.3.1) - activejob (= 7.0.3.1) - activemodel (= 7.0.3.1) - activerecord (= 7.0.3.1) - activestorage (= 7.0.3.1) - activesupport (= 7.0.3.1) - bundler (>= 1.15.0) - railties (= 7.0.3.1) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) - nokogiri (>= 1.6) - rails-html-sanitizer (1.4.3) - loofah (~> 2.3) - railties (7.0.3.1) - actionpack (= 7.0.3.1) - activesupport (= 7.0.3.1) - method_source - rake (>= 12.2) - thor (~> 1.0) - zeitwerk (~> 2.5) rainbow (3.1.1) rake (13.0.6) regexp_parser (2.5.0) @@ -176,31 +59,23 @@ GEM rubocop-performance (= 1.14.3) standardrb (1.0.1) standard - strscan (3.0.4) thor (1.2.1) - timeout (0.3.0) tzinfo (2.0.5) concurrent-ruby (~> 1.0) unicode-display_width (2.2.0) - websocket-driver (0.7.5) - websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.5) - zeitwerk (2.6.0) PLATFORMS - arm64-darwin-21 - x86_64-linux + ruby + x86_64-darwin-20 DEPENDENCIES + activerecord (~> 7.0.0) appraisal - net-imap - net-pop - net-smtp + byebug pg - rails (~> 7.0.0) sequenced! sqlite3 (~> 1.4.4) standardrb BUNDLED WITH - 2.3.16 + 2.3.17 diff --git a/gemfiles/rails_master.gemfile b/gemfiles/rails_master.gemfile index 23adb67..9c0bb8b 100644 --- a/gemfiles/rails_master.gemfile +++ b/gemfiles/rails_master.gemfile @@ -4,14 +4,8 @@ source "https://rubygems.org" gem "appraisal" gem "standardrb" -gem "rails", github: "rails/rails", branch: "main" - -group :development, :test do - gem "sqlite3", "~> 1.4.4" - gem "pg" - gem "net-imap" - gem "net-pop" - gem "net-smtp" -end +gem "sqlite3", "~> 1.4.4" +gem "pg" +gem "activerecord", github: "rails/rails", branch: "main" gemspec path: "../" diff --git a/gemfiles/rails_master.gemfile.lock b/gemfiles/rails_master.gemfile.lock index c899b09..a88a381 100644 --- a/gemfiles/rails_master.gemfile.lock +++ b/gemfiles/rails_master.gemfile.lock @@ -1,96 +1,19 @@ GIT remote: https://github.com/rails/rails.git - revision: cb5765a12751ca03866a89cf19fefcbc2d93a8ea + revision: d66441f39127c284c2fc7ac9bfe3e8270b115033 branch: main specs: - actioncable (7.1.0.alpha) - actionpack (= 7.1.0.alpha) - activesupport (= 7.1.0.alpha) - nio4r (~> 2.0) - websocket-driver (>= 0.6.1) - zeitwerk (~> 2.6) - actionmailbox (7.1.0.alpha) - actionpack (= 7.1.0.alpha) - activejob (= 7.1.0.alpha) - activerecord (= 7.1.0.alpha) - activestorage (= 7.1.0.alpha) - activesupport (= 7.1.0.alpha) - mail (>= 2.7.1) - net-imap - net-pop - net-smtp - actionmailer (7.1.0.alpha) - actionpack (= 7.1.0.alpha) - actionview (= 7.1.0.alpha) - activejob (= 7.1.0.alpha) - activesupport (= 7.1.0.alpha) - mail (~> 2.5, >= 2.5.4) - net-imap - net-pop - net-smtp - rails-dom-testing (~> 2.0) - actionpack (7.1.0.alpha) - actionview (= 7.1.0.alpha) - activesupport (= 7.1.0.alpha) - rack (~> 2.0, >= 2.2.0) - rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.1.0.alpha) - actionpack (= 7.1.0.alpha) - activerecord (= 7.1.0.alpha) - activestorage (= 7.1.0.alpha) - activesupport (= 7.1.0.alpha) - globalid (>= 0.6.0) - nokogiri (>= 1.8.5) - actionview (7.1.0.alpha) - activesupport (= 7.1.0.alpha) - builder (~> 3.1) - erubi (~> 1.11) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.1.0.alpha) - activesupport (= 7.1.0.alpha) - globalid (>= 0.3.6) activemodel (7.1.0.alpha) activesupport (= 7.1.0.alpha) activerecord (7.1.0.alpha) activemodel (= 7.1.0.alpha) activesupport (= 7.1.0.alpha) - activestorage (7.1.0.alpha) - actionpack (= 7.1.0.alpha) - activejob (= 7.1.0.alpha) - activerecord (= 7.1.0.alpha) - activesupport (= 7.1.0.alpha) - marcel (~> 1.0) - mini_mime (>= 1.1.0) activesupport (7.1.0.alpha) concurrent-ruby (~> 1.0, >= 1.0.2) connection_pool (>= 2.2.5) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) - rails (7.1.0.alpha) - actioncable (= 7.1.0.alpha) - actionmailbox (= 7.1.0.alpha) - actionmailer (= 7.1.0.alpha) - actionpack (= 7.1.0.alpha) - actiontext (= 7.1.0.alpha) - actionview (= 7.1.0.alpha) - activejob (= 7.1.0.alpha) - activemodel (= 7.1.0.alpha) - activerecord (= 7.1.0.alpha) - activestorage (= 7.1.0.alpha) - activesupport (= 7.1.0.alpha) - bundler (>= 1.15.0) - railties (= 7.1.0.alpha) - railties (7.1.0.alpha) - actionpack (= 7.1.0.alpha) - activesupport (= 7.1.0.alpha) - method_source - rake (>= 12.2) - thor (~> 1.0) - zeitwerk (~> 2.6) PATH remote: .. @@ -107,58 +30,17 @@ GEM rake thor (>= 0.14.0) ast (2.4.2) - builder (3.2.4) + byebug (11.1.3) concurrent-ruby (1.1.10) connection_pool (2.2.5) - crass (1.0.6) - digest (3.1.0) - erubi (1.11.0) - globalid (1.0.0) - activesupport (>= 5.0) i18n (1.12.0) concurrent-ruby (~> 1.0) json (2.6.2) - loofah (2.18.0) - crass (~> 1.0.2) - nokogiri (>= 1.5.9) - mail (2.7.1) - mini_mime (>= 0.1.1) - marcel (1.0.2) - method_source (1.0.0) - mini_mime (1.1.2) - minitest (5.16.2) - net-imap (0.2.3) - digest - net-protocol - strscan - net-pop (0.1.1) - digest - net-protocol - timeout - net-protocol (0.1.3) - timeout - net-smtp (0.3.1) - digest - net-protocol - timeout - nio4r (2.5.8) - nokogiri (1.13.8-arm64-darwin) - racc (~> 1.4) - nokogiri (1.13.8-x86_64-linux) - racc (~> 1.4) + minitest (5.16.3) parallel (1.22.1) parser (3.1.2.1) ast (~> 2.4.1) pg (1.4.3) - racc (1.6.0) - rack (2.2.4) - rack-test (2.0.2) - rack (>= 1.3) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) - nokogiri (>= 1.6) - rails-html-sanitizer (1.4.3) - loofah (~> 2.3) rainbow (3.1.1) rake (13.0.6) regexp_parser (2.5.0) @@ -185,31 +67,23 @@ GEM rubocop-performance (= 1.14.3) standardrb (1.0.1) standard - strscan (3.0.4) thor (1.2.1) - timeout (0.3.0) tzinfo (2.0.5) concurrent-ruby (~> 1.0) unicode-display_width (2.2.0) - websocket-driver (0.7.5) - websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.5) - zeitwerk (2.6.0) PLATFORMS - arm64-darwin-21 - x86_64-linux + ruby + x86_64-darwin-20 DEPENDENCIES + activerecord! appraisal - net-imap - net-pop - net-smtp + byebug pg - rails! sequenced! sqlite3 (~> 1.4.4) standardrb BUNDLED WITH - 2.3.16 + 2.3.17 diff --git a/lib/sequenced.rb b/lib/sequenced.rb index f073ea2..3a5df6d 100644 --- a/lib/sequenced.rb +++ b/lib/sequenced.rb @@ -1,3 +1,4 @@ +require "active_support" require "sequenced/generator" require "sequenced/acts_as_sequenced" diff --git a/sequenced.gemspec b/sequenced.gemspec index 0402348..d80ac1b 100644 --- a/sequenced.gemspec +++ b/sequenced.gemspec @@ -15,5 +15,4 @@ Gem::Specification.new do |s| s.add_dependency "activesupport", ">= 3.0" s.add_dependency "activerecord", ">= 3.0" - s.add_development_dependency "rails", ">= 3.1" end diff --git a/test/dummy/README.rdoc b/test/dummy/README.rdoc deleted file mode 100644 index 7c36f23..0000000 --- a/test/dummy/README.rdoc +++ /dev/null @@ -1,261 +0,0 @@ -== Welcome to Rails - -Rails is a web-application framework that includes everything needed to create -database-backed web applications according to the Model-View-Control pattern. - -This pattern splits the view (also called the presentation) into "dumb" -templates that are primarily responsible for inserting pre-built data in between -HTML tags. The model contains the "smart" domain objects (such as Account, -Product, Person, Post) that holds all the business logic and knows how to -persist themselves to a database. The controller handles the incoming requests -(such as Save New Account, Update Product, Show Post) by manipulating the model -and directing data to the view. - -In Rails, the model is handled by what's called an object-relational mapping -layer entitled Active Record. This layer allows you to present the data from -database rows as objects and embellish these data objects with business logic -methods. You can read more about Active Record in -link:files/vendor/rails/activerecord/README.html. - -The controller and view are handled by the Action Pack, which handles both -layers by its two parts: Action View and Action Controller. These two layers -are bundled in a single package due to their heavy interdependence. This is -unlike the relationship between the Active Record and Action Pack that is much -more separate. Each of these packages can be used independently outside of -Rails. You can read more about Action Pack in -link:files/vendor/rails/actionpack/README.html. - - -== Getting Started - -1. At the command prompt, create a new Rails application: - rails new myapp (where myapp is the application name) - -2. Change directory to myapp and start the web server: - cd myapp; rails server (run with --help for options) - -3. Go to http://localhost:3000/ and you'll see: - "Welcome aboard: You're riding Ruby on Rails!" - -4. Follow the guidelines to start developing your application. You can find -the following resources handy: - -* The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html -* Ruby on Rails Tutorial Book: http://www.railstutorial.org/ - - -== Debugging Rails - -Sometimes your application goes wrong. Fortunately there are a lot of tools that -will help you debug it and get it back on the rails. - -First area to check is the application log files. Have "tail -f" commands -running on the server.log and development.log. Rails will automatically display -debugging and runtime information to these files. Debugging info will also be -shown in the browser on requests from 127.0.0.1. - -You can also log your own messages directly into the log file from your code -using the Ruby logger class from inside your controllers. Example: - - class WeblogController < ActionController::Base - def destroy - @weblog = Weblog.find(params[:id]) - @weblog.destroy - logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!") - end - end - -The result will be a message in your log file along the lines of: - - Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1! - -More information on how to use the logger is at http://www.ruby-doc.org/core/ - -Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are -several books available online as well: - -* Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe) -* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide) - -These two books will bring you up to speed on the Ruby language and also on -programming in general. - - -== Debugger - -Debugger support is available through the debugger command when you start your -Mongrel or WEBrick server with --debugger. This means that you can break out of -execution at any point in the code, investigate and change the model, and then, -resume execution! You need to install ruby-debug to run the server in debugging -mode. With gems, use sudo gem install ruby-debug. Example: - - class WeblogController < ActionController::Base - def index - @posts = Post.all - debugger - end - end - -So the controller will accept the action, run the first line, then present you -with a IRB prompt in the server window. Here you can do things like: - - >> @posts.inspect - => "[#nil, "body"=>nil, "id"=>"1"}>, - #"Rails", "body"=>"Only ten..", "id"=>"2"}>]" - >> @posts.first.title = "hello from a debugger" - => "hello from a debugger" - -...and even better, you can examine how your runtime objects actually work: - - >> f = @posts.first - => #nil, "body"=>nil, "id"=>"1"}> - >> f. - Display all 152 possibilities? (y or n) - -Finally, when you're ready to resume execution, you can enter "cont". - - -== Console - -The console is a Ruby shell, which allows you to interact with your -application's domain model. Here you'll have all parts of the application -configured, just like it is when the application is running. You can inspect -domain models, change values, and save to the database. Starting the script -without arguments will launch it in the development environment. - -To start the console, run rails console from the application -directory. - -Options: - -* Passing the -s, --sandbox argument will rollback any modifications - made to the database. -* Passing an environment name as an argument will load the corresponding - environment. Example: rails console production. - -To reload your controllers and models after launching the console run -reload! - -More information about irb can be found at: -link:http://www.rubycentral.org/pickaxe/irb.html - - -== dbconsole - -You can go to the command line of your database directly through rails -dbconsole. You would be connected to the database with the credentials -defined in database.yml. Starting the script without arguments will connect you -to the development database. Passing an argument will connect you to a different -database, like rails dbconsole production. Currently works for MySQL, -PostgreSQL and SQLite 3. - -== Description of Contents - -The default directory structure of a generated Ruby on Rails application: - - |-- app - | |-- assets - | |-- images - | |-- javascripts - | `-- stylesheets - | |-- controllers - | |-- helpers - | |-- mailers - | |-- models - | `-- views - | `-- layouts - |-- config - | |-- environments - | |-- initializers - | `-- locales - |-- db - |-- doc - |-- lib - | `-- tasks - |-- log - |-- public - |-- script - |-- test - | |-- fixtures - | |-- functional - | |-- integration - | |-- performance - | `-- unit - |-- tmp - | |-- cache - | |-- pids - | |-- sessions - | `-- sockets - `-- vendor - |-- assets - `-- stylesheets - `-- plugins - -app - Holds all the code that's specific to this particular application. - -app/assets - Contains subdirectories for images, stylesheets, and JavaScript files. - -app/controllers - Holds controllers that should be named like weblogs_controller.rb for - automated URL mapping. All controllers should descend from - ApplicationController which itself descends from ActionController::Base. - -app/models - Holds models that should be named like post.rb. Models descend from - ActiveRecord::Base by default. - -app/views - Holds the template files for the view that should be named like - weblogs/index.html.erb for the WeblogsController#index action. All views use - eRuby syntax by default. - -app/views/layouts - Holds the template files for layouts to be used with views. This models the - common header/footer method of wrapping views. In your views, define a layout - using the layout :default and create a file named default.html.erb. - Inside default.html.erb, call <% yield %> to render the view using this - layout. - -app/helpers - Holds view helpers that should be named like weblogs_helper.rb. These are - generated for you automatically when using generators for controllers. - Helpers can be used to wrap functionality for your views into methods. - -config - Configuration files for the Rails environment, the routing map, the database, - and other dependencies. - -db - Contains the database schema in schema.rb. db/migrate contains all the - sequence of Migrations for your schema. - -doc - This directory is where your application documentation will be stored when - generated using rake doc:app - -lib - Application specific libraries. Basically, any kind of custom code that - doesn't belong under controllers, models, or helpers. This directory is in - the load path. - -public - The directory available for the web server. Also contains the dispatchers and the - default HTML files. This should be set as the DOCUMENT_ROOT of your web - server. - -script - Helper scripts for automation and generation. - -test - Unit and functional tests along with fixtures. When using the rails generate - command, template test files will be generated for you and placed in this - directory. - -vendor - External libraries that the application depends on. Also includes the plugins - subdirectory. If the app has frozen rails, those gems also go here, under - vendor/rails/. This directory is in the load path. diff --git a/test/dummy/Rakefile b/test/dummy/Rakefile deleted file mode 100644 index 811701a..0000000 --- a/test/dummy/Rakefile +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env rake -# Add your own tasks in files placed in lib/tasks ending in .rake, -# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. - -require File.expand_path("../config/application", __FILE__) - -Dummy::Application.load_tasks diff --git a/test/dummy/app/assets/config/manifest.js b/test/dummy/app/assets/config/manifest.js deleted file mode 100644 index e69de29..0000000 diff --git a/test/dummy/app/assets/javascripts/application.js b/test/dummy/app/assets/javascripts/application.js deleted file mode 100644 index 15ebed9..0000000 --- a/test/dummy/app/assets/javascripts/application.js +++ /dev/null @@ -1,13 +0,0 @@ -// This is a manifest file that'll be compiled into application.js, which will include all the files -// listed below. -// -// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, -// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. -// -// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the -// the compiled file. -// -// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD -// GO AFTER THE REQUIRES BELOW. -// -//= require_tree . diff --git a/test/dummy/app/assets/stylesheets/application.css b/test/dummy/app/assets/stylesheets/application.css deleted file mode 100644 index 3b5cc66..0000000 --- a/test/dummy/app/assets/stylesheets/application.css +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This is a manifest file that'll be compiled into application.css, which will include all the files - * listed below. - * - * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, - * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. - * - * You're free to add application-wide styles to this file and they'll appear at the top of the - * compiled file, but it's generally better to create a new file per style scope. - * - *= require_self - *= require_tree . -*/ diff --git a/test/dummy/app/controllers/application_controller.rb b/test/dummy/app/controllers/application_controller.rb deleted file mode 100644 index e8065d9..0000000 --- a/test/dummy/app/controllers/application_controller.rb +++ /dev/null @@ -1,3 +0,0 @@ -class ApplicationController < ActionController::Base - protect_from_forgery -end diff --git a/test/dummy/app/helpers/application_helper.rb b/test/dummy/app/helpers/application_helper.rb deleted file mode 100644 index de6be79..0000000 --- a/test/dummy/app/helpers/application_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module ApplicationHelper -end diff --git a/test/dummy/app/mailers/.gitkeep b/test/dummy/app/mailers/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/test/dummy/app/models/.gitkeep b/test/dummy/app/models/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/test/dummy/app/models/account.rb b/test/dummy/app/models/account.rb deleted file mode 100644 index edbaf8f..0000000 --- a/test/dummy/app/models/account.rb +++ /dev/null @@ -1,6 +0,0 @@ -class Account < ActiveRecord::Base - has_many :users - has_many :invoices - has_many :orders - has_many :addresses -end diff --git a/test/dummy/app/models/address.rb b/test/dummy/app/models/address.rb deleted file mode 100644 index a07ca3d..0000000 --- a/test/dummy/app/models/address.rb +++ /dev/null @@ -1,4 +0,0 @@ -class Address < ActiveRecord::Base - belongs_to :account - acts_as_sequenced scope: :account_id -end diff --git a/test/dummy/app/models/answer.rb b/test/dummy/app/models/answer.rb deleted file mode 100644 index 0796f91..0000000 --- a/test/dummy/app/models/answer.rb +++ /dev/null @@ -1,4 +0,0 @@ -class Answer < ActiveRecord::Base - belongs_to :question - acts_as_sequenced scope: :question_id -end diff --git a/test/dummy/app/models/comment.rb b/test/dummy/app/models/comment.rb deleted file mode 100644 index 3e62e5d..0000000 --- a/test/dummy/app/models/comment.rb +++ /dev/null @@ -1,8 +0,0 @@ -class Comment < ActiveRecord::Base - belongs_to :question - acts_as_sequenced scope: :question_id - - def self.default_scope - order("question_id ASC") - end -end diff --git a/test/dummy/app/models/concurrent_badger.rb b/test/dummy/app/models/concurrent_badger.rb deleted file mode 100644 index 075fcfc..0000000 --- a/test/dummy/app/models/concurrent_badger.rb +++ /dev/null @@ -1,3 +0,0 @@ -class ConcurrentBadger < ActiveRecord::Base - acts_as_sequenced scope: :burrow_id -end diff --git a/test/dummy/app/models/doppelganger.rb b/test/dummy/app/models/doppelganger.rb deleted file mode 100644 index 2cf02e2..0000000 --- a/test/dummy/app/models/doppelganger.rb +++ /dev/null @@ -1,4 +0,0 @@ -class Doppelganger < ActiveRecord::Base - acts_as_sequenced column: :sequential_id_one - acts_as_sequenced column: :sequential_id_two, start_at: 1000 -end diff --git a/test/dummy/app/models/email.rb b/test/dummy/app/models/email.rb deleted file mode 100644 index 5bbbcb0..0000000 --- a/test/dummy/app/models/email.rb +++ /dev/null @@ -1,4 +0,0 @@ -class Email < ActiveRecord::Base - belongs_to :emailable, polymorphic: true - acts_as_sequenced scope: [:emailable_id, :emailable_type] -end diff --git a/test/dummy/app/models/invoice.rb b/test/dummy/app/models/invoice.rb deleted file mode 100644 index 1a8080d..0000000 --- a/test/dummy/app/models/invoice.rb +++ /dev/null @@ -1,4 +0,0 @@ -class Invoice < ActiveRecord::Base - belongs_to :account - acts_as_sequenced scope: :account_id, start_at: 1000 -end diff --git a/test/dummy/app/models/monster.rb b/test/dummy/app/models/monster.rb deleted file mode 100644 index e28f7fe..0000000 --- a/test/dummy/app/models/monster.rb +++ /dev/null @@ -1,3 +0,0 @@ -class Monster < ActiveRecord::Base - acts_as_sequenced -end diff --git a/test/dummy/app/models/order.rb b/test/dummy/app/models/order.rb deleted file mode 100644 index 57fbde7..0000000 --- a/test/dummy/app/models/order.rb +++ /dev/null @@ -1,4 +0,0 @@ -class Order < ActiveRecord::Base - belongs_to :account - acts_as_sequenced scope: :non_existent_column -end diff --git a/test/dummy/app/models/policeman.rb b/test/dummy/app/models/policeman.rb deleted file mode 100644 index 01062db..0000000 --- a/test/dummy/app/models/policeman.rb +++ /dev/null @@ -1,5 +0,0 @@ -class Policeman < ActiveRecord::Base - acts_as_sequenced - - validates :sequential_id, presence: true -end diff --git a/test/dummy/app/models/product.rb b/test/dummy/app/models/product.rb deleted file mode 100644 index 7a32ec2..0000000 --- a/test/dummy/app/models/product.rb +++ /dev/null @@ -1,8 +0,0 @@ -class Product < ActiveRecord::Base - belongs_to :account - acts_as_sequenced scope: :account_id, start_at: lambda { |r| r.computed_start_value } - - def computed_start_value - 1 + 2 - end -end diff --git a/test/dummy/app/models/question.rb b/test/dummy/app/models/question.rb deleted file mode 100644 index b7d9c07..0000000 --- a/test/dummy/app/models/question.rb +++ /dev/null @@ -1,4 +0,0 @@ -class Question < ActiveRecord::Base - has_many :answers - has_many :comments -end diff --git a/test/dummy/app/models/rating.rb b/test/dummy/app/models/rating.rb deleted file mode 100644 index 24c493b..0000000 --- a/test/dummy/app/models/rating.rb +++ /dev/null @@ -1,3 +0,0 @@ -class Rating < ActiveRecord::Base - acts_as_sequenced scope: :comment_id, skip: lambda { |r| r.score == 0 } -end diff --git a/test/dummy/app/models/subscription.rb b/test/dummy/app/models/subscription.rb deleted file mode 100644 index e4c3a10..0000000 --- a/test/dummy/app/models/subscription.rb +++ /dev/null @@ -1,3 +0,0 @@ -class Subscription < ActiveRecord::Base - acts_as_sequenced -end diff --git a/test/dummy/app/models/user.rb b/test/dummy/app/models/user.rb deleted file mode 100644 index 7fc1ef4..0000000 --- a/test/dummy/app/models/user.rb +++ /dev/null @@ -1,4 +0,0 @@ -class User < ActiveRecord::Base - belongs_to :account - acts_as_sequenced scope: :account_id, column: :custom_sequential_id -end diff --git a/test/dummy/app/models/werewolf.rb b/test/dummy/app/models/werewolf.rb deleted file mode 100644 index 959896b..0000000 --- a/test/dummy/app/models/werewolf.rb +++ /dev/null @@ -1,2 +0,0 @@ -class Werewolf < Monster -end diff --git a/test/dummy/app/models/with_custom_primary_key.rb b/test/dummy/app/models/with_custom_primary_key.rb deleted file mode 100644 index ba01851..0000000 --- a/test/dummy/app/models/with_custom_primary_key.rb +++ /dev/null @@ -1,6 +0,0 @@ -class WithCustomPrimaryKey < ActiveRecord::Base - self.primary_key = :legacy_id - - belongs_to :account - acts_as_sequenced scope: :account_id -end diff --git a/test/dummy/app/models/zombie.rb b/test/dummy/app/models/zombie.rb deleted file mode 100644 index e3bd9c7..0000000 --- a/test/dummy/app/models/zombie.rb +++ /dev/null @@ -1,2 +0,0 @@ -class Zombie < Monster -end diff --git a/test/dummy/app/views/layouts/application.html.erb b/test/dummy/app/views/layouts/application.html.erb deleted file mode 100644 index 4cab268..0000000 --- a/test/dummy/app/views/layouts/application.html.erb +++ /dev/null @@ -1,14 +0,0 @@ - - - - Dummy - <%= stylesheet_link_tag "application", :media => "all" %> - <%= javascript_include_tag "application" %> - <%= csrf_meta_tags %> - - - -<%= yield %> - - - diff --git a/test/dummy/config.ru b/test/dummy/config.ru deleted file mode 100644 index 08dd501..0000000 --- a/test/dummy/config.ru +++ /dev/null @@ -1,4 +0,0 @@ -# This file is used by Rack-based servers to start the application. - -require ::File.expand_path("../config/environment", __FILE__) -run Dummy::Application diff --git a/test/dummy/config/application.rb b/test/dummy/config/application.rb deleted file mode 100644 index 54abc71..0000000 --- a/test/dummy/config/application.rb +++ /dev/null @@ -1,43 +0,0 @@ -require File.expand_path("../boot", __FILE__) - -require "rails/all" - -Bundler.require -require "sequenced" - -module Dummy - class Application < Rails::Application - # Settings in config/environments/* take precedence over those specified here. - # Application configuration should go into files in config/initializers - # -- all .rb files in that directory are automatically loaded. - - # Custom directories with classes and modules you want to be autoloadable. - # config.autoload_paths += %W(#{config.root}/extras) - - # Only load the plugins named here, in the order given (default is alphabetical). - # :all can be used as a placeholder for all plugins not explicitly named. - # config.plugins = [ :exception_notification, :ssl_requirement, :all ] - - # Activate observers that should always be running. - # config.active_record.observers = :cacher, :garbage_collector, :forum_observer - - # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. - # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. - # config.time_zone = 'Central Time (US & Canada)' - - # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. - # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] - # config.i18n.default_locale = :de - - # Use SQL instead of Active Record's schema dumper when creating the database. - # This is necessary if your schema can't be completely dumped by the schema dumper, - # 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 - end -end diff --git a/test/dummy/config/boot.rb b/test/dummy/config/boot.rb deleted file mode 100644 index 122ff3c..0000000 --- a/test/dummy/config/boot.rb +++ /dev/null @@ -1,10 +0,0 @@ -require "rubygems" -gemfile = File.expand_path("../../../../Gemfile", __FILE__) - -if File.exist?(gemfile) - ENV["BUNDLE_GEMFILE"] = gemfile - require "bundler" - Bundler.setup -end - -$:.unshift File.expand_path("../../../../lib", __FILE__) diff --git a/test/dummy/config/database.yml b/test/dummy/config/database.yml deleted file mode 100644 index 0f358e0..0000000 --- a/test/dummy/config/database.yml +++ /dev/null @@ -1,25 +0,0 @@ -# example_travisci_multi/config/database.yml -sqlite: - adapter: sqlite3 - database: db/test.sqlite3 - -mysql: - adapter: mysql2 - username: root - password: - -postgresql: - adapter: postgresql - username: postgres - password: - min_messages: ERROR - -development: - database: sequenced_test - adapter: sqlite3 - database: db/development.sqlite3 - -test: - database: sequenced_test - adapter: sqlite3 - database: db/test.sqlite3 diff --git a/test/dummy/config/environment.rb b/test/dummy/config/environment.rb deleted file mode 100644 index c956c8a..0000000 --- a/test/dummy/config/environment.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Load the rails application -require File.expand_path("../application", __FILE__) - -# Initialize the rails application -Dummy::Application.initialize! diff --git a/test/dummy/config/environments/development.rb b/test/dummy/config/environments/development.rb deleted file mode 100644 index b8e5d31..0000000 --- a/test/dummy/config/environments/development.rb +++ /dev/null @@ -1,33 +0,0 @@ -Dummy::Application.configure do - # Settings specified here will take precedence over those in config/application.rb - - # In the development environment your application's code is reloaded on - # every request. This slows down response time but is perfect for development - # since you don't have to restart the web server when you make code changes. - config.cache_classes = false - - # Log error messages when you accidentally call methods on nil. - config.whiny_nils = true - - # Show full error reports and disable caching - config.consider_all_requests_local = true - config.action_controller.perform_caching = false - - # Don't care if the mailer can't send - config.action_mailer.raise_delivery_errors = false - - # Print deprecation notices to the Rails logger - config.active_support.deprecation = :log - - # Only use best-standards-support built into browsers - config.action_dispatch.best_standards_support = :builtin - - # Do not compress assets - config.assets.compress = false - - # Expands the lines which load the assets - config.assets.debug = true - - # Required for Rails >= 4.2 - config.eager_load = true -end diff --git a/test/dummy/config/environments/production.rb b/test/dummy/config/environments/production.rb deleted file mode 100644 index 2c0ce70..0000000 --- a/test/dummy/config/environments/production.rb +++ /dev/null @@ -1,67 +0,0 @@ -Dummy::Application.configure do - # Settings specified here will take precedence over those in config/application.rb - - # Code is not reloaded between requests - config.cache_classes = true - - # Full error reports are disabled and caching is turned on - config.consider_all_requests_local = false - config.action_controller.perform_caching = true - - # Disable Rails's static asset server (Apache or nginx will already do this) - config.serve_static_files = false - - # Compress JavaScripts and CSS - config.assets.compress = true - - # Don't fallback to assets pipeline if a precompiled asset is missed - config.assets.compile = false - - # Generate digests for assets URLs - config.assets.digest = true - - # Defaults to Rails.root.join("public/assets") - # config.assets.manifest = YOUR_PATH - - # Specifies the header that your server uses for sending files - # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache - # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx - - # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. - # config.force_ssl = true - - # See everything in the log (default is :info) - # config.log_level = :debug - - # Prepend all log lines with the following tags - # config.log_tags = [ :subdomain, :uuid ] - - # Use a different logger for distributed setups - # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) - - # Use a different cache store in production - # config.cache_store = :mem_cache_store - - # Enable serving of images, stylesheets, and JavaScripts from an asset server - # config.action_controller.asset_host = "http://assets.example.com" - - # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) - # config.assets.precompile += %w( search.js ) - - # Disable delivery errors, bad email addresses will be ignored - # config.action_mailer.raise_delivery_errors = false - - # Enable threaded mode - # config.threadsafe! - - # Enable locale fallbacks for I18n (makes lookups for any locale fall back to - # the I18n.default_locale when a translation can not be found) - config.i18n.fallbacks = true - - # Send deprecation notices to registered listeners - config.active_support.deprecation = :notify - - # 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 -end diff --git a/test/dummy/config/environments/test.rb b/test/dummy/config/environments/test.rb deleted file mode 100644 index 0be34f6..0000000 --- a/test/dummy/config/environments/test.rb +++ /dev/null @@ -1,43 +0,0 @@ -Dummy::Application.configure do - # Settings specified here will take precedence over those in config/application.rb - config.eager_load = false - - # The test environment is used exclusively to run your application's - # test suite. You never need to work with it otherwise. Remember that - # your test database is "scratch space" for the test suite and is wiped - # and recreated between test runs. Don't rely on the data there! - config.cache_classes = true - - # Configure static asset server for tests with Cache-Control for performance - config.serve_static_files = true - config.static_cache_control = "public, max-age=3600" - - # Log error messages when you accidentally call methods on nil - config.whiny_nils = true - - # Show full error reports and disable caching - config.consider_all_requests_local = true - config.action_controller.perform_caching = false - - # Raise exceptions instead of rendering exception templates - config.action_dispatch.show_exceptions = false - - # Disable request forgery protection in test environment - config.action_controller.allow_forgery_protection = false - - # Tell Action Mailer not to deliver emails to the real world. - # The :test delivery method accumulates sent emails in the - # 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 - - # Required for Rails >= 4.2 - config.eager_load = true - - config.active_support.test_order = :random -end diff --git a/test/dummy/config/initializers/backtrace_silencers.rb b/test/dummy/config/initializers/backtrace_silencers.rb deleted file mode 100644 index 59385cd..0000000 --- a/test/dummy/config/initializers/backtrace_silencers.rb +++ /dev/null @@ -1,7 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. -# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } - -# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. -# Rails.backtrace_cleaner.remove_silencers! diff --git a/test/dummy/config/initializers/inflections.rb b/test/dummy/config/initializers/inflections.rb deleted file mode 100644 index 5d8d9be..0000000 --- a/test/dummy/config/initializers/inflections.rb +++ /dev/null @@ -1,15 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Add new inflection rules using the following format -# (all these examples are active by default): -# ActiveSupport::Inflector.inflections do |inflect| -# inflect.plural /^(ox)$/i, '\1en' -# inflect.singular /^(ox)en/i, '\1' -# inflect.irregular 'person', 'people' -# inflect.uncountable %w( fish sheep ) -# end -# -# These inflection rules are supported but not enabled by default: -# ActiveSupport::Inflector.inflections do |inflect| -# inflect.acronym 'RESTful' -# end diff --git a/test/dummy/config/initializers/mime_types.rb b/test/dummy/config/initializers/mime_types.rb deleted file mode 100644 index 72aca7e..0000000 --- a/test/dummy/config/initializers/mime_types.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Add new mime types for use in respond_to blocks: -# Mime::Type.register "text/richtext", :rtf -# Mime::Type.register_alias "text/html", :iphone diff --git a/test/dummy/config/initializers/secret_token.rb b/test/dummy/config/initializers/secret_token.rb deleted file mode 100644 index cca5d7e..0000000 --- a/test/dummy/config/initializers/secret_token.rb +++ /dev/null @@ -1,7 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Your secret key for verifying the integrity of signed cookies. -# If you change this key, all old signed cookies will become invalid! -# Make sure the secret is at least 30 characters and all random, -# no regular words or you'll be exposed to dictionary attacks. -Dummy::Application.config.secret_token = "f5ba9bf1480dae7bd30f8eb0c2decd356dd427e7d8ee82c5418e1998cc4115c6ba626ceb15f70feb1d14ecb55e9727497b96b122e2a6099170ea5c45ce2279e3" diff --git a/test/dummy/config/initializers/session_store.rb b/test/dummy/config/initializers/session_store.rb deleted file mode 100644 index 7fef319..0000000 --- a/test/dummy/config/initializers/session_store.rb +++ /dev/null @@ -1,8 +0,0 @@ -# Be sure to restart your server when you modify this file. - -Dummy::Application.config.session_store :cookie_store, key: "_dummy_session" - -# Use the database for sessions instead of the cookie-based default, -# which shouldn't be used to store highly confidential information -# (create the session table with "rails generate session_migration") -# Dummy::Application.config.session_store :active_record_store diff --git a/test/dummy/config/initializers/wrap_parameters.rb b/test/dummy/config/initializers/wrap_parameters.rb deleted file mode 100644 index 999df20..0000000 --- a/test/dummy/config/initializers/wrap_parameters.rb +++ /dev/null @@ -1,14 +0,0 @@ -# Be sure to restart your server when you modify this file. -# -# This file contains settings for ActionController::ParamsWrapper which -# is enabled by default. - -# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. -ActiveSupport.on_load(:action_controller) do - wrap_parameters format: [:json] -end - -# Disable root element in JSON by default. -ActiveSupport.on_load(:active_record) do - self.include_root_in_json = false -end diff --git a/test/dummy/config/locales/en.yml b/test/dummy/config/locales/en.yml deleted file mode 100644 index 179c14c..0000000 --- a/test/dummy/config/locales/en.yml +++ /dev/null @@ -1,5 +0,0 @@ -# Sample localization file for English. Add more files in this directory for other locales. -# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. - -en: - hello: "Hello world" diff --git a/test/dummy/config/routes.rb b/test/dummy/config/routes.rb deleted file mode 100644 index eb8579b..0000000 --- a/test/dummy/config/routes.rb +++ /dev/null @@ -1,58 +0,0 @@ -Dummy::Application.routes.draw do - # The priority is based upon order of creation: - # first created -> highest priority. - - # Sample of regular route: - # match 'products/:id' => 'catalog#view' - # Keep in mind you can assign values other than :controller and :action - - # Sample of named route: - # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase - # This route can be invoked with purchase_url(:id => product.id) - - # Sample resource route (maps HTTP verbs to controller actions automatically): - # resources :products - - # Sample resource route with options: - # resources :products do - # member do - # get 'short' - # post 'toggle' - # end - # - # collection do - # get 'sold' - # end - # end - - # Sample resource route with sub-resources: - # resources :products do - # resources :comments, :sales - # resource :seller - # end - - # Sample resource route with more complex sub-resources - # resources :products do - # resources :comments - # resources :sales do - # get 'recent', :on => :collection - # end - # end - - # Sample resource route within a namespace: - # namespace :admin do - # # Directs /admin/products/* to Admin::ProductsController - # # (app/controllers/admin/products_controller.rb) - # resources :products - # end - - # You can have the root of your site routed with "root" - # just remember to delete public/index.html. - # root :to => 'welcome#index' - - # See how all your routes lay out with "rake routes" - - # This is a legacy wild controller route that's not recommended for RESTful applications. - # Note: This route will make all actions in every controller accessible via GET requests. - # match ':controller(/:action(/:id))(.:format)' -end diff --git a/test/dummy/config/storage.yml b/test/dummy/config/storage.yml deleted file mode 100644 index e69de29..0000000 diff --git a/test/dummy/db/migrate/20120219165346_create_questions.rb b/test/dummy/db/migrate/20120219165346_create_questions.rb deleted file mode 100644 index 5caad9c..0000000 --- a/test/dummy/db/migrate/20120219165346_create_questions.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateQuestions < ActiveRecord::Migration[4.2] - def change - create_table :questions do |t| - t.string :summary - t.text :body - - t.timestamps - end - end -end diff --git a/test/dummy/db/migrate/20120219165548_create_answers.rb b/test/dummy/db/migrate/20120219165548_create_answers.rb deleted file mode 100644 index 288f736..0000000 --- a/test/dummy/db/migrate/20120219165548_create_answers.rb +++ /dev/null @@ -1,13 +0,0 @@ -class CreateAnswers < ActiveRecord::Migration[4.2] - def change - create_table :answers do |t| - t.references :question - t.text :body - t.integer :sequential_id - - t.timestamps - end - add_index :answers, :question_id - add_index :answers, :sequential_id - end -end diff --git a/test/dummy/db/migrate/20120219171957_create_accounts.rb b/test/dummy/db/migrate/20120219171957_create_accounts.rb deleted file mode 100644 index 18fdda9..0000000 --- a/test/dummy/db/migrate/20120219171957_create_accounts.rb +++ /dev/null @@ -1,9 +0,0 @@ -class CreateAccounts < ActiveRecord::Migration[4.2] - def change - create_table :accounts do |t| - t.string :name - - t.timestamps - end - end -end diff --git a/test/dummy/db/migrate/20120219172039_create_invoices.rb b/test/dummy/db/migrate/20120219172039_create_invoices.rb deleted file mode 100644 index a0d709f..0000000 --- a/test/dummy/db/migrate/20120219172039_create_invoices.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateInvoices < ActiveRecord::Migration[4.2] - def change - create_table :invoices do |t| - t.integer :amount - t.integer :sequential_id - t.references :account - - t.timestamps - end - add_index :invoices, :account_id - end -end diff --git a/test/dummy/db/migrate/20120219172922_create_orders.rb b/test/dummy/db/migrate/20120219172922_create_orders.rb deleted file mode 100644 index e1ffcdf..0000000 --- a/test/dummy/db/migrate/20120219172922_create_orders.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateOrders < ActiveRecord::Migration[4.2] - def change - create_table :orders do |t| - t.string :product - t.references :account - - t.timestamps - end - end -end diff --git a/test/dummy/db/migrate/20120219174931_create_subscriptions.rb b/test/dummy/db/migrate/20120219174931_create_subscriptions.rb deleted file mode 100644 index fbd4353..0000000 --- a/test/dummy/db/migrate/20120219174931_create_subscriptions.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateSubscriptions < ActiveRecord::Migration[4.2] - def change - create_table :subscriptions do |t| - t.string :plan - t.integer :sequential_id - - t.timestamps - end - end -end diff --git a/test/dummy/db/migrate/20120219175744_create_users.rb b/test/dummy/db/migrate/20120219175744_create_users.rb deleted file mode 100644 index fbad15a..0000000 --- a/test/dummy/db/migrate/20120219175744_create_users.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateUsers < ActiveRecord::Migration[4.2] - def change - create_table :users do |t| - t.references :account - t.string :name - t.integer :custom_sequential_id - - t.timestamps - end - add_index :users, :account_id - end -end diff --git a/test/dummy/db/migrate/20120219232323_create_addresses.rb b/test/dummy/db/migrate/20120219232323_create_addresses.rb deleted file mode 100644 index 2883f67..0000000 --- a/test/dummy/db/migrate/20120219232323_create_addresses.rb +++ /dev/null @@ -1,9 +0,0 @@ -class CreateAddresses < ActiveRecord::Migration[4.2] - def change - create_table :addresses do |t| - t.references :account - t.string :city - t.timestamps - end - end -end diff --git a/test/dummy/db/migrate/20120220000804_create_comments.rb b/test/dummy/db/migrate/20120220000804_create_comments.rb deleted file mode 100644 index a8b8c04..0000000 --- a/test/dummy/db/migrate/20120220000804_create_comments.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateComments < ActiveRecord::Migration[4.2] - def change - create_table :comments do |t| - t.references :question - t.text :body - t.integer :sequential_id - - t.timestamps - end - add_index :comments, :question_id - end -end diff --git a/test/dummy/db/migrate/20130411225444_create_emails.rb b/test/dummy/db/migrate/20130411225444_create_emails.rb deleted file mode 100644 index 522ee90..0000000 --- a/test/dummy/db/migrate/20130411225444_create_emails.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateEmails < ActiveRecord::Migration[4.2] - def change - create_table :emails do |t| - t.string :emailable_type - t.integer :emailable_id - t.integer :sequential_id - t.string :address - - t.timestamps - end - end -end diff --git a/test/dummy/db/migrate/20130715002029_create_ratings.rb b/test/dummy/db/migrate/20130715002029_create_ratings.rb deleted file mode 100644 index 767fad6..0000000 --- a/test/dummy/db/migrate/20130715002029_create_ratings.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateRatings < ActiveRecord::Migration[4.2] - def change - create_table :ratings do |t| - t.references :comment - t.integer :score - t.integer :sequential_id - t.timestamps - end - end -end diff --git a/test/dummy/db/migrate/20130730004055_create_products.rb b/test/dummy/db/migrate/20130730004055_create_products.rb deleted file mode 100644 index 653b9e2..0000000 --- a/test/dummy/db/migrate/20130730004055_create_products.rb +++ /dev/null @@ -1,9 +0,0 @@ -class CreateProducts < ActiveRecord::Migration[4.2] - def change - create_table :products do |t| - t.references :account - t.integer :sequential_id - t.timestamps - end - end -end diff --git a/test/dummy/db/migrate/20131226000000_create_monsters.rb b/test/dummy/db/migrate/20131226000000_create_monsters.rb deleted file mode 100644 index 28293e0..0000000 --- a/test/dummy/db/migrate/20131226000000_create_monsters.rb +++ /dev/null @@ -1,9 +0,0 @@ -class CreateMonsters < ActiveRecord::Migration[4.2] - def change - create_table :monsters do |t| - t.integer :sequential_id - t.string :type - t.timestamps - end - end -end diff --git a/test/dummy/db/migrate/20140404195334_create_policemen.rb b/test/dummy/db/migrate/20140404195334_create_policemen.rb deleted file mode 100644 index fb53e59..0000000 --- a/test/dummy/db/migrate/20140404195334_create_policemen.rb +++ /dev/null @@ -1,9 +0,0 @@ -class CreatePolicemen < ActiveRecord::Migration[4.2] - def change - create_table :policemen do |t| - t.integer :sequential_id - - t.timestamps - end - end -end diff --git a/test/dummy/db/migrate/20151120190645_create_concurrent_badgers.rb b/test/dummy/db/migrate/20151120190645_create_concurrent_badgers.rb deleted file mode 100644 index 26ac53f..0000000 --- a/test/dummy/db/migrate/20151120190645_create_concurrent_badgers.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateConcurrentBadgers < ActiveRecord::Migration[4.2] - def change - create_table :concurrent_badgers do |t| - t.integer :sequential_id, null: false - t.integer :burrow_id - end - - add_index :concurrent_badgers, [:sequential_id, :burrow_id], unique: true, name: "unique_concurrent" - end -end diff --git a/test/dummy/db/migrate/20160118182655_create_doppelgangers.rb b/test/dummy/db/migrate/20160118182655_create_doppelgangers.rb deleted file mode 100644 index 3c6aff1..0000000 --- a/test/dummy/db/migrate/20160118182655_create_doppelgangers.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateDoppelgangers < ActiveRecord::Migration[4.2] - def change - create_table :doppelgangers do |t| - t.integer :sequential_id_one - t.integer :sequential_id_two - - t.timestamps null: false - end - end -end diff --git a/test/dummy/db/migrate/20190216124804_create_with_custom_primary_key.rb b/test/dummy/db/migrate/20190216124804_create_with_custom_primary_key.rb deleted file mode 100644 index b7ba672..0000000 --- a/test/dummy/db/migrate/20190216124804_create_with_custom_primary_key.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateWithCustomPrimaryKey < ActiveRecord::Migration[5.2] - def change - create_table :with_custom_primary_keys, id: :integer, primary_key: :legacy_id do |t| - t.integer :sequential_id - t.references :account - end - end -end diff --git a/test/dummy/db/schema.rb b/test/dummy/db/schema.rb deleted file mode 100644 index b6f85c3..0000000 --- a/test/dummy/db/schema.rb +++ /dev/null @@ -1,140 +0,0 @@ -# This file is auto-generated from the current state of the database. Instead -# of editing this file, please use the migrations feature of Active Record to -# incrementally modify your database, and then regenerate this schema definition. -# -# Note that this schema.rb definition is the authoritative source for your -# database schema. If you need to create the application database on another -# system, you should be using db:schema:load, not running all the migrations -# from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). -# -# It's strongly recommended that you check this file into your version control system. - -ActiveRecord::Schema.define(version: 2019_02_16_124804) do - create_table "accounts", force: :cascade do |t| - t.string "name" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "addresses", force: :cascade do |t| - t.integer "account_id" - t.string "city" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "answers", force: :cascade do |t| - t.integer "question_id" - t.text "body" - t.integer "sequential_id" - t.datetime "created_at" - t.datetime "updated_at" - t.index ["question_id"], name: "index_answers_on_question_id" - t.index ["sequential_id"], name: "index_answers_on_sequential_id" - end - - create_table "comments", force: :cascade do |t| - t.integer "question_id" - t.text "body" - t.integer "sequential_id" - t.datetime "created_at" - t.datetime "updated_at" - t.index ["question_id"], name: "index_comments_on_question_id" - end - - create_table "concurrent_badgers", force: :cascade do |t| - t.integer "sequential_id", null: false - t.integer "burrow_id" - t.index ["sequential_id", "burrow_id"], name: "unique_concurrent", unique: true - end - - create_table "doppelgangers", force: :cascade do |t| - t.integer "sequential_id_one" - t.integer "sequential_id_two" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "emails", force: :cascade do |t| - t.string "emailable_type" - t.integer "emailable_id" - t.integer "sequential_id" - t.string "address" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "invoices", force: :cascade do |t| - t.integer "amount" - t.integer "sequential_id" - t.integer "account_id" - t.datetime "created_at" - t.datetime "updated_at" - t.index ["account_id"], name: "index_invoices_on_account_id" - end - - create_table "monsters", force: :cascade do |t| - t.integer "sequential_id" - t.string "type" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "orders", force: :cascade do |t| - t.string "product" - t.integer "account_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "policemen", force: :cascade do |t| - t.integer "sequential_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "products", force: :cascade do |t| - t.integer "account_id" - t.integer "sequential_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "questions", force: :cascade do |t| - t.string "summary" - t.text "body" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "ratings", force: :cascade do |t| - t.integer "comment_id" - t.integer "score" - t.integer "sequential_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "subscriptions", force: :cascade do |t| - t.string "plan" - t.integer "sequential_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "users", force: :cascade do |t| - t.integer "account_id" - t.string "name" - t.integer "custom_sequential_id" - t.datetime "created_at" - t.datetime "updated_at" - t.index ["account_id"], name: "index_users_on_account_id" - end - - create_table "with_custom_primary_keys", primary_key: "legacy_id", force: :cascade do |t| - t.integer "sequential_id" - t.integer "account_id" - t.index ["account_id"], name: "index_with_custom_primary_keys_on_account_id" - end -end diff --git a/test/dummy/lib/assets/.gitkeep b/test/dummy/lib/assets/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/test/dummy/log/.gitkeep b/test/dummy/log/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/test/dummy/public/404.html b/test/dummy/public/404.html deleted file mode 100644 index 9a48320..0000000 --- a/test/dummy/public/404.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - The page you were looking for doesn't exist (404) - - - - - -
-

The page you were looking for doesn't exist.

-

You may have mistyped the address or the page may have moved.

-
- - diff --git a/test/dummy/public/422.html b/test/dummy/public/422.html deleted file mode 100644 index 83660ab..0000000 --- a/test/dummy/public/422.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - The change you wanted was rejected (422) - - - - - -
-

The change you wanted was rejected.

-

Maybe you tried to change something you didn't have access to.

-
- - diff --git a/test/dummy/public/500.html b/test/dummy/public/500.html deleted file mode 100644 index f3648a0..0000000 --- a/test/dummy/public/500.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - We're sorry, but something went wrong (500) - - - - - -
-

We're sorry, but something went wrong.

-
- - diff --git a/test/dummy/public/favicon.ico b/test/dummy/public/favicon.ico deleted file mode 100644 index e69de29..0000000 diff --git a/test/dummy/script/rails b/test/dummy/script/rails deleted file mode 100755 index 9a5a81d..0000000 --- a/test/dummy/script/rails +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env ruby -# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. - -APP_PATH = File.expand_path("../../config/application", __FILE__) -require File.expand_path("../../config/boot", __FILE__) -require "rails/commands" diff --git a/test/multiple_sequences_test.rb b/test/multiple_sequences_test.rb index 738600e..868bbea 100644 --- a/test/multiple_sequences_test.rb +++ b/test/multiple_sequences_test.rb @@ -1,6 +1,10 @@ require "test_helper" class MultipleSequencesTest < ActiveSupport::TestCase + def teardown + Doppelganger.delete_all + end + test "works with simple multiple sequences" do doppelganger = Doppelganger.create! assert_equal 1, doppelganger.sequential_id_one diff --git a/test/support/database.yml b/test/support/database.yml new file mode 100644 index 0000000..4e43919 --- /dev/null +++ b/test/support/database.yml @@ -0,0 +1,9 @@ +sqlite3: + adapter: sqlite3 + database: test/db.sqlite3 + +postgresql: + adapter: postgresql + database: sequenced_test + username: postgres + password: postgres diff --git a/test/support/models.rb b/test/support/models.rb new file mode 100644 index 0000000..02026f4 --- /dev/null +++ b/test/support/models.rb @@ -0,0 +1,99 @@ +class Account < ActiveRecord::Base + has_many :users + has_many :invoices + has_many :orders + has_many :addresses +end + +class Address < ActiveRecord::Base + belongs_to :account + acts_as_sequenced scope: :account_id +end + +class Answer < ActiveRecord::Base + belongs_to :question + acts_as_sequenced scope: :question_id +end + +class Comment < ActiveRecord::Base + belongs_to :question + acts_as_sequenced scope: :question_id + + def self.default_scope + order("question_id ASC") + end +end + +class ConcurrentBadger < ActiveRecord::Base + acts_as_sequenced scope: :burrow_id +end + +class Doppelganger < ActiveRecord::Base + acts_as_sequenced column: :sequential_id_one + acts_as_sequenced column: :sequential_id_two, start_at: 1000 +end + +class Email < ActiveRecord::Base + belongs_to :emailable, polymorphic: true + acts_as_sequenced scope: [:emailable_id, :emailable_type] +end + +class Invoice < ActiveRecord::Base + belongs_to :account + acts_as_sequenced scope: :account_id, start_at: 1000 +end + +class Monster < ActiveRecord::Base + acts_as_sequenced +end + +class Werewolf < Monster +end + +class Zombie < Monster +end + +class Order < ActiveRecord::Base + belongs_to :account + acts_as_sequenced scope: :non_existent_column +end + +class Policeman < ActiveRecord::Base + acts_as_sequenced + + validates :sequential_id, presence: true +end + +class Product < ActiveRecord::Base + belongs_to :account + acts_as_sequenced scope: :account_id, start_at: lambda { |r| r.computed_start_value } + + def computed_start_value + 1 + 2 + end +end + +class Question < ActiveRecord::Base + has_many :answers + has_many :comments +end + +class Rating < ActiveRecord::Base + acts_as_sequenced scope: :comment_id, skip: lambda { |r| r.score == 0 } +end + +class Subscription < ActiveRecord::Base + acts_as_sequenced +end + +class User < ActiveRecord::Base + belongs_to :account + acts_as_sequenced scope: :account_id, column: :custom_sequential_id +end + +class WithCustomPrimaryKey < ActiveRecord::Base + self.primary_key = :legacy_id + + belongs_to :account + acts_as_sequenced scope: :account_id +end diff --git a/test/support/schema.rb b/test/support/schema.rb new file mode 100644 index 0000000..e260f89 --- /dev/null +++ b/test/support/schema.rb @@ -0,0 +1,94 @@ +ActiveRecord::Schema.define do + create_table :questions, force: true do |t| + t.string :summary + t.text :body + end + + create_table :answers, force: true do |t| + t.references :question + t.text :body + t.integer :sequential_id + t.index :sequential_id + end + + create_table :accounts, force: true do |t| + t.string :name + end + + create_table :invoices, force: true do |t| + t.integer :amount + t.integer :sequential_id + t.references :account + end + + create_table :orders, force: true do |t| + t.string :product + t.references :account + end + + create_table :subscriptions, force: true do |t| + t.string :plan + t.integer :sequential_id + end + + create_table :users, force: true do |t| + t.references :account + t.string :name + t.integer :custom_sequential_id + end + + create_table :addresses, force: true do |t| + t.references :account + t.string :city + end + + create_table :comments, force: true do |t| + t.references :question + t.text :body + t.integer :sequential_id + end + + create_table :emails, force: true do |t| + t.string :emailable_type + t.integer :emailable_id + t.integer :sequential_id + t.string :address + end + + create_table :ratings, force: true do |t| + t.references :comment + t.integer :score + t.integer :sequential_id + end + + create_table :products, force: true do |t| + t.references :account + t.integer :sequential_id + end + + create_table :monsters, force: true do |t| + t.integer :sequential_id + t.string :type + end + + create_table :policemen, force: true do |t| + t.integer :sequential_id + end + + create_table :concurrent_badgers, force: true do |t| + t.integer :sequential_id, null: false + t.integer :burrow_id + + t.index [:sequential_id, :burrow_id], unique: true, name: "unique_concurrent" + end + + create_table :doppelgangers, force: true do |t| + t.integer :sequential_id_one + t.integer :sequential_id_two + end + + create_table :with_custom_primary_keys, force: true, id: :integer, primary_key: :legacy_id do |t| + t.integer :sequential_id + t.references :account + end +end diff --git a/test/test_helper.rb b/test/test_helper.rb index 7676726..27dc02c 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,18 +1,15 @@ -# Configure Rails Environment -ENV["RAILS_ENV"] = "test" -ENV["RAILS_ROOT"] = File.expand_path("../dummy", __FILE__) +require "bundler/setup" +Bundler.require(:default) -require File.expand_path("../dummy/config/environment.rb", __FILE__) -require "rails/test_help" +require "minitest/autorun" +require "active_record" -Rails.backtrace_cleaner.remove_silencers! +adapter = ENV["ADAPTER"].to_sym || :postgresql +puts "Using #{adapter}" -migrate_path = File.expand_path("../dummy/db/migrate/", __FILE__) -if Gem::Version.new(Rails::VERSION::STRING) >= Gem::Version.new("6.0") - ActiveRecord::MigrationContext.new(migrate_path, ActiveRecord::SchemaMigration).up -else - ActiveRecord::MigrationContext.new(migrate_path).up -end +database_yml = File.expand_path("support/database.yml", __dir__) +ActiveRecord::Base.configurations = YAML.load_file(database_yml) +ActiveRecord::Base.establish_connection(adapter) -# Load support files -Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].sort.each { |f| require f } +require_relative "support/schema" +require_relative "support/models"