diff --git a/ruby_event_store-active_record/spec/migration_test_spec.rb b/ruby_event_store-active_record/spec/migration_test_spec.rb index 6384eb3cca..fd3e091ced 100644 --- a/ruby_event_store-active_record/spec/migration_test_spec.rb +++ b/ruby_event_store-active_record/spec/migration_test_spec.rb @@ -24,10 +24,7 @@ module ActiveRecord data_type = data_type_to_pg_type(ENV["DATA_TYPE"]) expect( - [ - pg_schema("event_store_events"), - pg_schema("event_store_events_in_streams") - ].join("\n").gsub(/\s+/, " ") + pg_schema("event_store_events").gsub(/\s+/, " ") ).to eq <<~SCHEMA.strip.gsub(/\s+/, " ") Table "public.event_store_events" Column | Type | Collation | Nullable | Default @@ -47,6 +44,11 @@ module ActiveRecord "index_event_store_events_on_valid_at" btree (valid_at) Referenced by: TABLE "event_store_events_in_streams" CONSTRAINT "fk_rails_c8d52b5857" FOREIGN KEY (event_id) REFERENCES event_store_events(event_id) + SCHEMA + + expect( + pg_schema("event_store_events_in_streams").gsub(/\s+/, " ") + ).to eq <<~SCHEMA.strip.gsub(/\s+/, " ") Table "public.event_store_events_in_streams" Column | Type | Collation | Nullable | Default ------------+--------------------------------+-----------+----------+----------------------------------------------------------- @@ -79,12 +81,7 @@ module ActiveRecord int_lenght = mysql_major_version == 8 ? "" : "(11)" bigint_lenght = mysql_major_version == 8 ? "" : "(20)" - expect( - [ - mysql_schema("event_store_events"), - mysql_schema("event_store_events_in_streams") - ].join("\n") - ).to eq <<~SCHEMA.strip + expect(mysql_schema("event_store_events")).to eq <<~SCHEMA.strip CREATE TABLE `event_store_events` ( `id` bigint#{bigint_lenght} NOT NULL AUTO_INCREMENT, `event_id` varchar(36) NOT NULL, @@ -99,6 +96,11 @@ module ActiveRecord KEY `index_event_store_events_on_created_at` (`created_at`), KEY `index_event_store_events_on_valid_at` (`valid_at`) ) ENGINE=InnoDB DEFAULT CHARSET=#{charset}#{collation} + SCHEMA + + expect( + mysql_schema("event_store_events_in_streams") + ).to eq <<~SCHEMA.strip CREATE TABLE `event_store_events_in_streams` ( `id` bigint#{bigint_lenght} NOT NULL AUTO_INCREMENT, `stream` varchar(255) NOT NULL, @@ -118,17 +120,17 @@ module ActiveRecord specify "sqlite" do skip unless ENV["DATABASE_URL"].include?("sqlite") - expect( - [ - sqlite_schema("event_store_events"), - sqlite_schema("event_store_events_in_streams") - ].join("\n") - ).to eq <<~SCHEMA.strip + 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)) CREATE UNIQUE INDEX "index_event_store_events_on_event_id" ON "event_store_events" ("event_id") CREATE INDEX "index_event_store_events_on_event_type" ON "event_store_events" ("event_type") CREATE INDEX "index_event_store_events_on_created_at" ON "event_store_events" ("created_at") CREATE INDEX "index_event_store_events_on_valid_at" ON "event_store_events" ("valid_at") + SCHEMA + + expect( + sqlite_schema("event_store_events_in_streams") + ).to eq <<~SCHEMA.strip CREATE TABLE "event_store_events_in_streams" ("id" integer NOT NULL PRIMARY KEY, "stream" varchar NOT NULL, "position" integer DEFAULT NULL, "event_id" varchar(36) NOT NULL, "created_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_c8d52b5857" FOREIGN KEY ("event_id") REFERENCES "event_store_events" ("event_id")