Sha256: e69a3151befc81b38148f8dd7e5f8a588b15b86ffa0a0f1d95ba48ab67864ad0

Contents?: true

Size: 704 Bytes

Versions: 1

Compression:

Stored size: 704 Bytes

Contents

require 'helper'
require 'fakefs/safe'
require_relative '../extensions/fakefs'
require 'fileutils'

class TestDisplay < MiniTest::Test
  def setup
    FakeFS.activate!

    @io = fixture
    FileUtils.mkdir_p(File.dirname(@io))
    FileUtils.touch(@io)

    @display = I2C::Drivers::LCD::Display.new(@io, 0x42)
  end

  def teardown
    FakeFS.deactivate!
  end

  def test_clear
    @display.clear
    s = File.read(@io).unpack('B*')

    # Not sure why assert_equal chokes if FakeFs is still active
    FakeFS.deactivate!
    assert_equal('TBD', s)
  end

  def test_text_0
    @display.text('FOOBAR', 0)
    s = File.read(@io).unpack('B*')

    FakeFS.deactivate!
    assert_equal('TBD', s)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
i2c-lcd-0.0.4 test/unit/test_item.rb