Skip to content

Commit

Permalink
Fixing specs on windows. (#1074)
Browse files Browse the repository at this point in the history
* Fixing specs on windows. Fixes #1072

* bump the min crystal version to 1.11 to support EOL for Windows

* Reverting all of the changed files.

* hack to get windows to pass this spec

* I think this hack will allow the spec to remain as it was and still work on Windows
  • Loading branch information
jwoertink authored Nov 10, 2024
1 parent dcbcaff commit 55556c9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.cr text eol=lf
10 changes: 9 additions & 1 deletion spec/avram/migrator/gen/migration_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 55556c9

Please sign in to comment.