Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
mostlyobvious committed Mar 29, 2024
1 parent 26f810d commit 146b094
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ruby_event_store-active_record/spec/migration_test_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ module ActiveRecord
end

specify "postgres" do
skip unless ENV["DATABASE_URL"].include?("postgres")
skip unless postgres?

data_type = data_type_to_pg_type(ENV["DATA_TYPE"])

expect(
Expand Down Expand Up @@ -69,7 +70,7 @@ module ActiveRecord
end

specify "mysql" do
skip unless ENV["DATABASE_URL"].include?("mysql")
skip unless mysql?

data_type = data_type_to_mysql_type(ENV["DATA_TYPE"])

Expand Down Expand Up @@ -118,7 +119,7 @@ module ActiveRecord
end

specify "sqlite" do
skip unless ENV["DATABASE_URL"].include?("sqlite")
skip unless sqlite?

expect(sqlite_schema("event_store_events")).to eq <<~SCHEMA.strip
CREATE TABLE "event_store_events" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "event_id" varchar(36) NOT NULL, "event_type" varchar NOT NULL, "metadata" blob, "data" blob NOT NULL, "created_at" datetime(6) NOT NULL, "valid_at" datetime(6))
Expand Down
4 changes: 4 additions & 0 deletions support/helpers/schema_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ def template_directory
return "mysql" if mysql?
end

def sqlite?
ENV["DATABASE_URL"].include?("sqlite")
end

def mysql?
ENV["DATABASE_URL"].include?("mysql2")
end
Expand Down

0 comments on commit 146b094

Please sign in to comment.