lib/snowglobe/rails_application.rb in snowglobe-0.2.0 vs lib/snowglobe/rails_application.rb in snowglobe-0.3.0

- old
+ new

@@ -65,18 +65,18 @@ else "ActiveRecord::Migration" end end - private - - attr_reader :fs, :command_runner, :bundle, :database - def rails_version @_rails_version ||= bundle.version_of("rails") end + private + + attr_reader :fs, :command_runner, :bundle, :database + def migrations_directory fs.find_in_project("db/migrate") end def temp_view_path_for(path) @@ -86,10 +86,11 @@ def generate rails_new fix_available_locales_warning remove_bootsnap write_database_configuration + configure_tests_to_run_in_sorted_order if bundle.version_of("rails") >= 5 add_initializer_for_time_zone_aware_types end end @@ -123,9 +124,17 @@ end def write_database_configuration fs.open_file("config/database.yml", "w") do |f| YAML.dump(database.config.to_hash, f) + end + end + + def configure_tests_to_run_in_sorted_order + fs.transform_file("config/environments/test.rb") do |lines| + lines.insert(-2, <<-CONTENT) + config.active_support.test_order = :sorted + CONTENT end end def add_initializer_for_time_zone_aware_types path = "config/initializers/configure_time_zone_aware_types.rb"