├── .github └── workflows │ └── rspec.yml ├── .gitignore ├── .rspec ├── .rubocop_schema.49.yml ├── .rubocop_schema.53.yml ├── .rubocop_schema.77.yml ├── .rubocop_schema.yml ├── Gemfile ├── LICENSE.txt ├── README.md ├── Rakefile ├── fix-db-schema-conflicts.gemspec ├── lib ├── fix-db-schema-conflicts.rb └── fix_db_schema_conflicts │ ├── autocorrect_configuration.rb │ ├── railtie.rb │ ├── schema_dumper.rb │ ├── tasks │ └── db.rake │ └── version.rb └── spec ├── integration └── integration_spec.rb ├── spec_helper.rb ├── test-app ├── .gitignore ├── Gemfile ├── Gemfile.lock ├── README.rdoc ├── Rakefile ├── app │ ├── assets │ │ ├── config │ │ │ └── manifest.js │ │ ├── images │ │ │ └── .keep │ │ ├── javascripts │ │ │ └── application.js │ │ └── stylesheets │ │ │ └── application.css │ ├── controllers │ │ ├── application_controller.rb │ │ └── concerns │ │ │ └── .keep │ ├── helpers │ │ └── application_helper.rb │ ├── mailers │ │ └── .keep │ ├── models │ │ ├── .keep │ │ ├── company.rb │ │ ├── concerns │ │ │ └── .keep │ │ └── person.rb │ └── views │ │ └── layouts │ │ └── application.html.erb ├── bin │ ├── bundle │ ├── rails │ ├── rake │ ├── setup │ └── spring ├── config.ru ├── config │ ├── application.rb │ ├── boot.rb │ ├── database.yml │ ├── environment.rb │ ├── environments │ │ ├── development.rb │ │ ├── production.rb │ │ └── test.rb │ ├── initializers │ │ ├── assets.rb │ │ ├── backtrace_silencers.rb │ │ ├── cookies_serializer.rb │ │ ├── filter_parameter_logging.rb │ │ ├── inflections.rb │ │ ├── mime_types.rb │ │ ├── session_store.rb │ │ └── wrap_parameters.rb │ ├── locales │ │ └── en.yml │ ├── routes.rb │ └── secrets.yml ├── db │ ├── migrate │ │ ├── 20160322223225_create_people.rb │ │ └── 20160322223258_create_companies.rb │ ├── schema.rb │ └── seeds.rb ├── lib │ ├── assets │ │ └── .keep │ └── tasks │ │ └── .keep ├── log │ └── .keep ├── public │ ├── 404.html │ ├── 422.html │ ├── 500.html │ ├── favicon.ico │ └── robots.txt ├── test │ ├── controllers │ │ └── .keep │ ├── fixtures │ │ ├── .keep │ │ ├── companies.yml │ │ └── people.yml │ ├── helpers │ │ └── .keep │ ├── integration │ │ └── .keep │ ├── mailers │ │ └── .keep │ ├── models │ │ ├── .keep │ │ ├── company_test.rb │ │ └── person_test.rb │ └── test_helper.rb └── vendor │ └── assets │ ├── javascripts │ └── .keep │ └── stylesheets │ └── .keep └── unit └── autocorrect_configuration_spec.rb /.github/workflows/rspec.yml: -------------------------------------------------------------------------------- 1 | name: Run rspec 2 | on: 3 | push: 4 | pull_request: 5 | branches: [ master ] 6 | jobs: 7 | build: 8 | runs-on: ubuntu-18.04 9 | strategy: 10 | fail-fast: false 11 | matrix: 12 | ruby: [ 2.4, 2.5, 2.6 ] 13 | name: rspec with ruby ${{ matrix.ruby }} 14 | steps: 15 | - uses: actions/checkout@v2 16 | - uses: ruby/setup-ruby@v1 17 | with: 18 | ruby-version: ${{ matrix.ruby }} 19 | bundler-cache: true 20 | bundler: 1 21 | 22 | - run: bundle exec rspec -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.bundle/ 2 | /.yardoc 3 | /Gemfile.lock 4 | /_yardoc/ 5 | /coverage/ 6 | /doc/ 7 | /pkg/ 8 | /spec/reports/ 9 | /tmp/ 10 | *.bundle 11 | *.so 12 | *.o 13 | *.a 14 | mkmf.log 15 | *.gem 16 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --color 2 | --require spec_helper 3 | -------------------------------------------------------------------------------- /.rubocop_schema.49.yml: -------------------------------------------------------------------------------- 1 | # Configuration for Rubocop >= 0.49.0 2 | 3 | Layout/AlignHash: 4 | EnforcedColonStyle: 'key' 5 | EnforcedHashRocketStyle: 'key' 6 | 7 | Layout/ExtraSpacing: 8 | # When true, allows most uses of extra spacing if the intent is to align 9 | # things with the previous or next line, not counting empty lines or comment 10 | # lines. 11 | AllowForAlignment: false 12 | 13 | Layout/SpaceBeforeFirstArg: 14 | Enabled: true 15 | 16 | Style/NumericLiterals: 17 | Enabled: false 18 | 19 | Metrics/BlockNesting: 20 | Max: 2 21 | 22 | Style/WordArray: 23 | Enabled: false 24 | 25 | Style/TrailingCommaInLiteral: 26 | EnforcedStyleForMultiline: 'comma' 27 | 28 | Style/TrailingCommaInArguments: 29 | EnforcedStyleForMultiline: 'comma' 30 | 31 | Style/HashSyntax: 32 | EnforcedStyle: 'ruby19' 33 | 34 | Style/StringLiterals: 35 | EnforcedStyle: double_quotes 36 | -------------------------------------------------------------------------------- /.rubocop_schema.53.yml: -------------------------------------------------------------------------------- 1 | # Configuration for Rubocop >= 0.53.0 2 | 3 | Layout/AlignHash: 4 | EnforcedColonStyle: 'key' 5 | EnforcedHashRocketStyle: 'key' 6 | 7 | Layout/ExtraSpacing: 8 | # When true, allows most uses of extra spacing if the intent is to align 9 | # things with the previous or next line, not counting empty lines or comment 10 | # lines. 11 | AllowForAlignment: false 12 | 13 | Layout/SpaceBeforeFirstArg: 14 | Enabled: true 15 | 16 | Style/NumericLiterals: 17 | Enabled: false 18 | 19 | Metrics/BlockNesting: 20 | Max: 2 21 | 22 | Style/WordArray: 23 | Enabled: false 24 | 25 | Style/TrailingCommaInArrayLiteral: 26 | EnforcedStyleForMultiline: 'comma' 27 | 28 | Style/TrailingCommaInHashLiteral: 29 | EnforcedStyleForMultiline: 'comma' 30 | 31 | Style/TrailingCommaInArguments: 32 | EnforcedStyleForMultiline: 'comma' 33 | 34 | Style/HashSyntax: 35 | EnforcedStyle: 'ruby19' 36 | 37 | Style/StringLiterals: 38 | EnforcedStyle: double_quotes 39 | -------------------------------------------------------------------------------- /.rubocop_schema.77.yml: -------------------------------------------------------------------------------- 1 | # Configuration for Rubocop >= 0.77.0 2 | 3 | Layout/ExtraSpacing: 4 | # When true, allows most uses of extra spacing if the intent is to align 5 | # things with the previous or next line, not counting empty lines or comment 6 | # lines. 7 | AllowForAlignment: false 8 | 9 | Layout/HashAlignment: 10 | EnforcedColonStyle: 'key' 11 | EnforcedHashRocketStyle: 'key' 12 | 13 | Layout/LineLength: 14 | Enabled: false 15 | 16 | Layout/SpaceBeforeFirstArg: 17 | Enabled: true 18 | 19 | Style/NumericLiterals: 20 | Enabled: false 21 | 22 | Metrics/BlockNesting: 23 | Max: 2 24 | 25 | Style/WordArray: 26 | Enabled: false 27 | 28 | Style/TrailingCommaInArrayLiteral: 29 | EnforcedStyleForMultiline: 'comma' 30 | 31 | Style/TrailingCommaInHashLiteral: 32 | EnforcedStyleForMultiline: 'comma' 33 | 34 | Style/TrailingCommaInArguments: 35 | EnforcedStyleForMultiline: 'comma' 36 | 37 | Style/HashSyntax: 38 | EnforcedStyle: 'ruby19' 39 | 40 | Style/StringLiterals: 41 | EnforcedStyle: double_quotes 42 | -------------------------------------------------------------------------------- /.rubocop_schema.yml: -------------------------------------------------------------------------------- 1 | # Configuration for Rubocop >= 0.38.0, < 0.49.0 2 | 3 | Style/ExtraSpacing: 4 | # When true, allows most uses of extra spacing if the intent is to align 5 | # things with the previous or next line, not counting empty lines or comment 6 | # lines. 7 | AllowForAlignment: false 8 | 9 | Style/NumericLiterals: 10 | Enabled: false 11 | 12 | Style/SpaceBeforeFirstArg: 13 | Enabled: true 14 | 15 | Metrics/BlockNesting: 16 | Max: 2 17 | 18 | Style/AlignHash: 19 | EnforcedColonStyle: 'key' 20 | EnforcedHashRocketStyle: 'key' 21 | 22 | Style/WordArray: 23 | Enabled: false 24 | 25 | Style/TrailingCommaInLiteral: 26 | EnforcedStyleForMultiline: 'comma' 27 | 28 | Style/TrailingCommaInArguments: 29 | EnforcedStyleForMultiline: 'comma' 30 | 31 | Style/HashSyntax: 32 | EnforcedStyle: 'ruby19' 33 | 34 | Style/StringLiterals: 35 | EnforcedStyle: double_quotes 36 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # Specify your gem's dependencies in fix-db-schema-conflicts.gemspec 4 | gemspec 5 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 Jake Moffatt 2 | 3 | MIT License 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # fix-db-schema-conflicts 2 | 3 | It prevents db/schema.rb conflicts in your Rails projects when working with 4 | multiple team members. 5 | 6 | Specifically the situation that goes like this: 7 | 8 | John is working on a feature, and adds a migration to create an `updated_at` 9 | timestamp to `Task`. Sara is working on a different feature, and adds a 10 | migration to create a `name` column to `Task`. They both run their migrations 11 | locally, and then get a new copy of master with the other's feature and 12 | migration. Then when they run migrations again, John's `tasks` table looks like 13 | this: 14 | 15 | t.timestamp :updated_at 16 | t.string :name 17 | 18 | And Sara's looks like this: 19 | 20 | t.string :name 21 | t.timestamp :updated_at 22 | 23 | And every time they run migrations before committing new code, their 24 | `db/schema.rb` file will be showing a change, because they are flipping the 25 | order of the columns. 26 | 27 | By using the fix-db-schema-conflicts gem, this problem goes away. 28 | 29 | ## How it works 30 | 31 | This gem sorts the table, index, extension, and foreign key names before 32 | outputting them to the schema.rb file. Additionally it runs Rubocop with the 33 | auto-correct flag to ensure a consistent output format. 34 | 35 | ## Usage 36 | 37 | You don't have to do anything different. It should just work. Simply run `rake 38 | db:migrate` or `rake db:schema:dump` as you would before and 39 | `fix-db-schema-conflicts` will do the rest. 40 | 41 | ## Installation 42 | 43 | Add this line to your application's Gemfile in your development group: 44 | 45 | ```ruby 46 | gem 'fix-db-schema-conflicts' 47 | ``` 48 | 49 | And then execute: 50 | 51 | $ bundle 52 | 53 | ## Older versions of Rubocop: 54 | 55 | If you wish to use a version of Rubocop `< 0.36.0` or below, use 56 | `gem 'fix-db-schema-conflicts', '~> 1.0.2'` 57 | 58 | ## Older versions of Ruby: 59 | 60 | This gem only works with Ruby >= 2.2. Use versions 1.2.2 or below if you have an 61 | old Ruby. 62 | 63 | ## Contributing 64 | 65 | 1. Fork it (https://github.com/[my-github-username]/fix-db-schema-conflicts/fork) 66 | 2. Create your feature branch (`git checkout -b my-new-feature`) 67 | 3. Commit your changes (`git commit -am 'Add some feature'`) 68 | 4. Push to the branch (`git push origin my-new-feature`) 69 | 5. Create a new Pull Request 70 | 71 | ## Contributors 72 | 73 | - [@jakeonrails](https://github.com/jakeonrails) - Creator and maintainer 74 | - [@TCampaigne](https://github.com/TCampaigne) 75 | - [@Lordnibbler](https://github.com/Lordnibbler) 76 | - [@timdiggins](https://github.com/timdiggins) 77 | - [@zoras](https://github.com/zoras) 78 | - [@jensljungblad](https://github.com/jensljungblad) 79 | - [@vsubramanian](https://github.com/vsubramanian) 80 | - [@claytron](https://github.com/claytron) 81 | - [@amckinnell](https://github.com/amckinnell) 82 | - [@rosscooperman](https://github.com/rosscooperman) 83 | - [@cabello](https://github.com/cabello) 84 | - [@justisb](https://github.com/justisb) 85 | - [@sg650](https://github.com/sg650) 86 | 87 | ## Releases 88 | - 3.1.1 89 | - Use modern autocorrect flag for rubocop >= 1.30 (sg650) 90 | - 3.1.0 91 | - Added support for ruby 3 (cabello) 92 | - Added support for new Rubocop 0.77+ schema (justisb) 93 | - 3.0.3 94 | - Added support for new Rubocop 0.53+ schema (rosscooperman) 95 | - 3.0.2 96 | - Added support for new Rubocop 0.49+ schema (amckinnell) 97 | - 3.0.1 98 | - Improve formatting to be more consistent (amckinnell) 99 | - Bump rake dependency to bypass a rake bug in older version (amckinnell) 100 | - 3.0.0 101 | - Only support Ruby 2.2+ since lower versions haved reached EOL. 102 | - 2.0.1 103 | - Fix bug that caused failure when project directory has a space in it 104 | - 2.0.0 105 | - Allow usage of Rubocop >= 0.38.0 106 | - Remove Rails 5 deprecation warnings for using alias_method_chain 107 | - This upgrade breaks compatibility with Ruby 1.9x since 1.9x lacks #prepend 108 | - 1.2.2 109 | - Remove dependency on sed 110 | - 1.2.1 111 | - Upgrade Rubocop to get major performance boost 112 | - Add support for sorting of extensions 113 | - Fix spacing regression introduced by Rubocop upgrade 114 | - Add test suite and an integration test 115 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require "bundler/gem_tasks" 2 | 3 | 4 | begin 5 | require 'rspec/core/rake_task' 6 | RSpec::Core::RakeTask.new(:spec) 7 | rescue LoadError 8 | end 9 | 10 | task default: :spec 11 | -------------------------------------------------------------------------------- /fix-db-schema-conflicts.gemspec: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | lib = File.expand_path('../lib', __FILE__) 3 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) 4 | require 'fix_db_schema_conflicts/version' 5 | 6 | Gem::Specification.new do |spec| 7 | spec.name = 'fix-db-schema-conflicts' 8 | spec.version = FixDBSchemaConflicts::VERSION 9 | spec.authors = ['Jake Moffatt'] 10 | spec.email = ['jakeonrails@gmail.com'] 11 | spec.summary = %q{Helps prevent unneeded db/schema.rb conflicts} 12 | spec.description = %q{Ensures consistent output of db/schema.rb despite local differences in the database} 13 | spec.homepage = 'https://github.com/jakeonrails/fix-db-schema-conflicts' 14 | spec.license = 'MIT' 15 | 16 | spec.files = `git ls-files -z`.split("\x0") 17 | spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } 18 | spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) 19 | spec.require_paths = ['lib'] 20 | 21 | spec.add_development_dependency 'bundler' 22 | spec.add_development_dependency 'rake' 23 | spec.add_development_dependency 'rspec', '~>3.4.0' 24 | spec.add_development_dependency 'rails', '~> 4.2.0' 25 | spec.add_development_dependency 'sqlite3', '~> 1.3.0' 26 | 27 | spec.add_dependency 'rubocop', '>= 0.38.0' 28 | 29 | spec.required_ruby_version = '>= 2.0.0', '< 4' 30 | end 31 | -------------------------------------------------------------------------------- /lib/fix-db-schema-conflicts.rb: -------------------------------------------------------------------------------- 1 | require 'fix_db_schema_conflicts/schema_dumper.rb' 2 | 3 | module FixDBSchemaConflicts 4 | require 'fix_db_schema_conflicts/railtie' if defined?(Rails) 5 | end 6 | -------------------------------------------------------------------------------- /lib/fix_db_schema_conflicts/autocorrect_configuration.rb: -------------------------------------------------------------------------------- 1 | module FixDBSchemaConflicts 2 | class AutocorrectConfiguration 3 | def self.load 4 | new.load 5 | end 6 | 7 | def load 8 | if less_than_rubocop?(49) 9 | '.rubocop_schema.yml' 10 | elsif less_than_rubocop?(53) 11 | '.rubocop_schema.49.yml' 12 | elsif less_than_rubocop?(77) 13 | '.rubocop_schema.53.yml' 14 | else 15 | '.rubocop_schema.77.yml' 16 | end 17 | end 18 | 19 | private 20 | 21 | def less_than_rubocop?(ver) 22 | Gem.loaded_specs['rubocop'].version < Gem::Version.new("0.#{ver}.0") 23 | end 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /lib/fix_db_schema_conflicts/railtie.rb: -------------------------------------------------------------------------------- 1 | require 'fix-db-schema-conflicts' 2 | require 'rails' 3 | 4 | module FixDBSchemaConflicts 5 | class Railtie < Rails::Railtie 6 | railtie_name :fix_db_schema_conflicts 7 | rake_tasks do 8 | load "fix_db_schema_conflicts/tasks/db.rake" 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /lib/fix_db_schema_conflicts/schema_dumper.rb: -------------------------------------------------------------------------------- 1 | require 'delegate' 2 | 3 | module FixDBSchemaConflicts 4 | module SchemaDumper 5 | class ConnectionWithSorting < SimpleDelegator 6 | def extensions 7 | __getobj__.extensions.sort 8 | end 9 | 10 | def columns(table) 11 | __getobj__.columns(table).sort_by(&:name) 12 | end 13 | 14 | def indexes(table) 15 | __getobj__.indexes(table).sort_by(&:name) 16 | end 17 | 18 | def foreign_keys(table) 19 | __getobj__.indexes(table).sort_by(&:name) 20 | end 21 | end 22 | 23 | def extensions(*args) 24 | with_sorting do 25 | super(*args) 26 | end 27 | end 28 | 29 | def table(*args) 30 | with_sorting do 31 | super(*args) 32 | end 33 | end 34 | 35 | def with_sorting 36 | old, @connection = @connection, ConnectionWithSorting.new(@connection) 37 | result = yield 38 | @connection = old 39 | result 40 | end 41 | end 42 | end 43 | 44 | ActiveRecord::SchemaDumper.send(:prepend, FixDBSchemaConflicts::SchemaDumper) 45 | -------------------------------------------------------------------------------- /lib/fix_db_schema_conflicts/tasks/db.rake: -------------------------------------------------------------------------------- 1 | require 'shellwords' 2 | require_relative '../autocorrect_configuration' 3 | 4 | namespace :db do 5 | namespace :schema do 6 | task :dump do 7 | puts "Dumping database schema with fix-db-schema-conflicts gem" 8 | 9 | filename = ENV['SCHEMA'] || if defined? ActiveRecord::Tasks::DatabaseTasks 10 | File.join(ActiveRecord::Tasks::DatabaseTasks.db_dir, 'schema.rb') 11 | else 12 | "#{Rails.root}/db/schema.rb" 13 | end 14 | autocorrect_config = FixDBSchemaConflicts::AutocorrectConfiguration.load 15 | rubocop_yml = File.expand_path("../../../../#{autocorrect_config}", __FILE__) 16 | auto_correct_arg = if Gem.loaded_specs['rubocop'].version >= Gem::Version.new('1.30') 17 | 'autocorrect' 18 | else 19 | 'auto-correct' 20 | end 21 | 22 | `bundle exec rubocop --#{auto_correct_arg} --config #{rubocop_yml} #{filename.shellescape}` 23 | end 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /lib/fix_db_schema_conflicts/version.rb: -------------------------------------------------------------------------------- 1 | module FixDBSchemaConflicts 2 | VERSION='3.1.1' 3 | end 4 | -------------------------------------------------------------------------------- /spec/integration/integration_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | RSpec.describe 'Fix DB Schema Conflicts' do 4 | 5 | let(:expected_lines) { reference_db_schema.lines } 6 | 7 | it 'generates a sorted schema with no extra spacing' do 8 | 9 | `cd spec/test-app && rm -f db/schema.rb && rake db:migrate` 10 | 11 | generated_lines = File.readlines('spec/test-app/db/schema.rb') 12 | 13 | generated_lines.zip(expected_lines).each do |generated, expected| 14 | next if expected.nil? 15 | next if expected.start_with?('ActiveRecord::Schema.define') 16 | expect(generated).to eq(expected) 17 | end 18 | end 19 | end 20 | 21 | def reference_db_schema 22 | <<-RUBY 23 | # This file is auto-generated from the current state of the database. Instead 24 | # of editing this file, please use the migrations feature of Active Record to 25 | # incrementally modify your database, and then regenerate this schema definition. 26 | # 27 | # Note that this schema.rb definition is the authoritative source for your 28 | # database schema. If you need to create the application database on another 29 | # system, you should be using db:schema:load, not running all the migrations 30 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations 31 | # you'll amass, the slower it'll run and the greater likelihood for issues). 32 | # 33 | # It's strongly recommended that you check this file into your version control system. 34 | 35 | ActiveRecord::Schema.define(version: 20160322223258) do 36 | create_table "companies", force: :cascade do |t| 37 | t.string "addr1" 38 | t.string "addr2" 39 | t.string "city" 40 | t.datetime "created_at", null: false 41 | t.string "name" 42 | t.string "phone" 43 | t.string "state" 44 | t.datetime "updated_at", null: false 45 | t.string "zip" 46 | end 47 | 48 | add_index "companies", ["city"], name: "index_companies_on_city" 49 | add_index "companies", ["name"], name: "index_companies_on_name" 50 | add_index "companies", ["state"], name: "index_companies_on_state" 51 | 52 | create_table "people", force: :cascade do |t| 53 | t.integer "age" 54 | t.date "birthdate" 55 | t.datetime "created_at", null: false 56 | t.string "first_name" 57 | t.string "last_name" 58 | t.datetime "updated_at", null: false 59 | end 60 | RUBY 61 | end 62 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # This file was generated by the `rspec --init` command. Conventionally, all 2 | # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. 3 | # The generated `.rspec` file contains `--require spec_helper` which will cause 4 | # this file to always be loaded, without a need to explicitly require it in any 5 | # files. 6 | # 7 | # Given that it is always loaded, you are encouraged to keep this file as 8 | # light-weight as possible. Requiring heavyweight dependencies from this file 9 | # will add to the boot time of your test suite on EVERY test run, even for an 10 | # individual file that may not need all of that loaded. Instead, consider making 11 | # a separate helper file that requires the additional dependencies and performs 12 | # the additional setup, and require it from the spec files that actually need 13 | # it. 14 | # 15 | # The `.rspec` file also contains a few flags that are not defaults but that 16 | # users commonly want. 17 | # 18 | # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration 19 | RSpec.configure do |config| 20 | # rspec-expectations config goes here. You can use an alternate 21 | # assertion/expectation library such as wrong or the stdlib/minitest 22 | # assertions if you prefer. 23 | config.expect_with :rspec do |expectations| 24 | # This option will default to `true` in RSpec 4. It makes the `description` 25 | # and `failure_message` of custom matchers include text for helper methods 26 | # defined using `chain`, e.g.: 27 | # be_bigger_than(2).and_smaller_than(4).description 28 | # # => "be bigger than 2 and smaller than 4" 29 | # ...rather than: 30 | # # => "be bigger than 2" 31 | expectations.include_chain_clauses_in_custom_matcher_descriptions = true 32 | end 33 | 34 | # rspec-mocks config goes here. You can use an alternate test double 35 | # library (such as bogus or mocha) by changing the `mock_with` option here. 36 | config.mock_with :rspec do |mocks| 37 | # Prevents you from mocking or stubbing a method that does not exist on 38 | # a real object. This is generally recommended, and will default to 39 | # `true` in RSpec 4. 40 | mocks.verify_partial_doubles = true 41 | end 42 | 43 | # The settings below are suggested to provide a good initial experience 44 | # with RSpec, but feel free to customize to your heart's content. 45 | 46 | # These two settings work together to allow you to limit a spec run 47 | # to individual examples or groups you care about by tagging them with 48 | # `:focus` metadata. When nothing is tagged with `:focus`, all examples 49 | # get run. 50 | config.filter_run :focus 51 | config.run_all_when_everything_filtered = true 52 | 53 | # Allows RSpec to persist some state between runs in order to support 54 | # the `--only-failures` and `--next-failure` CLI options. We recommend 55 | # you configure your source control system to ignore this file. 56 | # config.example_status_persistence_file_path = "spec/examples.txt" 57 | 58 | # Limits the available syntax to the non-monkey patched syntax that is 59 | # recommended. For more details, see: 60 | # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/ 61 | # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ 62 | # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode 63 | config.disable_monkey_patching! 64 | 65 | # This setting enables warnings. It's recommended, but in some cases may 66 | # be too noisy due to issues in dependencies. 67 | config.warnings = true 68 | 69 | # Many RSpec users commonly either run the entire suite or an individual 70 | # file, and it's useful to allow more verbose output when running an 71 | # individual spec file. 72 | if config.files_to_run.one? 73 | # Use the documentation formatter for detailed output, 74 | # unless a formatter has already been configured 75 | # (e.g. via a command-line flag). 76 | config.default_formatter = 'doc' 77 | end 78 | 79 | # Print the 10 slowest examples and example groups at the 80 | # end of the spec run, to help surface which specs are running 81 | # particularly slow. 82 | # config.profile_examples = 10 83 | 84 | # Run specs in random order to surface order dependencies. If you find an 85 | # order dependency and want to debug it, you can fix the order by providing 86 | # the seed, which is printed after each run. 87 | # --seed 1234 88 | config.order = :random 89 | 90 | # Seed global randomization in this process using the `--seed` CLI option. 91 | # Setting this allows you to use `--seed` to deterministically reproduce 92 | # test failures related to randomization by passing the same `--seed` value 93 | # as the one that triggered the failure. 94 | Kernel.srand config.seed 95 | end 96 | -------------------------------------------------------------------------------- /spec/test-app/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files. 2 | # 3 | # If you find yourself ignoring temporary files generated by your text editor 4 | # or operating system, you probably want to add a global ignore instead: 5 | # git config --global core.excludesfile '~/.gitignore_global' 6 | 7 | # Ignore bundler config. 8 | /.bundle 9 | 10 | # Ignore the default SQLite database. 11 | /db/*.sqlite3 12 | /db/*.sqlite3-journal 13 | 14 | # Ignore all logfiles and tempfiles. 15 | /log/* 16 | !/log/.keep 17 | /tmp 18 | -------------------------------------------------------------------------------- /spec/test-app/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 4 | gem 'rails', '4.2.5.2' 5 | # Use sqlite3 as the database for Active Record 6 | gem 'sqlite3' 7 | 8 | gem 'fix-db-schema-conflicts', path: '../..' 9 | -------------------------------------------------------------------------------- /spec/test-app/Gemfile.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: ../.. 3 | specs: 4 | fix-db-schema-conflicts (1.2.0) 5 | rubocop (>= 0.36.0) 6 | 7 | GEM 8 | remote: https://rubygems.org/ 9 | specs: 10 | actionmailer (4.2.5.2) 11 | actionpack (= 4.2.5.2) 12 | actionview (= 4.2.5.2) 13 | activejob (= 4.2.5.2) 14 | mail (~> 2.5, >= 2.5.4) 15 | rails-dom-testing (~> 1.0, >= 1.0.5) 16 | actionpack (4.2.5.2) 17 | actionview (= 4.2.5.2) 18 | activesupport (= 4.2.5.2) 19 | rack (~> 1.6) 20 | rack-test (~> 0.6.2) 21 | rails-dom-testing (~> 1.0, >= 1.0.5) 22 | rails-html-sanitizer (~> 1.0, >= 1.0.2) 23 | actionview (4.2.5.2) 24 | activesupport (= 4.2.5.2) 25 | builder (~> 3.1) 26 | erubis (~> 2.7.0) 27 | rails-dom-testing (~> 1.0, >= 1.0.5) 28 | rails-html-sanitizer (~> 1.0, >= 1.0.2) 29 | activejob (4.2.5.2) 30 | activesupport (= 4.2.5.2) 31 | globalid (>= 0.3.0) 32 | activemodel (4.2.5.2) 33 | activesupport (= 4.2.5.2) 34 | builder (~> 3.1) 35 | activerecord (4.2.5.2) 36 | activemodel (= 4.2.5.2) 37 | activesupport (= 4.2.5.2) 38 | arel (~> 6.0) 39 | activesupport (4.2.5.2) 40 | i18n (~> 0.7) 41 | json (~> 1.7, >= 1.7.7) 42 | minitest (~> 5.1) 43 | thread_safe (~> 0.3, >= 0.3.4) 44 | tzinfo (~> 1.1) 45 | arel (6.0.3) 46 | ast (2.2.0) 47 | builder (3.2.2) 48 | concurrent-ruby (1.0.1) 49 | erubis (2.7.0) 50 | globalid (0.3.6) 51 | activesupport (>= 4.1.0) 52 | i18n (0.7.0) 53 | json (1.8.3) 54 | loofah (2.0.3) 55 | nokogiri (>= 1.5.9) 56 | mail (2.6.3) 57 | mime-types (>= 1.16, < 3) 58 | mime-types (2.99.1) 59 | mini_portile2 (2.0.0) 60 | minitest (5.8.4) 61 | nokogiri (1.6.7.2) 62 | mini_portile2 (~> 2.0.0.rc2) 63 | parser (2.3.0.6) 64 | ast (~> 2.2) 65 | powerpack (0.1.1) 66 | rack (1.6.4) 67 | rack-test (0.6.3) 68 | rack (>= 1.0) 69 | rails (4.2.5.2) 70 | actionmailer (= 4.2.5.2) 71 | actionpack (= 4.2.5.2) 72 | actionview (= 4.2.5.2) 73 | activejob (= 4.2.5.2) 74 | activemodel (= 4.2.5.2) 75 | activerecord (= 4.2.5.2) 76 | activesupport (= 4.2.5.2) 77 | bundler (>= 1.3.0, < 2.0) 78 | railties (= 4.2.5.2) 79 | sprockets-rails 80 | rails-deprecated_sanitizer (1.0.3) 81 | activesupport (>= 4.2.0.alpha) 82 | rails-dom-testing (1.0.7) 83 | activesupport (>= 4.2.0.beta, < 5.0) 84 | nokogiri (~> 1.6.0) 85 | rails-deprecated_sanitizer (>= 1.0.1) 86 | rails-html-sanitizer (1.0.3) 87 | loofah (~> 2.0) 88 | railties (4.2.5.2) 89 | actionpack (= 4.2.5.2) 90 | activesupport (= 4.2.5.2) 91 | rake (>= 0.8.7) 92 | thor (>= 0.18.1, < 2.0) 93 | rainbow (2.1.0) 94 | rake (11.1.1) 95 | rubocop (0.38.0) 96 | parser (>= 2.3.0.6, < 3.0) 97 | powerpack (~> 0.1) 98 | rainbow (>= 1.99.1, < 3.0) 99 | ruby-progressbar (~> 1.7) 100 | unicode-display_width (~> 1.0, >= 1.0.1) 101 | ruby-progressbar (1.7.5) 102 | sprockets (3.5.2) 103 | concurrent-ruby (~> 1.0) 104 | rack (> 1, < 3) 105 | sprockets-rails (3.0.4) 106 | actionpack (>= 4.0) 107 | activesupport (>= 4.0) 108 | sprockets (>= 3.0.0) 109 | sqlite3 (1.3.11) 110 | thor (0.19.1) 111 | thread_safe (0.3.5) 112 | tzinfo (1.2.2) 113 | thread_safe (~> 0.1) 114 | unicode-display_width (1.0.2) 115 | 116 | PLATFORMS 117 | ruby 118 | 119 | DEPENDENCIES 120 | fix-db-schema-conflicts! 121 | rails (= 4.2.5.2) 122 | sqlite3 123 | 124 | BUNDLED WITH 125 | 1.10.6 126 | -------------------------------------------------------------------------------- /spec/test-app/README.rdoc: -------------------------------------------------------------------------------- 1 | == README 2 | 3 | This README would normally document whatever steps are necessary to get the 4 | application up and running. 5 | 6 | Things you may want to cover: 7 | 8 | * Ruby version 9 | 10 | * System dependencies 11 | 12 | * Configuration 13 | 14 | * Database creation 15 | 16 | * Database initialization 17 | 18 | * How to run the test suite 19 | 20 | * Services (job queues, cache servers, search engines, etc.) 21 | 22 | * Deployment instructions 23 | 24 | * ... 25 | 26 | 27 | Please feel free to use a different markup language if you do not plan to run 28 | rake doc:app. 29 | -------------------------------------------------------------------------------- /spec/test-app/Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require File.expand_path('../config/application', __FILE__) 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /spec/test-app/app/assets/config/manifest.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jakeonrails/fix-db-schema-conflicts/ae9135e0bb1fb142dd483f883da0064b8be17732/spec/test-app/app/assets/config/manifest.js -------------------------------------------------------------------------------- /spec/test-app/app/assets/images/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jakeonrails/fix-db-schema-conflicts/ae9135e0bb1fb142dd483f883da0064b8be17732/spec/test-app/app/assets/images/.keep -------------------------------------------------------------------------------- /spec/test-app/app/assets/javascripts/application.js: -------------------------------------------------------------------------------- 1 | // This is a manifest file that'll be compiled into application.js, which will include all the files 2 | // listed below. 3 | // 4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, 5 | // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. 6 | // 7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 8 | // compiled file. 9 | // 10 | // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details 11 | // about supported directives. 12 | // 13 | //= require jquery 14 | //= require jquery_ujs 15 | //= require turbolinks 16 | //= require_tree . 17 | -------------------------------------------------------------------------------- /spec/test-app/app/assets/stylesheets/application.css: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files 3 | * listed below. 4 | * 5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 6 | * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. 7 | * 8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the 9 | * compiled file so the styles you add here take precedence over styles defined in any styles 10 | * defined in the other CSS/SCSS files in this directory. It is generally better to create a new 11 | * file per style scope. 12 | * 13 | *= require_tree . 14 | *= require_self 15 | */ 16 | -------------------------------------------------------------------------------- /spec/test-app/app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | # Prevent CSRF attacks by raising an exception. 3 | # For APIs, you may want to use :null_session instead. 4 | protect_from_forgery with: :exception 5 | end 6 | -------------------------------------------------------------------------------- /spec/test-app/app/controllers/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jakeonrails/fix-db-schema-conflicts/ae9135e0bb1fb142dd483f883da0064b8be17732/spec/test-app/app/controllers/concerns/.keep -------------------------------------------------------------------------------- /spec/test-app/app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /spec/test-app/app/mailers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jakeonrails/fix-db-schema-conflicts/ae9135e0bb1fb142dd483f883da0064b8be17732/spec/test-app/app/mailers/.keep -------------------------------------------------------------------------------- /spec/test-app/app/models/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jakeonrails/fix-db-schema-conflicts/ae9135e0bb1fb142dd483f883da0064b8be17732/spec/test-app/app/models/.keep -------------------------------------------------------------------------------- /spec/test-app/app/models/company.rb: -------------------------------------------------------------------------------- 1 | class Company < ActiveRecord::Base 2 | end 3 | -------------------------------------------------------------------------------- /spec/test-app/app/models/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jakeonrails/fix-db-schema-conflicts/ae9135e0bb1fb142dd483f883da0064b8be17732/spec/test-app/app/models/concerns/.keep -------------------------------------------------------------------------------- /spec/test-app/app/models/person.rb: -------------------------------------------------------------------------------- 1 | class Person < ActiveRecord::Base 2 | end 3 | -------------------------------------------------------------------------------- /spec/test-app/app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | TestApp 5 | <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> 6 | <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> 7 | <%= csrf_meta_tags %> 8 | 9 | 10 | 11 | <%= yield %> 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /spec/test-app/bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /spec/test-app/bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path('../spring', __FILE__) 4 | rescue LoadError => e 5 | raise unless e.message.include?('spring') 6 | end 7 | APP_PATH = File.expand_path('../../config/application', __FILE__) 8 | require_relative '../config/boot' 9 | require 'rails/commands' 10 | -------------------------------------------------------------------------------- /spec/test-app/bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path('../spring', __FILE__) 4 | rescue LoadError => e 5 | raise unless e.message.include?('spring') 6 | end 7 | require_relative '../config/boot' 8 | require 'rake' 9 | Rake.application.run 10 | -------------------------------------------------------------------------------- /spec/test-app/bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'pathname' 3 | 4 | # path to your application root. 5 | APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) 6 | 7 | Dir.chdir APP_ROOT do 8 | # This script is a starting point to setup your application. 9 | # Add necessary setup steps to this file: 10 | 11 | puts "== Installing dependencies ==" 12 | system "gem install bundler --conservative" 13 | system "bundle check || bundle install" 14 | 15 | # puts "\n== Copying sample files ==" 16 | # unless File.exist?("config/database.yml") 17 | # system "cp config/database.yml.sample config/database.yml" 18 | # end 19 | 20 | puts "\n== Preparing database ==" 21 | system "bin/rake db:setup" 22 | 23 | puts "\n== Removing old logs and tempfiles ==" 24 | system "rm -f log/*" 25 | system "rm -rf tmp/cache" 26 | 27 | puts "\n== Restarting application server ==" 28 | system "touch tmp/restart.txt" 29 | end 30 | -------------------------------------------------------------------------------- /spec/test-app/bin/spring: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | # This file loads spring without using Bundler, in order to be fast. 4 | # It gets overwritten when you run the `spring binstub` command. 5 | 6 | unless defined?(Spring) 7 | require 'rubygems' 8 | require 'bundler' 9 | 10 | if (match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)) 11 | Gem.paths = { 'GEM_PATH' => [Bundler.bundle_path.to_s, *Gem.path].uniq.join(Gem.path_separator) } 12 | gem 'spring', match[1] 13 | require 'spring/binstub' 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /spec/test-app/config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require ::File.expand_path('../config/environment', __FILE__) 4 | run Rails.application 5 | -------------------------------------------------------------------------------- /spec/test-app/config/application.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../boot', __FILE__) 2 | 3 | require 'rails/all' 4 | 5 | # Require the gems listed in Gemfile, including any gems 6 | # you've limited to :test, :development, or :production. 7 | Bundler.require(*Rails.groups) 8 | 9 | module TestApp 10 | class Application < Rails::Application 11 | # Settings in config/environments/* take precedence over those specified here. 12 | # Application configuration should go into files in config/initializers 13 | # -- all .rb files in that directory are automatically loaded. 14 | 15 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. 16 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. 17 | # config.time_zone = 'Central Time (US & Canada)' 18 | 19 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. 20 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] 21 | # config.i18n.default_locale = :de 22 | 23 | # Do not swallow errors in after_commit/after_rollback callbacks. 24 | config.active_record.raise_in_transactional_callbacks = true 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /spec/test-app/config/boot.rb: -------------------------------------------------------------------------------- 1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 2 | 3 | require 'bundler/setup' # Set up gems listed in the Gemfile. 4 | -------------------------------------------------------------------------------- /spec/test-app/config/database.yml: -------------------------------------------------------------------------------- 1 | # SQLite version 3.x 2 | # gem install sqlite3 3 | # 4 | # Ensure the SQLite 3 gem is defined in your Gemfile 5 | # gem 'sqlite3' 6 | # 7 | default: &default 8 | adapter: sqlite3 9 | pool: 5 10 | timeout: 5000 11 | 12 | development: 13 | <<: *default 14 | database: db/development.sqlite3 15 | 16 | # Warning: The database defined as "test" will be erased and 17 | # re-generated from your development database when you run "rake". 18 | # Do not set this db to the same as development or production. 19 | test: 20 | <<: *default 21 | database: db/test.sqlite3 22 | 23 | production: 24 | <<: *default 25 | database: db/production.sqlite3 26 | -------------------------------------------------------------------------------- /spec/test-app/config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /spec/test-app/config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # In the development environment your application's code is reloaded on 5 | # every request. This slows down response time but is perfect for development 6 | # since you don't have to restart the web server when you make code changes. 7 | config.cache_classes = false 8 | 9 | # Do not eager load code on boot. 10 | config.eager_load = false 11 | 12 | # Show full error reports and disable caching. 13 | config.consider_all_requests_local = true 14 | config.action_controller.perform_caching = false 15 | 16 | # Don't care if the mailer can't send. 17 | config.action_mailer.raise_delivery_errors = false 18 | 19 | # Print deprecation notices to the Rails logger. 20 | config.active_support.deprecation = :log 21 | 22 | # Raise an error on page load if there are pending migrations. 23 | config.active_record.migration_error = :page_load 24 | 25 | # Debug mode disables concatenation and preprocessing of assets. 26 | # This option may cause significant delays in view rendering with a large 27 | # number of complex assets. 28 | config.assets.debug = true 29 | 30 | # Asset digests allow you to set far-future HTTP expiration dates on all assets, 31 | # yet still be able to expire them through the digest params. 32 | config.assets.digest = true 33 | 34 | # Adds additional error checking when serving assets at runtime. 35 | # Checks for improperly declared sprockets dependencies. 36 | # Raises helpful error messages. 37 | config.assets.raise_runtime_errors = true 38 | 39 | # Raises error for missing translations 40 | # config.action_view.raise_on_missing_translations = true 41 | end 42 | -------------------------------------------------------------------------------- /spec/test-app/config/environments/production.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # Code is not reloaded between requests. 5 | config.cache_classes = true 6 | 7 | # Eager load code on boot. This eager loads most of Rails and 8 | # your application in memory, allowing both threaded web servers 9 | # and those relying on copy on write to perform better. 10 | # Rake tasks automatically ignore this option for performance. 11 | config.eager_load = true 12 | 13 | # Full error reports are disabled and caching is turned on. 14 | config.consider_all_requests_local = false 15 | config.action_controller.perform_caching = true 16 | 17 | # Enable Rack::Cache to put a simple HTTP cache in front of your application 18 | # Add `rack-cache` to your Gemfile before enabling this. 19 | # For large-scale production use, consider using a caching reverse proxy like 20 | # NGINX, varnish or squid. 21 | # config.action_dispatch.rack_cache = true 22 | 23 | # Disable serving static files from the `/public` folder by default since 24 | # Apache or NGINX already handles this. 25 | config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? 26 | 27 | # Compress JavaScripts and CSS. 28 | config.assets.js_compressor = :uglifier 29 | # config.assets.css_compressor = :sass 30 | 31 | # Do not fallback to assets pipeline if a precompiled asset is missed. 32 | config.assets.compile = false 33 | 34 | # Asset digests allow you to set far-future HTTP expiration dates on all assets, 35 | # yet still be able to expire them through the digest params. 36 | config.assets.digest = true 37 | 38 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb 39 | 40 | # Specifies the header that your server uses for sending files. 41 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache 42 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX 43 | 44 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 45 | # config.force_ssl = true 46 | 47 | # Use the lowest log level to ensure availability of diagnostic information 48 | # when problems arise. 49 | config.log_level = :debug 50 | 51 | # Prepend all log lines with the following tags. 52 | # config.log_tags = [ :subdomain, :uuid ] 53 | 54 | # Use a different logger for distributed setups. 55 | # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) 56 | 57 | # Use a different cache store in production. 58 | # config.cache_store = :mem_cache_store 59 | 60 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 61 | # config.action_controller.asset_host = 'http://assets.example.com' 62 | 63 | # Ignore bad email addresses and do not raise email delivery errors. 64 | # Set this to true and configure the email server for immediate delivery to raise delivery errors. 65 | # config.action_mailer.raise_delivery_errors = false 66 | 67 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 68 | # the I18n.default_locale when a translation cannot be found). 69 | config.i18n.fallbacks = true 70 | 71 | # Send deprecation notices to registered listeners. 72 | config.active_support.deprecation = :notify 73 | 74 | # Use default logging formatter so that PID and timestamp are not suppressed. 75 | config.log_formatter = ::Logger::Formatter.new 76 | 77 | # Do not dump schema after migrations. 78 | config.active_record.dump_schema_after_migration = false 79 | end 80 | -------------------------------------------------------------------------------- /spec/test-app/config/environments/test.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # The test environment is used exclusively to run your application's 5 | # test suite. You never need to work with it otherwise. Remember that 6 | # your test database is "scratch space" for the test suite and is wiped 7 | # and recreated between test runs. Don't rely on the data there! 8 | config.cache_classes = true 9 | 10 | # Do not eager load code on boot. This avoids loading your whole application 11 | # just for the purpose of running a single test. If you are using a tool that 12 | # preloads Rails for running tests, you may have to set it to true. 13 | config.eager_load = false 14 | 15 | # Configure static file server for tests with Cache-Control for performance. 16 | config.serve_static_files = true 17 | config.static_cache_control = 'public, max-age=3600' 18 | 19 | # Show full error reports and disable caching. 20 | config.consider_all_requests_local = true 21 | config.action_controller.perform_caching = false 22 | 23 | # Raise exceptions instead of rendering exception templates. 24 | config.action_dispatch.show_exceptions = false 25 | 26 | # Disable request forgery protection in test environment. 27 | config.action_controller.allow_forgery_protection = false 28 | 29 | # Tell Action Mailer not to deliver emails to the real world. 30 | # The :test delivery method accumulates sent emails in the 31 | # ActionMailer::Base.deliveries array. 32 | config.action_mailer.delivery_method = :test 33 | 34 | # Randomize the order test cases are executed. 35 | config.active_support.test_order = :random 36 | 37 | # Print deprecation notices to the stderr. 38 | config.active_support.deprecation = :stderr 39 | 40 | # Raises error for missing translations 41 | # config.action_view.raise_on_missing_translations = true 42 | end 43 | -------------------------------------------------------------------------------- /spec/test-app/config/initializers/assets.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Version of your assets, change this if you want to expire all your assets. 4 | Rails.application.config.assets.version = '1.0' 5 | 6 | # Add additional assets to the asset load path 7 | # Rails.application.config.assets.paths << Emoji.images_path 8 | 9 | # Precompile additional assets. 10 | # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. 11 | # Rails.application.config.assets.precompile += %w( search.js ) 12 | -------------------------------------------------------------------------------- /spec/test-app/config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /spec/test-app/config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.action_dispatch.cookies_serializer = :json 4 | -------------------------------------------------------------------------------- /spec/test-app/config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += [:password] 5 | -------------------------------------------------------------------------------- /spec/test-app/config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format. Inflections 4 | # are locale specific, and you may define rules for as many different 5 | # locales as you wish. All of these examples are active by default: 6 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 7 | # inflect.plural /^(ox)$/i, '\1en' 8 | # inflect.singular /^(ox)en/i, '\1' 9 | # inflect.irregular 'person', 'people' 10 | # inflect.uncountable %w( fish sheep ) 11 | # end 12 | 13 | # These inflection rules are supported but not enabled by default: 14 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 15 | # inflect.acronym 'RESTful' 16 | # end 17 | -------------------------------------------------------------------------------- /spec/test-app/config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | -------------------------------------------------------------------------------- /spec/test-app/config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.session_store :cookie_store, key: '_test-app_session' 4 | -------------------------------------------------------------------------------- /spec/test-app/config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] if respond_to?(:wrap_parameters) 9 | end 10 | 11 | # To enable root element in JSON for ActiveRecord objects. 12 | # ActiveSupport.on_load(:active_record) do 13 | # self.include_root_in_json = true 14 | # end 15 | -------------------------------------------------------------------------------- /spec/test-app/config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Files in the config/locales directory are used for internationalization 2 | # and are automatically loaded by Rails. If you want to use locales other 3 | # than English, add the necessary files in this directory. 4 | # 5 | # To use the locales, use `I18n.t`: 6 | # 7 | # I18n.t 'hello' 8 | # 9 | # In views, this is aliased to just `t`: 10 | # 11 | # <%= t('hello') %> 12 | # 13 | # To use a different locale, set it with `I18n.locale`: 14 | # 15 | # I18n.locale = :es 16 | # 17 | # This would use the information in config/locales/es.yml. 18 | # 19 | # To learn more, please read the Rails Internationalization guide 20 | # available at http://guides.rubyonrails.org/i18n.html. 21 | 22 | en: 23 | hello: "Hello world" 24 | -------------------------------------------------------------------------------- /spec/test-app/config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | # The priority is based upon order of creation: first created -> highest priority. 3 | # See how all your routes lay out with "rake routes". 4 | 5 | # You can have the root of your site routed with "root" 6 | # root 'welcome#index' 7 | 8 | # Example of regular route: 9 | # get 'products/:id' => 'catalog#view' 10 | 11 | # Example of named route that can be invoked with purchase_url(id: product.id) 12 | # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase 13 | 14 | # Example resource route (maps HTTP verbs to controller actions automatically): 15 | # resources :products 16 | 17 | # Example resource route with options: 18 | # resources :products do 19 | # member do 20 | # get 'short' 21 | # post 'toggle' 22 | # end 23 | # 24 | # collection do 25 | # get 'sold' 26 | # end 27 | # end 28 | 29 | # Example resource route with sub-resources: 30 | # resources :products do 31 | # resources :comments, :sales 32 | # resource :seller 33 | # end 34 | 35 | # Example resource route with more complex sub-resources: 36 | # resources :products do 37 | # resources :comments 38 | # resources :sales do 39 | # get 'recent', on: :collection 40 | # end 41 | # end 42 | 43 | # Example resource route with concerns: 44 | # concern :toggleable do 45 | # post 'toggle' 46 | # end 47 | # resources :posts, concerns: :toggleable 48 | # resources :photos, concerns: :toggleable 49 | 50 | # Example resource route within a namespace: 51 | # namespace :admin do 52 | # # Directs /admin/products/* to Admin::ProductsController 53 | # # (app/controllers/admin/products_controller.rb) 54 | # resources :products 55 | # end 56 | end 57 | -------------------------------------------------------------------------------- /spec/test-app/config/secrets.yml: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Your secret key is used for verifying the integrity of signed cookies. 4 | # If you change this key, all old signed cookies will become invalid! 5 | 6 | # Make sure the secret is at least 30 characters and all random, 7 | # no regular words or you'll be exposed to dictionary attacks. 8 | # You can use `rake secret` to generate a secure secret key. 9 | 10 | # Make sure the secrets in this file are kept private 11 | # if you're sharing your code publicly. 12 | 13 | development: 14 | secret_key_base: 42f1f3aadb7149074086ad031755d0cec758b41cf5cb06ea0494ff3be4c308769bfccf9a31bbdd27641630c10a48e4bb4cfffd8aacaf66dd7db0d8336f909721 15 | 16 | test: 17 | secret_key_base: b090287580ff0ffd7955f76626eea0a64a9e0d3a02352abfadf99e4fcfca5097fe3c7d28426bcf50bf73621ac24eec0bfc8268d61e0d6c3ff51f7ea19bd1f23b 18 | 19 | # Do not keep production secrets in the repository, 20 | # instead read values from the environment. 21 | production: 22 | secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> 23 | -------------------------------------------------------------------------------- /spec/test-app/db/migrate/20160322223225_create_people.rb: -------------------------------------------------------------------------------- 1 | class CreatePeople < ActiveRecord::Migration 2 | def change 3 | create_table :people do |t| 4 | t.string :first_name 5 | t.string :last_name 6 | t.integer :age 7 | t.date :birthdate 8 | 9 | t.timestamps null: false 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /spec/test-app/db/migrate/20160322223258_create_companies.rb: -------------------------------------------------------------------------------- 1 | class CreateCompanies < ActiveRecord::Migration 2 | def change 3 | create_table :companies do |t| 4 | t.string :name 5 | t.string :addr1 6 | t.string :addr2 7 | t.string :city 8 | t.string :state 9 | t.string :zip 10 | t.string :phone 11 | 12 | t.timestamps null: false 13 | end 14 | 15 | add_index :companies, :name 16 | add_index :companies, :city 17 | add_index :companies, :state 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /spec/test-app/db/schema.rb: -------------------------------------------------------------------------------- 1 | # This file is auto-generated from the current state of the database. Instead 2 | # of editing this file, please use the migrations feature of Active Record to 3 | # incrementally modify your database, and then regenerate this schema definition. 4 | # 5 | # Note that this schema.rb definition is the authoritative source for your 6 | # database schema. If you need to create the application database on another 7 | # system, you should be using db:schema:load, not running all the migrations 8 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations 9 | # you'll amass, the slower it'll run and the greater likelihood for issues). 10 | # 11 | # It's strongly recommended that you check this file into your version control system. 12 | 13 | ActiveRecord::Schema.define(version: 20160322223258) do 14 | create_table "companies", force: :cascade do |t| 15 | t.string "addr1" 16 | t.string "addr2" 17 | t.string "city" 18 | t.datetime "created_at", null: false 19 | t.string "name" 20 | t.string "phone" 21 | t.string "state" 22 | t.datetime "updated_at", null: false 23 | t.string "zip" 24 | end 25 | 26 | add_index "companies", ["city"], name: "index_companies_on_city" 27 | add_index "companies", ["name"], name: "index_companies_on_name" 28 | add_index "companies", ["state"], name: "index_companies_on_state" 29 | 30 | create_table "people", force: :cascade do |t| 31 | t.integer "age" 32 | t.date "birthdate" 33 | t.datetime "created_at", null: false 34 | t.string "first_name" 35 | t.string "last_name" 36 | t.datetime "updated_at", null: false 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /spec/test-app/db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) 7 | # Mayor.create(name: 'Emanuel', city: cities.first) 8 | -------------------------------------------------------------------------------- /spec/test-app/lib/assets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jakeonrails/fix-db-schema-conflicts/ae9135e0bb1fb142dd483f883da0064b8be17732/spec/test-app/lib/assets/.keep -------------------------------------------------------------------------------- /spec/test-app/lib/tasks/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jakeonrails/fix-db-schema-conflicts/ae9135e0bb1fb142dd483f883da0064b8be17732/spec/test-app/lib/tasks/.keep -------------------------------------------------------------------------------- /spec/test-app/log/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jakeonrails/fix-db-schema-conflicts/ae9135e0bb1fb142dd483f883da0064b8be17732/spec/test-app/log/.keep -------------------------------------------------------------------------------- /spec/test-app/public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The page you were looking for doesn't exist.

62 |

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

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /spec/test-app/public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The change you wanted was rejected.

62 |

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

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /spec/test-app/public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

We're sorry, but something went wrong.

62 |
63 |

If you are the application owner check the logs for more information.

64 |
65 | 66 | 67 | -------------------------------------------------------------------------------- /spec/test-app/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jakeonrails/fix-db-schema-conflicts/ae9135e0bb1fb142dd483f883da0064b8be17732/spec/test-app/public/favicon.ico -------------------------------------------------------------------------------- /spec/test-app/public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | # User-agent: * 5 | # Disallow: / 6 | -------------------------------------------------------------------------------- /spec/test-app/test/controllers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jakeonrails/fix-db-schema-conflicts/ae9135e0bb1fb142dd483f883da0064b8be17732/spec/test-app/test/controllers/.keep -------------------------------------------------------------------------------- /spec/test-app/test/fixtures/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jakeonrails/fix-db-schema-conflicts/ae9135e0bb1fb142dd483f883da0064b8be17732/spec/test-app/test/fixtures/.keep -------------------------------------------------------------------------------- /spec/test-app/test/fixtures/companies.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | name: MyString 5 | addr1: MyString 6 | addr2: MyString 7 | city: MyString 8 | state: MyString 9 | zip: MyString 10 | phone: MyString 11 | 12 | two: 13 | name: MyString 14 | addr1: MyString 15 | addr2: MyString 16 | city: MyString 17 | state: MyString 18 | zip: MyString 19 | phone: MyString 20 | -------------------------------------------------------------------------------- /spec/test-app/test/fixtures/people.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | first_name: MyString 5 | last_name: MyString 6 | age: 1 7 | birthdate: 2016-03-22 8 | 9 | two: 10 | first_name: MyString 11 | last_name: MyString 12 | age: 1 13 | birthdate: 2016-03-22 14 | -------------------------------------------------------------------------------- /spec/test-app/test/helpers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jakeonrails/fix-db-schema-conflicts/ae9135e0bb1fb142dd483f883da0064b8be17732/spec/test-app/test/helpers/.keep -------------------------------------------------------------------------------- /spec/test-app/test/integration/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jakeonrails/fix-db-schema-conflicts/ae9135e0bb1fb142dd483f883da0064b8be17732/spec/test-app/test/integration/.keep -------------------------------------------------------------------------------- /spec/test-app/test/mailers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jakeonrails/fix-db-schema-conflicts/ae9135e0bb1fb142dd483f883da0064b8be17732/spec/test-app/test/mailers/.keep -------------------------------------------------------------------------------- /spec/test-app/test/models/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jakeonrails/fix-db-schema-conflicts/ae9135e0bb1fb142dd483f883da0064b8be17732/spec/test-app/test/models/.keep -------------------------------------------------------------------------------- /spec/test-app/test/models/company_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class CompanyTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /spec/test-app/test/models/person_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class PersonTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /spec/test-app/test/test_helper.rb: -------------------------------------------------------------------------------- 1 | ENV['RAILS_ENV'] ||= 'test' 2 | require File.expand_path('../../config/environment', __FILE__) 3 | require 'rails/test_help' 4 | 5 | class ActiveSupport::TestCase 6 | # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. 7 | fixtures :all 8 | 9 | # Add more helper methods to be used by all tests here... 10 | end 11 | -------------------------------------------------------------------------------- /spec/test-app/vendor/assets/javascripts/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jakeonrails/fix-db-schema-conflicts/ae9135e0bb1fb142dd483f883da0064b8be17732/spec/test-app/vendor/assets/javascripts/.keep -------------------------------------------------------------------------------- /spec/test-app/vendor/assets/stylesheets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jakeonrails/fix-db-schema-conflicts/ae9135e0bb1fb142dd483f883da0064b8be17732/spec/test-app/vendor/assets/stylesheets/.keep -------------------------------------------------------------------------------- /spec/unit/autocorrect_configuration_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | require 'fix_db_schema_conflicts/autocorrect_configuration' 3 | 4 | RSpec.describe FixDBSchemaConflicts::AutocorrectConfiguration do 5 | subject(:autocorrect_config) { described_class } 6 | 7 | it 'for versions up to 0.49.0' do 8 | installed_rubocop(version: '0.39.0') 9 | 10 | expect(autocorrect_config.load).to eq('.rubocop_schema.yml') 11 | end 12 | 13 | it 'for versions 0.49.0 and above' do 14 | installed_rubocop(version: '0.49.0') 15 | 16 | expect(autocorrect_config.load).to eq('.rubocop_schema.49.yml') 17 | end 18 | 19 | it 'for versions 0.53.0 and above' do 20 | installed_rubocop(version: '0.53.0') 21 | 22 | expect(autocorrect_config.load).to eq('.rubocop_schema.53.yml') 23 | end 24 | 25 | it 'for versions 0.77.0 and above' do 26 | installed_rubocop(version: '0.77.0') 27 | 28 | expect(autocorrect_config.load).to eq('.rubocop_schema.77.yml') 29 | end 30 | 31 | def installed_rubocop(version:) 32 | allow(Gem).to receive_message_chain(:loaded_specs, :[], :version) 33 | .and_return(Gem::Version.new(version)) 34 | end 35 | end 36 | --------------------------------------------------------------------------------