Skip to content

Commit 0b7c2b6

Browse files
committed
add early return to the FT
add a reminder for its removal to the scratchpad, remove note on refactor with broken state
1 parent 518fd5b commit 0b7c2b6

File tree

1 file changed

+48
-13
lines changed

1 file changed

+48
-13
lines changed

chapter_13_database_layer_validation.asciidoc

Lines changed: 48 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,39 @@ see that we've got past the first part of the test, and are now onto the second
583583
check--that submitting a second empty item also shows an error.
584584

585585
((("", startref="MLVsurfac13")))We've
586-
got some working code though, so let's have a commit:
586+
got some working code though, so let's put an early return in the FT to separate
587+
what we got working from those that still need to be dealt with:
588+
[role="sourcecode"]
589+
// TODO fix code listing reference number
590+
.src/functional_tests/test_list_item_validation.py (ch13l???)
591+
====
592+
[source,python]
593+
----
594+
class ItemValidationTest(FunctionalTest):
595+
def test_cannot_add_empty_list_items(self):
596+
[...]
597+
self.browser.find_element(By.ID, "id_new_item").send_keys(Keys.ENTER)
598+
self.wait_for_row_in_list_table("1: Buy milk")
599+
600+
return
601+
# TODO fix the remaining test scenarios
602+
603+
# Perversely, she now decides to submit a second blank list item
604+
self.browser.find_element(By.ID, "id_new_item").send_keys(Keys.ENTER)
605+
[...]
606+
====
607+
608+
609+
We should also remind ourselves not to forget to remove this early return:
610+
611+
612+
[role="scratchpad"]
613+
*****
614+
* 'Remove hardcoded URLs from views.py'
615+
* 'Remove the early return from the FT'
616+
*****
617+
618+
...and it's time to commit our changes:
587619

588620

589621
[subs="specialcharacters,quotes"]
@@ -642,6 +674,7 @@ and while we're thinking about it, there's one in 'home.html' too:
642674
[role="scratchpad"]
643675
*****
644676
* 'Remove hardcoded URLs from views.py'
677+
* 'Remove the early return from the FT'
645678
* 'Remove hardcoded URL from forms in list.html and home.html'
646679
*****
647680

@@ -798,7 +831,17 @@ OK
798831
----
799832

800833

801-
Let's try a full FT run:
834+
Let's try a full FT run: they're all passing! We can remove the early return
835+
now.
836+
837+
[role="scratchpad"]
838+
*****
839+
* 'Remove hardcoded URLs from views.py'
840+
* '[strikethrough line-through]#Remove the early return from the FT#'
841+
* 'Remove hardcoded URL from forms in list.html and home.html'
842+
*****
843+
844+
Run the FTs again to see what's still there that needs to be fixed:
802845

803846

804847
[subs="specialcharacters,quotes"]
@@ -822,17 +865,6 @@ We should commit there:
822865
$ *git commit -am "Refactor list view to handle new item POSTs"*
823866
----
824867

825-
NOTE: So did I break the rule about never refactoring against failing tests?
826-
In this case, it's allowed, because the refactor is required
827-
to get our new functionality to work.
828-
You should definitely never refactor against failing _unit_ tests.
829-
But in my book it's OK for the FT for the current story you're working on
830-
to be failing.footnote:[
831-
If you really want a "clean" test run, you could add a skip or an early return
832-
to the current FT, but you'd need to make sure you didn't accidentally forget it.]
833-
834-
835-
836868

837869

838870
==== Enforcing Model Validation in view_list
@@ -915,6 +947,7 @@ We'll just add it to our scratchpad for now:
915947
[role="scratchpad"]
916948
*****
917949
* 'Remove hardcoded URLs from views.py'
950+
* '[strikethrough line-through]#Remove the early return from the FT#'
918951
* 'Remove hardcoded URL from forms in list.html and home.html'
919952
* 'Remove duplication of validation logic in views'
920953
*****
@@ -1029,6 +1062,7 @@ $ *git commit -am "Refactor hard-coded URLs out of templates"*
10291062
[role="scratchpad"]
10301063
*****
10311064
* 'Remove hardcoded URLs from views.py'
1065+
* '[strikethrough line-through]#Remove the early return from the FT#'
10321066
* '[strikethrough line-through]#Remove hardcoded URL from forms in list.html and home.html#'
10331067
* 'Remove duplication of validation logic in views'
10341068
*****
@@ -1162,6 +1196,7 @@ Cross off our to-dos...
11621196
[role="scratchpad"]
11631197
*****
11641198
* '[strikethrough line-through]#Remove hardcoded URLs from views.py#'
1199+
* '[strikethrough line-through]#Remove the early return from the FT#'
11651200
* '[strikethrough line-through]#Remove hardcoded URL from forms in list.html and home.html#'
11661201
* 'Remove duplication of validation logic in views'
11671202
*****

0 commit comments

Comments
 (0)