test/console_test.rb in checkcheckit-0.4.0 vs test/console_test.rb in checkcheckit-0.5.0
- old
+ new
@@ -48,21 +48,21 @@
end
console.in_stream = MiniTest::Mock.new
console.out_stream = MiniTest::Mock.new
# console iteraction
- console.out_stream.expect :puts, true, ["|.| Step 1: just one command"]
+ console.out_stream.expect :puts, true, ["|.| Step 1: #{'just one command'.bold}"]
console.out_stream.expect :puts, true, [" `git pull`"]
- console.out_stream.expect :puts, true, ["\nRun command `git pull`?"]
+ console.out_stream.expect :puts, true, ["\nRun command `#{'git pull'.white}`?"]
console.out_stream.expect :print, true, ["<enter>,y,n: "]
console.in_stream.expect :gets, ""
- console.out_stream.expect :puts, true, ["running..."]
+ console.out_stream.expect :puts, true, ["running...".green]
mock(console).system("git pull") { true }
console.out_stream.expect :print, true, ["Check: "]
console.in_stream.expect :gets, ""
console.out_stream.expect :puts, true, [""]
- console.out_stream.expect :puts, true, ["|+| Done"]
+ console.out_stream.expect :puts, true, ["|#{'+'.green}| Done"]
#assert
check "start commands"
console.in_stream.verify
console.out_stream.verify
@@ -74,41 +74,44 @@
Examples.create_grocery_list(home)
console.in_stream = MiniTest::Mock.new
console.out_stream = MiniTest::Mock.new
#check 1
- console.out_stream.expect :puts, true, ["|...| Step 1: pineapple"]
+ console.out_stream.expect :puts, true, ["|...| Step 1: #{'pineapple'.bold}"]
console.out_stream.expect :print, true, ["Check: "]
console.in_stream.expect :gets, "n"
# notes 1
console.out_stream.expect :print, true, ["Notes: "]
console.in_stream.expect :gets, "Shit's fucked"
console.out_stream.expect :puts, true, ['']
#check 2
- console.out_stream.expect :puts, true, ["|-..| Step 2: mangoes"]
+ progress = '|' + '-'.red + '..|'
+ console.out_stream.expect :puts, true, ["#{progress} Step 2: #{'mangoes'.bold}"]
console.out_stream.expect :puts, true, [String]
console.out_stream.expect :print, true, ["Check: "]
console.in_stream.expect :gets, "y"
# notes 2
console.out_stream.expect :print, true, ["Notes: "]
console.in_stream.expect :gets, "Tasty"
console.out_stream.expect :puts, true, ['']
# NO FUDGE FOR YOU
- console.out_stream.expect :puts, true, ["|-+.| Step 3: fudge"]
+ progress = '|' + '-'.red + '+'.green + '.|'
+ console.out_stream.expect :puts, true, ["#{progress} Step 3: #{'fudge'.bold}"]
console.out_stream.expect :puts, true, [String]
console.out_stream.expect :print, true, ["Check: "]
console.in_stream.expect :gets, "n"
# notes 3
console.out_stream.expect :print, true, ["Notes: "]
console.in_stream.expect :gets, "Tasty"
console.out_stream.expect :puts, true, ['']
- console.out_stream.expect :puts, true, ['|-+-| Done']
+ progress = '|' + '-'.red + '+'.green + '-'.red + '|'
+ console.out_stream.expect :puts, true, ["#{progress} Done"]
check "start groceries --notes"
console.in_stream.verify
console.out_stream.verify
end