From adcb405991861422f7758bc0ec0bdb99ae752b6f Mon Sep 17 00:00:00 2001 From: Jeremy Green Date: Tue, 5 Sep 2023 15:49:17 -0500 Subject: [PATCH 1/4] Try using build instead of create + rollback in ExampleBot --- test/factories/invitations.rb | 2 ++ test/factories/memberships.rb | 1 + .../scaffolding/completely_concrete/tangible_things.rb | 2 ++ test/factories/teams.rb | 1 + test/factories/users.rb | 1 + test/factories/webhooks/outgoing/endpoints.rb | 2 ++ test/factories/webhooks/outgoing/events.rb | 3 +++ 7 files changed, 12 insertions(+) diff --git a/test/factories/invitations.rb b/test/factories/invitations.rb index 31b6cc6ca..765f37d46 100644 --- a/test/factories/invitations.rb +++ b/test/factories/invitations.rb @@ -6,6 +6,8 @@ sequence(:email) { |n| "example#{n}@email.com" } factory :invitation_example do + id { "42" } + from_membership_id { "42" } team { FactoryBot.example(:team) } membership { FactoryBot.example(:membership) } end diff --git a/test/factories/memberships.rb b/test/factories/memberships.rb index f2f220ae5..b91d0ad7a 100644 --- a/test/factories/memberships.rb +++ b/test/factories/memberships.rb @@ -4,6 +4,7 @@ association :team factory :membership_example do + id { "42" } team { FactoryBot.example(:team) } user { FactoryBot.example(:user, teams: [team]) } invitation_id { nil } diff --git a/test/factories/scaffolding/completely_concrete/tangible_things.rb b/test/factories/scaffolding/completely_concrete/tangible_things.rb index f5d52f172..0562b4ba9 100644 --- a/test/factories/scaffolding/completely_concrete/tangible_things.rb +++ b/test/factories/scaffolding/completely_concrete/tangible_things.rb @@ -15,6 +15,8 @@ sort_order { 1 } factory :scaffolding_completely_concrete_tangible_thing_example do + id{ "42" } + absolutely_abstract_creative_concept_id{ "42" } text_field_value { "Example" } end end diff --git a/test/factories/teams.rb b/test/factories/teams.rb index aa0801405..7e17cd2b4 100644 --- a/test/factories/teams.rb +++ b/test/factories/teams.rb @@ -6,6 +6,7 @@ locale { nil } factory :team_example do + id { "42" } sequence(:name) { |n| "EXAMPLE Generic Team #{n}" } sequence(:slug) { |n| "EXAMPLE team_#{n}" } time_zone { ActiveSupport::TimeZone.all.first.name } diff --git a/test/factories/users.rb b/test/factories/users.rb index af8fa6304..97808788c 100644 --- a/test/factories/users.rb +++ b/test/factories/users.rb @@ -22,6 +22,7 @@ end factory :user_example do + id { "42" } first_name { "Example First Name" } last_name { "Example Last Name" } end diff --git a/test/factories/webhooks/outgoing/endpoints.rb b/test/factories/webhooks/outgoing/endpoints.rb index ae481a9f4..e8cc25189 100644 --- a/test/factories/webhooks/outgoing/endpoints.rb +++ b/test/factories/webhooks/outgoing/endpoints.rb @@ -5,6 +5,8 @@ url { "https://example.com/some-endpoint-url" } factory :webhooks_outgoing_endpoint_example do + id { "42" } + team_id { "42" } name { "Example Endpoint" } end end diff --git a/test/factories/webhooks/outgoing/events.rb b/test/factories/webhooks/outgoing/events.rb index 6ff4b45ba..9f62219cd 100644 --- a/test/factories/webhooks/outgoing/events.rb +++ b/test/factories/webhooks/outgoing/events.rb @@ -10,6 +10,9 @@ end factory :webhooks_outgoing_event_example do + id { "42" } + subject_id { "42" } + team_id { "42" } data { {id: 1, created_at: Time.now.utc, From d4d2155ff05da1bea255997a818b0fd56c74f901 Mon Sep 17 00:00:00 2001 From: Jeremy Green Date: Tue, 5 Sep 2023 16:00:00 -0500 Subject: [PATCH 2/4] linter --- .../scaffolding/completely_concrete/tangible_things.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/factories/scaffolding/completely_concrete/tangible_things.rb b/test/factories/scaffolding/completely_concrete/tangible_things.rb index 0562b4ba9..da4d8eaa5 100644 --- a/test/factories/scaffolding/completely_concrete/tangible_things.rb +++ b/test/factories/scaffolding/completely_concrete/tangible_things.rb @@ -15,8 +15,8 @@ sort_order { 1 } factory :scaffolding_completely_concrete_tangible_thing_example do - id{ "42" } - absolutely_abstract_creative_concept_id{ "42" } + id { "42" } + absolutely_abstract_creative_concept_id { "42" } text_field_value { "Example" } end end From b9a37420ad9e082317b3b89bd4097cb3998f1017 Mon Sep 17 00:00:00 2001 From: Yuri Sidorov <403994+newstler@users.noreply.github.com> Date: Tue, 10 Oct 2023 01:31:49 +0200 Subject: [PATCH 3/4] Update example factories to match previous OpenAPI --- config/environments/development.rb | 1 - test/factories/invitations.rb | 4 ++-- test/factories/memberships.rb | 4 +++- .../completely_concrete/tangible_things.rb | 6 ++++-- test/factories/teams.rb | 4 +++- test/factories/users.rb | 4 +++- test/factories/webhooks/outgoing/endpoints.rb | 6 ++++-- test/factories/webhooks/outgoing/events.rb | 14 ++++++++------ 8 files changed, 27 insertions(+), 16 deletions(-) diff --git a/config/environments/development.rb b/config/environments/development.rb index d88e85058..fbf53240b 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -28,7 +28,6 @@ config.action_controller.perform_caching = true config.action_controller.enable_fragment_cache_logging = true - config.cache_store = :memory_store config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{2.days.to_i}" } diff --git a/test/factories/invitations.rb b/test/factories/invitations.rb index 765f37d46..6cba3f44c 100644 --- a/test/factories/invitations.rb +++ b/test/factories/invitations.rb @@ -6,8 +6,8 @@ sequence(:email) { |n| "example#{n}@email.com" } factory :invitation_example do - id { "42" } - from_membership_id { "42" } + id { 42 } + from_membership_id { 42 } team { FactoryBot.example(:team) } membership { FactoryBot.example(:membership) } end diff --git a/test/factories/memberships.rb b/test/factories/memberships.rb index b91d0ad7a..90b285501 100644 --- a/test/factories/memberships.rb +++ b/test/factories/memberships.rb @@ -4,7 +4,7 @@ association :team factory :membership_example do - id { "42" } + id { 42 } team { FactoryBot.example(:team) } user { FactoryBot.example(:user, teams: [team]) } invitation_id { nil } @@ -15,6 +15,8 @@ platform_agent_of_id { nil } platform_agent { false } role_ids { ["admin"] } + created_at { DateTime.new(2023, 1, 1) } + updated_at { DateTime.new(2023, 1, 2) } # The `added_by` attribute is an optional foreign_key which points # to another membership and is automatically populated when someone diff --git a/test/factories/scaffolding/completely_concrete/tangible_things.rb b/test/factories/scaffolding/completely_concrete/tangible_things.rb index da4d8eaa5..92e020fba 100644 --- a/test/factories/scaffolding/completely_concrete/tangible_things.rb +++ b/test/factories/scaffolding/completely_concrete/tangible_things.rb @@ -15,9 +15,11 @@ sort_order { 1 } factory :scaffolding_completely_concrete_tangible_thing_example do - id { "42" } - absolutely_abstract_creative_concept_id { "42" } + id { 42 } + absolutely_abstract_creative_concept_id { 42 } text_field_value { "Example" } + created_at { DateTime.new(2023, 1, 1) } + updated_at { DateTime.new(2023, 1, 2) } end end end diff --git a/test/factories/teams.rb b/test/factories/teams.rb index 7e17cd2b4..1c06181ef 100644 --- a/test/factories/teams.rb +++ b/test/factories/teams.rb @@ -6,11 +6,13 @@ locale { nil } factory :team_example do - id { "42" } + id { 42 } sequence(:name) { |n| "EXAMPLE Generic Team #{n}" } sequence(:slug) { |n| "EXAMPLE team_#{n}" } time_zone { ActiveSupport::TimeZone.all.first.name } locale { "en" } + created_at { DateTime.new(2023, 1, 1) } + updated_at { DateTime.new(2023, 1, 2) } end end end diff --git a/test/factories/users.rb b/test/factories/users.rb index 97808788c..6973274da 100644 --- a/test/factories/users.rb +++ b/test/factories/users.rb @@ -22,9 +22,11 @@ end factory :user_example do - id { "42" } + id { 42 } first_name { "Example First Name" } last_name { "Example Last Name" } + created_at { DateTime.new(2023, 1, 1) } + updated_at { DateTime.new(2023, 1, 2) } end end end diff --git a/test/factories/webhooks/outgoing/endpoints.rb b/test/factories/webhooks/outgoing/endpoints.rb index e8cc25189..0c446b1b3 100644 --- a/test/factories/webhooks/outgoing/endpoints.rb +++ b/test/factories/webhooks/outgoing/endpoints.rb @@ -5,9 +5,11 @@ url { "https://example.com/some-endpoint-url" } factory :webhooks_outgoing_endpoint_example do - id { "42" } - team_id { "42" } + id { 42 } + team_id { 42 } name { "Example Endpoint" } + created_at { DateTime.new(2023, 1, 1) } + updated_at { DateTime.new(2023, 1, 2) } end end end diff --git a/test/factories/webhooks/outgoing/events.rb b/test/factories/webhooks/outgoing/events.rb index 9f62219cd..f71ba4f16 100644 --- a/test/factories/webhooks/outgoing/events.rb +++ b/test/factories/webhooks/outgoing/events.rb @@ -10,13 +10,15 @@ end factory :webhooks_outgoing_event_example do - id { "42" } - subject_id { "42" } - team_id { "42" } + id { 42 } + subject_id { 42 } + team_id { 42 } + created_at { DateTime.new(2023, 1, 1) } + updated_at { DateTime.new(2023, 1, 2) } data { - {id: 1, - created_at: Time.now.utc, - updated_at: Time.now.utc, + {id: 42, + created_at: DateTime.new(2023, 1, 1).utc, + updated_at: DateTime.new(2023, 1, 2).utc, value: "one"}.to_json } end From 03ce56ef0f610c6bf872367c6cec9569158685c0 Mon Sep 17 00:00:00 2001 From: Jeremy Green Date: Tue, 17 Oct 2023 12:26:02 -0500 Subject: [PATCH 4/4] Add back something that was accidentally removed --- config/environments/development.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/config/environments/development.rb b/config/environments/development.rb index fbf53240b..d88e85058 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -28,6 +28,7 @@ config.action_controller.perform_caching = true config.action_controller.enable_fragment_cache_logging = true + config.cache_store = :memory_store config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{2.days.to_i}" }