Added extension factory safe defaults

Necessary to provide safe defaults which match the database schema for less setup across the specs. This change also required updating some affected specs since the new defaults caused a slight change in behavior.

Milestone: patch
This commit is contained in:
Brooke Kuhlmann
2026-05-19 11:39:03 -06:00
parent 90669db206
commit 4861baafc9
5 changed files with 13 additions and 7 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ RSpec.describe Terminus::Aspects::Jobs::Schedule do
expect(sidekiq.get_all_schedules).to eq(
"extension-test" => {
"cron" => "* * * * * UTC",
"cron" => "*/1 * * * * UTC",
"class" => "Terminus::Jobs::Batches::Extension",
"args" => [1],
"description" => "The Test extension update schedule."
+4 -4
View File
@@ -22,14 +22,14 @@ RSpec.describe Terminus::Structs::Extension do
label: "Test",
description: nil,
kind: "poll",
mode: nil,
tags: nil,
mode: "text",
tags: [],
static_body: nil,
fields: [],
data: {},
days: nil,
days: [],
interval: 5,
last_day_of_month: nil,
last_day_of_month: false,
start_at: "2025-01-02T03:04:05+00:00",
unit: "minute"
)
+1 -1
View File
@@ -45,11 +45,11 @@ RSpec.describe Terminus::Views::Parts::Extension do
end
it "answers empty array string when empty" do
allow(extension).to receive(:days).and_return([])
expect(part.formatted_days).to eq("")
end
it "answers empty array string when nil" do
allow(extension).to receive(:days).and_return(nil)
expect(part.formatted_days).to eq("")
end
end
+1 -1
View File
@@ -35,7 +35,7 @@ RSpec.describe "Extension Exchanges", :db do
exchange
visit routes.path(:extension_exchanges, extension_id: extension.id)
within "td.bit-actions", text: extension.template do
within "td.bit-actions" do
accept_prompt { click_button "Delete" }
end
+6
View File
@@ -3,11 +3,17 @@
Factory.define :extension, relation: :extension do |factory|
factory.sequence(:name) { "extension_#{it}" }
factory.sequence(:label) { "Extension #{it}" }
factory.mode "text"
factory.kind "poll"
factory.tags []
factory.template "<h1>{{source_1.label}}</h1>"
factory.data Hash.new
factory.fields []
factory.start_at Time.utc(2025, 1, 1, 0, 0, 0)
factory.interval 1
factory.unit "none"
factory.days []
factory.last_day_of_month false
factory.trait :with_logo do |trait|
trait.logo_data do