Sha256: 18ffc6e3211999311735b9ab4ee65e157debecf437df115c29d4ee4191a25c5f
Contents?: true
Size: 1.28 KB
Versions: 5
Compression:
Stored size: 1.28 KB
Contents
require_relative 'test_helper' require_relative '../lib/wall_e/pin' require_relative '../lib/wall_e/components/led' class LedTest < MiniTest::Unit::TestCase def test_turning_on pin = MiniTest::Mock.new pin.expect(:set_mode, 1, [WallE::Pin::OUTPUT]) pin.expect(:digital_write, 1, [WallE::Pin::HIGH]) led = WallE::Led.new(pin) led.on assert led.on? pin.verify end def test_turning_off pin = MiniTest::Mock.new pin.expect(:set_mode, 1, [WallE::Pin::OUTPUT]) pin.expect(:digital_write, 1, [WallE::Pin::LOW]) led = WallE::Led.new(pin) led.off assert led.off? pin.verify end def test_toggle pin = MiniTest::Mock.new pin.expect(:set_mode, 1, [WallE::Pin::OUTPUT]) pin.expect(:digital_write, 1, [WallE::Pin::HIGH]) led = WallE::Led.new(pin) led.toggle assert led.on?, 'led not toggled on' pin.verify pin.expect(:set_mode, 1, [WallE::Pin::OUTPUT]) pin.expect(:digital_write, 1, [WallE::Pin::LOW]) led.toggle assert led.off?, 'led not toggled off' pin.verify end def test_brightness pin = MiniTest::Mock.new pin.expect(:set_mode, 1, [WallE::Pin::PWM]) pin.expect(:analog_write, 1, [255]) led = WallE::Led.new(pin) led.brightness(255) pin.verify end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
wall_e-0.1.0 | test/led_test.rb |
wall_e-0.0.4 | test/led_test.rb |
wall_e-0.0.3 | test/led_test.rb |
wall_e-0.0.2 | test/led_test.rb |
wall_e-0.0.1 | test/led_test.rb |