@@ -488,7 +488,7 @@ Describe 'Brackets and Braces' {
488488 iceberg.
489489 #>
490490
491- ' ____' | Should - Be [regex ]::Matches(' Bears Beat Bongos' , ' (B.+){3}' ).Value
491+ ' ____' | Should - Be ( [regex ]::Matches(' Bears Beat Bongos' , ' (B.+){3}' ).Value)
492492 }
493493
494494 It ' does not find just one badger' {
@@ -511,7 +511,7 @@ Describe 'Brackets and Braces' {
511511 The fancy regex name for this is a "character class".
512512 #>
513513
514- $____ | Should - Be ' End of the line' -match ' [efg]$'
514+ $____ | Should - Be ( ' End of the line' -match ' [efg]$' )
515515 }
516516
517517 It ' wants you to end the string a certain way' {
@@ -557,18 +557,16 @@ Describe 'Meditative Examples' {
557557 Validate a bunch of phone numbers - get rid of the non-numeric characters and check
558558 which ones are actually the right length to be dialed.
559559 #>
560+ BeforeAll {
561+ $phoneNumbers = @ (
562+ ' 1 425 555 1234'
563+ ' 1-425-555-4321'
564+ ' 1.425.555.6789'
565+ ' 01234'
566+ ' +14255556789'
567+ )
560568
561- $phoneNumbers = @ (
562- ' 1 425 555 1234'
563- ' 1-425-555-4321'
564- ' 1.425.555.6789'
565- ' 01234'
566- ' +14255556789'
567- )
568-
569- It ' sanitizes user input' {
570- $sanitizedNumbers = $phoneNumbers -replace ' ____'
571- $sanitizedNumbers | Should - Be @ (
569+ $sanitizedNumbers = @ (
572570 ' 14255551234'
573571 ' 14255554321'
574572 ' 14255556789'
@@ -577,7 +575,13 @@ Describe 'Meditative Examples' {
577575 )
578576 }
579577
580- It ' validates user input' { $validPhoneNumbers = [regex ]::Matches($sanitizedNumbers , ' ____' ).Value
578+ It ' sanitizes user input' {
579+
580+ $phoneNumbers -replace ' ____' | Should - Be $sanitizedNumbers
581+ }
582+
583+ It ' validates user input' {
584+ $validPhoneNumbers = [regex ]::Matches($sanitizedNumbers , ' ____' ).Value
581585 $validPhoneNumbers | Should - Be @ (
582586 ' 14255551234'
583587 ' 14255554321'
0 commit comments