Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Testing value objects
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Fran Iglesias
November 02, 2018
Programming
0
270
Testing value objects
How to test things like immutability
Fran Iglesias
November 02, 2018
Tweet
Share
More Decks by Fran Iglesias
See All by Fran Iglesias
Tips for daily refactoring
franiglesias
0
340
Introduction to TDD: Red-Green-Refactor
franiglesias
1
290
testing the unpredictable
franiglesias
0
240
Tests doubles: the motion picture
franiglesias
0
520
Low cost techniques for test doubles
franiglesias
0
210
Other Decks in Programming
See All in Programming
20260315 AWSなんもわからん🥲
chiilog
2
170
『Kubernetes ☸️ で実践する Platform Engineering 』を最高速度で読み抜いたる!!👊🏻
hiroki_hasegawa
0
100
go directiveを最新にしすぎないで欲しい話──あるいは、Go 1.26からgo mod initで作られるgo directiveの値が変わる話 / Go 1.26 リリースパーティ
arthur1
2
580
Everything Claude Code OSS詳細 — 5層構造の中身と導入方法
targe
0
150
Claude Code Skill入門
mayahoney
0
410
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
900
どんと来い、データベース信頼性エンジニアリング / Introduction to DBRE
nnaka2992
1
320
米国のサイバーセキュリティタイムラインと見る Goの暗号パッケージの進化
tomtwinkle
2
640
OTP を自動で入力する裏技
megabitsenmzq
0
120
Windows on Ryzen and I
seosoft
0
350
API Platformを活用したPHPによる本格的なWeb API開発 / api-platform-book-intro
ttskch
1
150
DevinとClaude Code、SREの現場で使い倒してみた件
karia
1
1.1k
Featured
See All Featured
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.8k
The SEO Collaboration Effect
kristinabergwall1
0
400
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.3k
Designing Powerful Visuals for Engaging Learning
tmiket
0
290
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
91
Writing Fast Ruby
sferik
630
63k
Un-Boring Meetings
codingconduct
0
230
Building the Perfect Custom Keyboard
takai
2
720
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
160
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
200
Transcript
TDD 101 2. TDDing Value Objects
TDDing Value Objects
Value Object (DDD) Small object Represents a concept Equality based
on value Immutable: • Should be created consistent • Mutators should return new instances
So… How do you TDD a VO?
TDD VO Think of an invalid example Write a test
that fails expecting exception Make the test pass Repeat as needed to test invalid cases
TDD VO Think of a valid example Write a test
that fails asserting value Make the test pass
TDD VO Equality Write a test that fails expecting inequality
Make the test pass Then write a test that fails expecting equality Make the test pass
TDD VO Immutability Think of a valid example of a
mutator Write a test that fails expecting a different instance Make the test pass
None