jumbotron 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +10 -1
- data/docs/testing.md +62 -0
- data/docs/upgrades/0.1.2.md +29 -0
- data/lib/jumbotron/testing.rb +54 -0
- data/lib/jumbotron/version.rb +1 -1
- data/spec/factories/jumbotron/bookmaker.rb +9 -0
- data/spec/factories/jumbotron/game.rb +10 -0
- data/spec/factories/jumbotron/game_participant.rb +10 -0
- data/spec/factories/jumbotron/league.rb +8 -0
- data/spec/factories/jumbotron/line_observation.rb +16 -0
- data/spec/factories/jumbotron/observation_batch.rb +10 -0
- data/spec/factories/jumbotron/provider_identity.rb +10 -0
- data/spec/factories/jumbotron/schedule_group.rb +11 -0
- data/spec/factories/jumbotron/season.rb +8 -0
- data/spec/factories/jumbotron/season_phase.rb +8 -0
- data/spec/factories/jumbotron/sport.rb +7 -0
- data/spec/factories/jumbotron/team.rb +9 -0
- data/spec/factories/jumbotron/venue.rb +9 -0
- metadata +18 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 919c3aee919ada06d4cee0f0870663c42441797ba0727babc0a00ead86c8630c
|
|
4
|
+
data.tar.gz: e929ed6604624bab66044aaf40c0cb8a6420aa6e838a044c881480d3b8290af5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 77c1b4deb6fde54b227b0cc3f41212b363dd8745dcc110ef8dffe6fdd9c1ca82f804d1d18545d59742c5a33df233ff6ba07d3ed8af4cf3d8d0f215e1678c17d9
|
|
7
|
+
data.tar.gz: 17d5b91913fd0ff210c299732ce465f77e40de6a3511b0679f3ef3e81a03fed9e3c1f1bf1fd86bd282ac93e82912dbf96e723775719f0ce5de93d1b5d4fb1887
|
data/README.md
CHANGED
|
@@ -2,4 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Jumbotron is a backend sports-truth Rails Engine.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Testing
|
|
6
|
+
|
|
7
|
+
Shared factories for hosts:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
require "jumbotron/testing"
|
|
11
|
+
Jumbotron::Testing.install!
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Details: [Testing with Jumbotron](docs/testing.md).
|
data/docs/testing.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Testing with Jumbotron
|
|
2
|
+
|
|
3
|
+
Jumbotron ships FactoryBot definitions for engine-owned models. Hosts load
|
|
4
|
+
them explicitly in the test suite — there is no production Railtie and
|
|
5
|
+
FactoryBot is not a runtime gem dependency.
|
|
6
|
+
|
|
7
|
+
Back to [README](../README.md).
|
|
8
|
+
|
|
9
|
+
## Setup
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
# spec/rails_helper.rb (after Rails is loaded)
|
|
13
|
+
require "jumbotron/testing"
|
|
14
|
+
|
|
15
|
+
Jumbotron::Testing.install! # preferred
|
|
16
|
+
# Jumbotron::Testing.load_factories! # factories-only / advanced
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Call `install!` **before** any host `FactoryBot.modify` blocks so shared
|
|
20
|
+
factories exist when you extend them.
|
|
21
|
+
|
|
22
|
+
## Extending factories
|
|
23
|
+
|
|
24
|
+
Hosts must not redefine Jumbotron base factories. Use `FactoryBot.modify`:
|
|
25
|
+
|
|
26
|
+
```ruby
|
|
27
|
+
FactoryBot.modify do
|
|
28
|
+
factory :jumbotron_game do
|
|
29
|
+
trait :completed do
|
|
30
|
+
lifecycle { "completed" }
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Packaging and evolution
|
|
37
|
+
|
|
38
|
+
Factory files live under `spec/factories/**` inside the gem and are included in
|
|
39
|
+
the gemspec. Adding or changing a shared factory is a normal Jumbotron gem
|
|
40
|
+
bump — hosts pick it up on upgrade.
|
|
41
|
+
|
|
42
|
+
`Jumbotron::Testing.load_factories!` is idempotent (safe to call more than
|
|
43
|
+
once). It loads each factory file under `Jumbotron::Engine.root/spec/factories`
|
|
44
|
+
explicitly; it does not append to global `FactoryBot.definition_file_paths`.
|
|
45
|
+
|
|
46
|
+
## Responsibilities
|
|
47
|
+
|
|
48
|
+
| Owner | Responsibility |
|
|
49
|
+
|-------|----------------|
|
|
50
|
+
| Jumbotron | Base factories for Jumbotron-owned models; Testing API; packaging |
|
|
51
|
+
| Host | `install!` in the test boot path; product traits via `FactoryBot.modify` |
|
|
52
|
+
|
|
53
|
+
## Factory invariant
|
|
54
|
+
|
|
55
|
+
Base factories construct **persistent model state only**. They must not invoke
|
|
56
|
+
Services, Workflows, ApplicationWorkflows, or external adapters.
|
|
57
|
+
|
|
58
|
+
## Contributors vs hosts
|
|
59
|
+
|
|
60
|
+
This guide is the **host Testing API**. Contributors working inside the Jumbotron
|
|
61
|
+
repository also follow workspace test standards and architecture guards under
|
|
62
|
+
`spec/architecture/`.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Upgrade: Jumbotron 0.1.2
|
|
2
|
+
|
|
3
|
+
**From:** `0.1.1`
|
|
4
|
+
**To:** `0.1.2`
|
|
5
|
+
|
|
6
|
+
Additive host Testing API. No runtime or public consumer contract break.
|
|
7
|
+
|
|
8
|
+
## Host-facing change
|
|
9
|
+
|
|
10
|
+
| Change | Host impact |
|
|
11
|
+
|--------|-------------|
|
|
12
|
+
| `Jumbotron::Testing.install!` | Preferred host entry to load shared FactoryBot definitions |
|
|
13
|
+
| Factories packaged in the gem | `spec/factories/**` is included in the gemspec (was missing in 0.1.1) |
|
|
14
|
+
|
|
15
|
+
## Setup
|
|
16
|
+
|
|
17
|
+
```ruby
|
|
18
|
+
# spec/rails_helper.rb (after Rails is loaded)
|
|
19
|
+
require "jumbotron/testing"
|
|
20
|
+
Jumbotron::Testing.install!
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Details: [Testing with Jumbotron](../testing.md).
|
|
24
|
+
|
|
25
|
+
## Upgrade checklist
|
|
26
|
+
|
|
27
|
+
1. Bump gem to `0.1.2` (or `>= 0.1.2`).
|
|
28
|
+
2. Replace any host glob of `Jumbotron::Engine.root.join("spec/factories/**/*.rb")` with `Jumbotron::Testing.install!`.
|
|
29
|
+
3. Ensure `factory_bot` or `factory_bot_rails` remains in the host test group.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Jumbotron
|
|
4
|
+
# Explicit host/test entry for shared FactoryBot definitions and related
|
|
5
|
+
# testing bootstrap. Not loaded in production via Railtie.
|
|
6
|
+
module Testing
|
|
7
|
+
class << self
|
|
8
|
+
# Preferred host entry. Currently loads factories; reserved for future
|
|
9
|
+
# shared testing setup (helpers, config checks).
|
|
10
|
+
def install!
|
|
11
|
+
load_factories!
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# Load Jumbotron FactoryBot definitions exactly once.
|
|
15
|
+
# Loads files under Engine.root/spec/factories explicitly (does not mutate
|
|
16
|
+
# global definition_file_paths / find_definitions).
|
|
17
|
+
def load_factories!
|
|
18
|
+
return if factories_loaded?
|
|
19
|
+
|
|
20
|
+
require_factory_bot!
|
|
21
|
+
factory_files.each { |path| Kernel.load(path) }
|
|
22
|
+
@factories_loaded = true
|
|
23
|
+
true
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def factories_loaded?
|
|
27
|
+
@factories_loaded == true
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Reset loader state (specs only). Does not undefine FactoryBot factories.
|
|
31
|
+
def reset_factories_loaded_flag!
|
|
32
|
+
@factories_loaded = false
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def factories_path
|
|
36
|
+
Jumbotron::Engine.root.join("spec/factories")
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
private
|
|
40
|
+
|
|
41
|
+
def require_factory_bot!
|
|
42
|
+
require "factory_bot"
|
|
43
|
+
rescue LoadError
|
|
44
|
+
raise LoadError,
|
|
45
|
+
"Jumbotron::Testing requires the factory_bot gem. " \
|
|
46
|
+
"Add `factory_bot` or `factory_bot_rails` to your host test group."
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def factory_files
|
|
50
|
+
Dir[factories_path.join("**/*.rb").to_s]
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
data/lib/jumbotron/version.rb
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
FactoryBot.define do
|
|
4
|
+
factory :jumbotron_game, class: "Jumbotron::Game" do
|
|
5
|
+
league { association :jumbotron_league }
|
|
6
|
+
season { association :jumbotron_season, league: league }
|
|
7
|
+
observed_at { Time.current }
|
|
8
|
+
changed_at { Time.current }
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
FactoryBot.define do
|
|
4
|
+
factory :jumbotron_game_participant, class: "Jumbotron::GameParticipant" do
|
|
5
|
+
association :game, factory: :jumbotron_game
|
|
6
|
+
association :team, factory: :jumbotron_team
|
|
7
|
+
observed_at { Time.current }
|
|
8
|
+
changed_at { Time.current }
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
FactoryBot.define do
|
|
4
|
+
factory :jumbotron_line_observation, class: "Jumbotron::LineObservation" do
|
|
5
|
+
association :game, factory: :jumbotron_game
|
|
6
|
+
association :bookmaker, factory: :jumbotron_bookmaker
|
|
7
|
+
association :observation_batch, factory: :jumbotron_observation_batch
|
|
8
|
+
market { "spread" }
|
|
9
|
+
outcome { "home" }
|
|
10
|
+
source { "observed" }
|
|
11
|
+
line_value { BigDecimal("-3.5") }
|
|
12
|
+
price_american { -110 }
|
|
13
|
+
observed_at { Time.current }
|
|
14
|
+
changed_at { Time.current }
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
FactoryBot.define do
|
|
4
|
+
factory :jumbotron_provider_identity, class: "Jumbotron::ProviderIdentity" do
|
|
5
|
+
association :target, factory: :jumbotron_sport
|
|
6
|
+
provider { "espn" }
|
|
7
|
+
object_namespace { "sport" }
|
|
8
|
+
sequence(:provider_id) { |n| "ext-#{n}" }
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
FactoryBot.define do
|
|
4
|
+
factory :jumbotron_schedule_group, class: "Jumbotron::ScheduleGroup" do
|
|
5
|
+
association :season, factory: :jumbotron_season
|
|
6
|
+
season_phase { association :jumbotron_season_phase, season: season }
|
|
7
|
+
kind { "week" }
|
|
8
|
+
sequence(:number) { |n| n }
|
|
9
|
+
name { "Week #{number}" }
|
|
10
|
+
end
|
|
11
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jumbotron
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- matt-taylor
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-08-
|
|
11
|
+
date: 2026-08-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: command_tower
|
|
@@ -205,11 +205,27 @@ files:
|
|
|
205
205
|
- db/migrate/20260813000001_create_jumbotron_schedule_groups.rb
|
|
206
206
|
- db/migrate/20260814000001_create_jumbotron_line_observations.rb
|
|
207
207
|
- db/migrate/20260820000001_add_progress_to_jumbotron_games.rb
|
|
208
|
+
- docs/testing.md
|
|
209
|
+
- docs/upgrades/0.1.2.md
|
|
208
210
|
- lib/jumbotron.rb
|
|
209
211
|
- lib/jumbotron/client.rb
|
|
210
212
|
- lib/jumbotron/engine.rb
|
|
213
|
+
- lib/jumbotron/testing.rb
|
|
211
214
|
- lib/jumbotron/version.rb
|
|
212
215
|
- lib/tasks/jumbotron_schedules.rake
|
|
216
|
+
- spec/factories/jumbotron/bookmaker.rb
|
|
217
|
+
- spec/factories/jumbotron/game.rb
|
|
218
|
+
- spec/factories/jumbotron/game_participant.rb
|
|
219
|
+
- spec/factories/jumbotron/league.rb
|
|
220
|
+
- spec/factories/jumbotron/line_observation.rb
|
|
221
|
+
- spec/factories/jumbotron/observation_batch.rb
|
|
222
|
+
- spec/factories/jumbotron/provider_identity.rb
|
|
223
|
+
- spec/factories/jumbotron/schedule_group.rb
|
|
224
|
+
- spec/factories/jumbotron/season.rb
|
|
225
|
+
- spec/factories/jumbotron/season_phase.rb
|
|
226
|
+
- spec/factories/jumbotron/sport.rb
|
|
227
|
+
- spec/factories/jumbotron/team.rb
|
|
228
|
+
- spec/factories/jumbotron/venue.rb
|
|
213
229
|
homepage: https://github.com/matt-taylor/jumbotron
|
|
214
230
|
licenses:
|
|
215
231
|
- MIT
|