Lesson test
This commit is contained in:
parent
6a2a00541c
commit
9df060a124
22
test/test_lesson.rb
Normal file
22
test/test_lesson.rb
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
require_relative "../lib/lesson"
|
||||||
|
require "minitest/autorun"
|
||||||
|
|
||||||
|
class TestLesson < Minitest::Test
|
||||||
|
def setup
|
||||||
|
@lesson = Lesson.new [[0.1 / 60, "test the thing"], [0.1 / 60, "finish testing"]]
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_start
|
||||||
|
@channel = Minitest::Mock.new
|
||||||
|
@channel.expect(:send_message, nil) { |msg| msg.include? "to test the thing" }
|
||||||
|
@channel.expect(:send_message, nil) { |msg| msg.include? "to finish testing" }
|
||||||
|
@channel.expect(:send_message, nil) { |msg| msg == "Lesson over!" }
|
||||||
|
assert_equal false, @lesson.running
|
||||||
|
@lesson.start!(@channel)
|
||||||
|
sleep(0.5)
|
||||||
|
# gonna be impossible to thread this needle
|
||||||
|
# assert_equal true, @lesson.running
|
||||||
|
sleep(0.5)
|
||||||
|
assert_equal false, @lesson.running
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user