diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..fdd3f45e1 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.cr text eol=lf \ No newline at end of file diff --git a/spec/avram/migrator/gen/migration_spec.cr b/spec/avram/migrator/gen/migration_spec.cr index 6a618af54..7d55217d4 100644 --- a/spec/avram/migrator/gen/migration_spec.cr +++ b/spec/avram/migrator/gen/migration_spec.cr @@ -31,7 +31,15 @@ describe "Generating migrations" do rollback_contents: rollback_contents ).generate(_version: "123") - File.read("./db/migrations/123_create_users.cr").should contain <<-MIGRATION + created_migration_file = File.read("./db/migrations/123_create_users.cr") + + {% if flag?(:windows) %} + # NOTE: Reading from the file on windows returns \r\n, but this spec's line endings are still \n + # due to the .gitattributes file. Also note that `EOL` didn't exist until Crystal 1.11.0 + created_migration_file = created_migration_file.gsub(EOL, "\n") + {% end %} + + created_migration_file.should contain <<-MIGRATION class CreateUsers::V123 < Avram::Migrator::Migration::V1 def migrate create :users do