Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing specs on windows. #1074

Merged
merged 5 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading