diff --git a/test/analog_io/input_test.rb b/test/analog_io/input_test.rb index e6efeba..afe5ff7 100644 --- a/test/analog_io/input_test.rb +++ b/test/analog_io/input_test.rb @@ -10,7 +10,7 @@ def part end def test__read - mock = MiniTest::Mock.new.expect :call, nil, [14, nil, nil, nil] + mock = Minitest::Mock.new.expect :call, nil, [14, nil, nil, nil] board.stub(:analog_read, mock) do part._read end @@ -18,7 +18,7 @@ def test__read end def test__listen - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect :call, nil, [14, 16] mock.expect :call, nil, [14, 32] board.stub(:analog_listen, mock) do @@ -29,7 +29,7 @@ def test__listen end def test__stop_listen - mock = MiniTest::Mock.new.expect :call, nil, [14] + mock = Minitest::Mock.new.expect :call, nil, [14] board.stub(:stop_listener, mock) do part._stop_listener end diff --git a/test/analog_io/output_test.rb b/test/analog_io/output_test.rb index 1b261d5..a3b2338 100644 --- a/test/analog_io/output_test.rb +++ b/test/analog_io/output_test.rb @@ -14,7 +14,7 @@ def test_mode_set end def test_dac_write - mock = MiniTest::Mock.new.expect :call, nil, [14, 128] + mock = Minitest::Mock.new.expect :call, nil, [14, 128] board.stub(:dac_write, mock) do part.write 128 diff --git a/test/analog_io/potentiometer_test.rb b/test/analog_io/potentiometer_test.rb index be3326d..09c13f9 100644 --- a/test/analog_io/potentiometer_test.rb +++ b/test/analog_io/potentiometer_test.rb @@ -1,6 +1,6 @@ require_relative '../test_helper' -class AnalogIOPotentiometerTest < MiniTest::Test +class AnalogIOPotentiometerTest < Minitest::Test def board @board ||= BoardMock.new end @@ -10,7 +10,7 @@ def part end def test_setup - mock = MiniTest::Mock.new.expect(:call, nil, [14,8]) + mock = Minitest::Mock.new.expect(:call, nil, [14,8]) board.stub(:analog_listen, mock) do part end diff --git a/test/behaviors/bus_peripheral_addressed.rb b/test/behaviors/bus_peripheral_addressed.rb index 293d937..f076711 100644 --- a/test/behaviors/bus_peripheral_addressed.rb +++ b/test/behaviors/bus_peripheral_addressed.rb @@ -33,7 +33,7 @@ def test_requires_address end def test_can_use_bus_atomically - mock = MiniTest::Mock.new + mock = Minitest::Mock.new 1.times {mock.expect(:call, nil)} bus.mutex.stub(:synchronize, mock) do diff --git a/test/behaviors/bus_peripheral_test.rb b/test/behaviors/bus_peripheral_test.rb index 9d3efca..4b5ced0 100644 --- a/test/behaviors/bus_peripheral_test.rb +++ b/test/behaviors/bus_peripheral_test.rb @@ -28,7 +28,7 @@ def test_initialize end def test_can_use_bus_atomically - mock = MiniTest::Mock.new + mock = Minitest::Mock.new 1.times {mock.expect(:call, nil)} bus.mutex.stub(:synchronize, mock) do diff --git a/test/behaviors/callbacks_test.rb b/test/behaviors/callbacks_test.rb index d3efc30..5a5d247 100644 --- a/test/behaviors/callbacks_test.rb +++ b/test/behaviors/callbacks_test.rb @@ -29,7 +29,7 @@ def part def test_callback_mutex callback = Proc.new{} - mock = MiniTest::Mock.new + mock = Minitest::Mock.new 3.times {mock.expect(:call, nil)} part.callback_mutex.stub(:synchronize, mock) do @@ -73,8 +73,8 @@ def test_remove_callback_with_key end def test_update_runs_callbacks_and_removes_read_callbacks - cb1 = MiniTest::Mock.new.expect :call, nil - cb2 = MiniTest::Mock.new.expect :call, nil + cb1 = Minitest::Mock.new.expect :call, nil + cb2 = Minitest::Mock.new.expect :call, nil part.add_callback { cb1.call } part.add_callback(:read) { cb2.call } part.update("data") @@ -84,7 +84,7 @@ def test_update_runs_callbacks_and_removes_read_callbacks end def test_pre_callback_filter_modifies_data - cb = MiniTest::Mock.new.expect :call, nil, ["denko: value"] + cb = Minitest::Mock.new.expect :call, nil, ["denko: value"] part.add_callback { |x| cb.call(x) } part.update("value") cb.verify diff --git a/test/behaviors/component_test.rb b/test/behaviors/component_test.rb index ff9a13f..74172d8 100644 --- a/test/behaviors/component_test.rb +++ b/test/behaviors/component_test.rb @@ -36,7 +36,7 @@ def test_sets_and_gets_state end def test_state_through_mutex - mock = MiniTest::Mock.new + mock = Minitest::Mock.new 2.times {mock.expect(:call, nil)} part.instance_variable_get(:@state_mutex).stub(:synchronize, mock) do @@ -47,7 +47,7 @@ def test_state_through_mutex end def test_micro_delay - mock = MiniTest::Mock.new.expect :call, nil, [1000] + mock = Minitest::Mock.new.expect :call, nil, [1000] board.stub(:micro_delay, mock) do part.micro_delay(1000) diff --git a/test/behaviors/listener_test.rb b/test/behaviors/listener_test.rb index 3b432ab..cb6c785 100644 --- a/test/behaviors/listener_test.rb +++ b/test/behaviors/listener_test.rb @@ -28,13 +28,13 @@ def test_divider_save_and_read end def test_call_stop_before_listening - mock = MiniTest::Mock.new.expect :call, nil + mock = Minitest::Mock.new.expect :call, nil part.stub(:stop, mock) { part.listen } mock.verify end def test_call__listen - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect :call, nil, [nil] mock.expect :call, nil, [32] part.stub(:_listen, mock) do @@ -45,7 +45,7 @@ def test_call__listen end def test_call__stop_listener - mock = MiniTest::Mock.new.expect :call, nil + mock = Minitest::Mock.new.expect :call, nil part.stub(:_stop_listener, mock) { part.stop } mock.verify end diff --git a/test/behaviors/poller_test.rb b/test/behaviors/poller_test.rb index 1ccca24..ebabf3d 100644 --- a/test/behaviors/poller_test.rb +++ b/test/behaviors/poller_test.rb @@ -37,13 +37,13 @@ def test_include_callbacks_and_threaded end def test_call_stop_before_polling - mock = MiniTest::Mock.new.expect :call, nil + mock = Minitest::Mock.new.expect :call, nil part.stub(:stop, mock) { part.poll(1) } mock.verify end def test_uses_threaded_loop - mock = MiniTest::Mock.new.expect :call, nil + mock = Minitest::Mock.new.expect :call, nil part.stub(:threaded_loop, mock) { part.poll(1) } mock.verify end @@ -57,7 +57,7 @@ def test_add_and_remove_callback end def test_stop_kills_thread - mock = MiniTest::Mock.new.expect :call, nil + mock = Minitest::Mock.new.expect :call, nil part.stub(:stop_thread, mock) { part.stop } mock.verify end diff --git a/test/behaviors/reader_test.rb b/test/behaviors/reader_test.rb index 24d87fd..9c3e2fa 100644 --- a/test/behaviors/reader_test.rb +++ b/test/behaviors/reader_test.rb @@ -37,7 +37,7 @@ def test_include_callbacks end def test_read_once - mock = MiniTest::Mock.new.expect :call, nil + mock = Minitest::Mock.new.expect :call, nil inject(1) part.stub(:_read, mock) do @@ -53,20 +53,20 @@ def test_return_value def test_read_using_with_lambda inject(1) - reader = MiniTest::Mock.new.expect :call, nil + reader = Minitest::Mock.new.expect :call, nil part.read_using -> { reader.call } reader.verify end def test_read_using_with_method_and_args inject(1) - reader = MiniTest::Mock.new.expect :call, nil, [10, 20], test_arg: 2 + reader = Minitest::Mock.new.expect :call, nil, [10, 20], test_arg: 2 part.read_using reader, 10, 20, test_arg: 2 reader.verify end def test_add_run_remove_callback - cb = MiniTest::Mock.new.expect :call, nil + cb = Minitest::Mock.new.expect :call, nil inject(1) part.read { cb.call } assert_nil part.callbacks[:read] diff --git a/test/behaviors/subcomponents_test.rb b/test/behaviors/subcomponents_test.rb index 3a7b9fd..3d981ce 100644 --- a/test/behaviors/subcomponents_test.rb +++ b/test/behaviors/subcomponents_test.rb @@ -65,7 +65,7 @@ def test_calls_stop_on_remove pinless = PinlessComponentMock.new board.add_component(pinless) - mock = MiniTest::Mock.new.expect(:call, nil) + mock = Minitest::Mock.new.expect(:call, nil) pinless.stub(:stop, mock) do board.remove_component(pinless) end diff --git a/test/behaviors/threaded_test.rb b/test/behaviors/threaded_test.rb index a1c71b2..e9dc57e 100644 --- a/test/behaviors/threaded_test.rb +++ b/test/behaviors/threaded_test.rb @@ -24,19 +24,19 @@ def test_add_interrupts_using_interrupt_with end def test_threaded_stops_threads - mock = MiniTest::Mock.new.expect :call, nil + mock = Minitest::Mock.new.expect :call, nil part.stub(:stop_thread, mock) { part.threaded {} } mock.verify end def test_threaded_enables_interrupts - mock = MiniTest::Mock.new.expect :call, nil + mock = Minitest::Mock.new.expect :call, nil part.stub(:enable_interrupts, mock) { part.threaded {} } mock.verify end def test_threaded_calls_block_given - mock = MiniTest::Mock.new.expect :call, nil + mock = Minitest::Mock.new.expect :call, nil part.threaded { mock.call } sleep 0.1 # Should find a better way to do this. mock.verify @@ -49,7 +49,7 @@ def test_thread_stored_in_instance_variable end def test_threaded_loop_calls_block_repeatedly - mock = MiniTest::Mock.new.expect(:call, nil).expect(:call, nil) + mock = Minitest::Mock.new.expect(:call, nil).expect(:call, nil) part.stub(:foo, mock) do part.threaded_loop do part.foo @@ -61,7 +61,7 @@ def test_threaded_loop_calls_block_repeatedly end def test_stop_thread_kills_thread - mock = MiniTest::Mock.new.expect(:kill, nil) + mock = Minitest::Mock.new.expect(:kill, nil) part.instance_variable_set(:@thread, mock) part.stop_thread mock.verify @@ -81,7 +81,7 @@ def test_interrupts_override_singleton_only end def test_original_method_called_when_interrupts_enabled - mock = MiniTest::Mock.new.expect(:call, nil, ["denko"]) + mock = Minitest::Mock.new.expect(:call, nil, ["denko"]) part.stub(:foo, mock) do part.enable_interrupts part.foo("denko") @@ -91,7 +91,7 @@ def test_original_method_called_when_interrupts_enabled def test_interrupt_stops_thread part.enable_interrupts - mock = MiniTest::Mock.new.expect :call, nil + mock = Minitest::Mock.new.expect :call, nil part.stub(:stop_thread, mock) { part. foo } mock.verify end diff --git a/test/board/board_test.rb b/test/board/board_test.rb index a5b470c..97d9a31 100644 --- a/test/board/board_test.rb +++ b/test/board/board_test.rb @@ -15,7 +15,7 @@ def test_require_a_connection_object def test_starts_observing_connection io = ConnectionMock.new - mock = MiniTest::Mock.new.expect(:call, nil, [Denko::Board]) + mock = Minitest::Mock.new.expect(:call, nil, [Denko::Board]) io.stub(:add_observer, mock) do Denko::Board.new(io) end @@ -23,7 +23,7 @@ def test_starts_observing_connection end def test_calls_handshake_on_connection - mock = MiniTest::Mock.new.expect(:call, Constants::ACK) + mock = Minitest::Mock.new.expect(:call, Constants::ACK) connection.stub(:handshake, mock) do Denko::Board.new(connection) end @@ -49,7 +49,7 @@ def test_analog_resolution assert_equal 1023, board.analog_read_high assert_equal 10, board.analog_read_resolution - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect(:call, nil, [Denko::Message.encode(command:96, value:12)]) mock.expect(:call, nil, [Denko::Message.encode(command:97, value:12)]) board.stub(:write, mock) do @@ -66,7 +66,7 @@ def test_analog_resolution end def test_eeprom - mock = MiniTest::Mock.new.expect(:call, "test eeprom", [], board: board) + mock = Minitest::Mock.new.expect(:call, "test eeprom", [], board: board) Denko::EEPROM::BuiltIn.stub(:new, mock) do board.eeprom end @@ -75,7 +75,7 @@ def test_eeprom def test_write board - mock = MiniTest::Mock.new.expect(:call, nil, ["message"]) + mock = Minitest::Mock.new.expect(:call, nil, ["message"]) connection.stub(:write, mock) do board.write("message") end @@ -83,16 +83,16 @@ def test_write end def test_update_passes_messages_to_correct_components - mock1 = MiniTest::Mock.new.expect(:update, nil, ["data"]) + mock1 = Minitest::Mock.new.expect(:update, nil, ["data"]) 3.times { mock1.expect(:pin, 1) } # Make sure lines are split only on the first colon. # Tests for string based pine names too. - mock2 = MiniTest::Mock.new.expect(:update, nil, ["with:colon"]) + mock2 = Minitest::Mock.new.expect(:update, nil, ["with:colon"]) 3.times { mock2.expect(:pin, 14) } # Special EEPROM mock. - mock3 = MiniTest::Mock.new.expect(:update, nil, ["bytes"]) + mock3 = Minitest::Mock.new.expect(:update, nil, ["bytes"]) 3.times { mock3.expect(:pin, 254) } board.add_component(mock1) diff --git a/test/board/core_test.rb b/test/board/core_test.rb index fef0ea3..427084c 100644 --- a/test/board/core_test.rb +++ b/test/board/core_test.rb @@ -12,7 +12,7 @@ def board end def test_set_pin_mode - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect(:call, nil, [Denko::Message.encode(command: 0, pin: 1, value: 0b000)]) mock.expect(:call, nil, [Denko::Message.encode(command: 0, pin: 1, value: 0b010)]) mock.expect(:call, nil, [Denko::Message.encode(command: 0, pin: 1, value: 0b100)]) @@ -36,7 +36,7 @@ def test_set_pin_mode end def test_digital_write - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect(:call, nil, [Denko::Message.encode(command: 1, pin: 1, value: board.low)]) mock.expect(:call, nil, [Denko::Message.encode(command: 1, pin: 1, value: board.high)]) @@ -50,7 +50,7 @@ def test_digital_write end def test_digital_read - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect(:call, nil, [Denko::Message.encode(command: 2, pin: 1)]) board.stub(:write, mock) do @@ -60,7 +60,7 @@ def test_digital_read end def test_pwm_write - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect(:call, nil, [Denko::Message.encode(command: 3, pin: 1, value: board.low)]) mock.expect(:call, nil, [Denko::Message.encode(command: 3, pin: 1, value: board.pwm_high)]) mock.expect(:call, nil, [Denko::Message.encode(command: 3, pin: 1, value: 128)]) @@ -76,7 +76,7 @@ def test_pwm_write end def test_dac_write - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect(:call, nil, [Denko::Message.encode(command: 4, pin: 1, value: board.low)]) mock.expect(:call, nil, [Denko::Message.encode(command: 4, pin: 1, value: board.dac_high)]) mock.expect(:call, nil, [Denko::Message.encode(command: 4, pin: 1, value: 128)]) @@ -92,7 +92,7 @@ def test_dac_write end def test_analog_read - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect(:call, nil, [Denko::Message.encode(command: 5, pin: 1)]) board.stub(:write, mock) do @@ -102,7 +102,7 @@ def test_analog_read end def test_set_listener - mock = MiniTest::Mock.new + mock = Minitest::Mock.new # \x00\x02 corresponds to the default digital divider of 4 (2^2). # \x00\x04 corresponds to the default analog divider of 16 (2^4). @@ -124,7 +124,7 @@ def test_set_listener end def test_digital_listen - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect(:call, nil, [1, :on], mode: :digital, divider: 4) board.stub(:set_listener, mock) do @@ -133,7 +133,7 @@ def test_digital_listen end def test_analog_listen - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect(:call, nil, [1, :on], mode: :analog, divider: 16) board.stub(:set_listener, mock) do @@ -142,7 +142,7 @@ def test_analog_listen end def test_stop_listener - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect(:call, nil, [1, :off]) board.stub(:set_listener, mock) do @@ -151,7 +151,7 @@ def test_stop_listener end def test_analog_resolution - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect(:call, nil, [Denko::Message.encode(command: 96, value: 10)]) mock.expect(:call, nil, [Denko::Message.encode(command: 97, value: 10)]) @@ -170,7 +170,7 @@ def test_analog_resolution def micro_delay aux = pack(:uint16, [1000]) message = Denko::Message.encode command: 99, aux_message: aux - mock = MiniTest::Mock.new.expect :call, nil, [message] + mock = Minitest::Mock.new.expect :call, nil, [message] board.stub(:write, mock) do board.micro_delay(1000) diff --git a/test/board/eeprom_test.rb b/test/board/eeprom_test.rb index 78f0cdb..0999ce7 100644 --- a/test/board/eeprom_test.rb +++ b/test/board/eeprom_test.rb @@ -12,7 +12,7 @@ def board end def test_eeprom_read - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect :call, nil, [(Denko::Message.encode command: 7, value: 16, aux_message: pack(:uint16, 15))] board.stub(:write, mock) do @@ -23,7 +23,7 @@ def test_eeprom_read def test_eeprom_write data = (1..16).to_a - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect :call, nil, [(Denko::Message.encode command: 8, value: data.length, aux_message: pack(:uint16, 15) + pack(:uint8, data))] board.stub(:write, mock) do diff --git a/test/board/i2c_test.rb b/test/board/i2c_test.rb index 92b8153..e2f622a 100644 --- a/test/board/i2c_test.rb +++ b/test/board/i2c_test.rb @@ -15,7 +15,7 @@ def test_search board message = Denko::Message.encode command: 33 - mock = MiniTest::Mock.new.expect :call, nil, [message] + mock = Minitest::Mock.new.expect :call, nil, [message] connection.stub(:write, mock) do board.i2c_search end @@ -32,7 +32,7 @@ def test_write # Repeated start message2 = Denko::Message.encode command: 34, pin: address | (0 << 7), value: 4, aux_message: aux - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect :call, nil, [message1] mock.expect :call, nil, [message2] @@ -56,7 +56,7 @@ def test_read # Repeated start message2 = Denko::Message.encode command: 35, pin: 0x30 | (0 << 7), value: 4, aux_message: aux - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect :call, nil, [message1] mock.expect :call, nil, [message2] @@ -72,7 +72,7 @@ def test_read_without_register aux = pack(:uint8, 0x00) + pack(:uint8, [0]) message = Denko::Message.encode command: 35, pin: 0x30 | (1 << 7), value: 4, aux_message: aux - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect :call, nil, [message] connection.stub(:write, mock) do @@ -97,7 +97,7 @@ def test_frequencies messages << Denko::Message.encode(command: 34, pin: 0x30 | (1 << 7), value: 4, aux_message: pack(:uint8, code) + pack(:uint8, data)) end - mock = MiniTest::Mock.new + mock = Minitest::Mock.new messages.each do |message| mock.expect :call, nil, [message] end diff --git a/test/board/infrared_test.rb b/test/board/infrared_test.rb index d26a40d..fe5b642 100644 --- a/test/board/infrared_test.rb +++ b/test/board/infrared_test.rb @@ -16,7 +16,7 @@ def test_infrared_emit aux = pack(:uint8, 4) + pack(:uint16, [255,0,255,0]) message = Denko::Message.encode command: 16, pin: 8, value: 38, aux_message: aux - mock = MiniTest::Mock.new.expect :call, nil, [message] + mock = Minitest::Mock.new.expect :call, nil, [message] connection.stub(:write, mock) do board.infrared_emit 8, 38, [255,0,255,0] end diff --git a/test/board/one_wire_test.rb b/test/board/one_wire_test.rb index 1fd6109..708d1bb 100644 --- a/test/board/one_wire_test.rb +++ b/test/board/one_wire_test.rb @@ -15,7 +15,7 @@ def test_one_wire_reset board message = Denko::Message.encode command: 41, pin: 1, value: 255 - mock = MiniTest::Mock.new.expect :call, nil, [message] + mock = Minitest::Mock.new.expect :call, nil, [message] connection.stub(:write, mock) do board.one_wire_reset(1, 255) end @@ -26,7 +26,7 @@ def test_one_wire_search board message = Denko::Message.encode command: 42, pin: 1, aux_message: pack(:uint64, 128, max:8) - mock = MiniTest::Mock.new.expect :call, nil, [message] + mock = Minitest::Mock.new.expect :call, nil, [message] connection.stub(:write, mock) do board.one_wire_search(1, 128) end @@ -40,7 +40,7 @@ def test_one_wire_write message1 = Denko::Message.encode command: 43, pin: 1, value: 0b10000000 | 3, aux_message: pack(:uint8, [1,2,3]) message2 = Denko::Message.encode command: 43, pin: 1, value: 4, aux_message: pack(:uint8, [1,2,3,4]) - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect :call, nil, [message1] mock.expect :call, nil, [message2] connection.stub(:write, mock) do @@ -60,7 +60,7 @@ def test_one_wire_read board message = Denko::Message.encode command: 44, pin: 1, value: 9 - mock = MiniTest::Mock.new.expect :call, nil, [message] + mock = Minitest::Mock.new.expect :call, nil, [message] connection.stub(:write, mock) do board.one_wire_read(1, 9) end diff --git a/test/board/pulse_test.rb b/test/board/pulse_test.rb index 78eb50b..02c3f77 100644 --- a/test/board/pulse_test.rb +++ b/test/board/pulse_test.rb @@ -13,7 +13,7 @@ def board def test_pulse_read # Default settings - mock = MiniTest::Mock.new + mock = Minitest::Mock.new aux = pack(:uint16, [0, 200]) << pack(:uint8, 100) message = Denko::Message.encode command: 9, pin: 4, value: 0b00, aux_message: aux @@ -24,7 +24,7 @@ def test_pulse_read mock.verify # Good options - mock = MiniTest::Mock.new + mock = Minitest::Mock.new aux = pack(:uint16, [1000, 200]) << pack(:uint8, 160) message1 = Denko::Message.encode command: 9, pin: 4, value: 0b01, aux_message: aux message2 = Denko::Message.encode command: 9, pin: 4, value: 0b11, aux_message: aux diff --git a/test/board/servo_test.rb b/test/board/servo_test.rb index ddc9ba3..f6008c4 100644 --- a/test/board/servo_test.rb +++ b/test/board/servo_test.rb @@ -12,7 +12,7 @@ def board end def test_on_off - mock = MiniTest::Mock.new + mock = Minitest::Mock.new aux = pack :uint16, [544, 2400] mock.expect :call, nil, [Denko::Message.encode(command: 10, pin: 9, value: 1, aux_message: aux)] mock.expect :call, nil, [Denko::Message.encode(command: 10, pin: 9, value: 0, aux_message: aux)] @@ -25,7 +25,7 @@ def test_on_off end def test_min_max - mock = MiniTest::Mock.new + mock = Minitest::Mock.new aux = pack :uint16, [360, 2100] mock.expect :call, nil, [Denko::Message.encode(command: 10, pin: 9, value: 1, aux_message: aux)] @@ -36,7 +36,7 @@ def test_min_max end def test_write - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect :call, nil, [Denko::Message.encode(command: 11, pin: 9, aux_message: pack(:uint16, 180))] board.stub(:write, mock) do diff --git a/test/board/spi_test.rb b/test/board/spi_test.rb index 7aa36e0..0d484fc 100644 --- a/test/board/spi_test.rb +++ b/test/board/spi_test.rb @@ -64,7 +64,7 @@ def test_spi_transfer bytes = [1,2,3,4] header = board.spi_header(bytes, 4, 8000000, 2, :lsbfirst) aux = header + pack(:uint8, bytes) - mock = MiniTest::Mock.new.expect :call, nil, + mock = Minitest::Mock.new.expect :call, nil, [Denko::Message.encode(command: 26, pin: 3, aux_message: aux)] board.stub(:write, mock) do @@ -77,7 +77,7 @@ def test_spi_transfer def test_spi_listen board header = board.spi_header([], 8, 1000000, 0, :lsbfirst) - mock = MiniTest::Mock.new.expect :call, nil, + mock = Minitest::Mock.new.expect :call, nil, [Denko::Message.encode(command: 27, pin: 3, aux_message: header)] board.stub(:write, mock) do @@ -88,7 +88,7 @@ def test_spi_listen def test_spi_stop board - mock = MiniTest::Mock.new.expect :call, nil, [Denko::Message.encode(command: 28, pin: 3)] + mock = Minitest::Mock.new.expect :call, nil, [Denko::Message.encode(command: 28, pin: 3)] board.stub(:write, mock) do board.spi_stop(3) end diff --git a/test/board/tone_test.rb b/test/board/tone_test.rb index d8a260e..91da21a 100644 --- a/test/board/tone_test.rb +++ b/test/board/tone_test.rb @@ -12,7 +12,7 @@ def board end def test_tone - mock = MiniTest::Mock.new + mock = Minitest::Mock.new aux1 = pack(:uint16, 150) + pack(:uint16, 2000) aux2 = pack(:uint16, 300) @@ -31,7 +31,7 @@ def test_tone_prevents_low_frequencies end def test_no_tone - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect :call, nil, [Denko::Message.encode(command: 18, pin: 10)] board.stub(:write, mock) do diff --git a/test/connection/serial_test.rb b/test/connection/serial_test.rb index ab7b3fc..6ea8883 100644 --- a/test/connection/serial_test.rb +++ b/test/connection/serial_test.rb @@ -18,7 +18,7 @@ def io end def test_connect_with_device_specified - mock = MiniTest::Mock.new.expect(:call, "SerialMock", ["/dev/ttyACM0", 9600]) + mock = Minitest::Mock.new.expect(:call, "SerialMock", ["/dev/ttyACM0", 9600]) ::Serial.stub(:new, mock) do connection = Denko::Connection::Serial.new(device: "/dev/ttyACM0", baud: 9600) assert_equal "SerialMock", suppress_output { connection.send(:io) } @@ -34,7 +34,7 @@ def test_connect_with_no_devices def test_connect_on_unix connection.stub(:tty_devices, ['/dev/ttyACM0', '/dev/tty.usbmodem1']) do - mock = MiniTest::Mock.new + mock = Minitest::Mock.new # Raise error for first device mock.expect(:call, nil) { raise RubySerial::Error } mock.expect :call, "serial-obj", ['/dev/tty.usbmodem1', Denko::Connection::Serial::BAUD] @@ -50,7 +50,7 @@ def test_connect_on_windows # Simulate being on Windows Constants.redefine(:RUBY_PLATFORM, "mswin", :on => Object) - mock = MiniTest::Mock.new + mock = Minitest::Mock.new # Raise error for COM1 mock.expect(:call, nil) { raise RubySerial::Error } mock.expect :call, "serial-obj", ["COM2", Denko::Connection::Serial::BAUD] @@ -65,11 +65,11 @@ def test_connect_on_windows end def test_io_reset - flush_mock = MiniTest::Mock.new.expect :call, true - r_stop_mock = MiniTest::Mock.new.expect :call, true - r_start_mock = MiniTest::Mock.new.expect :call, true - w_stop_mock = MiniTest::Mock.new.expect :call, true - w_start_mock = MiniTest::Mock.new.expect :call, true + flush_mock = Minitest::Mock.new.expect :call, true + r_stop_mock = Minitest::Mock.new.expect :call, true + r_start_mock = Minitest::Mock.new.expect :call, true + w_stop_mock = Minitest::Mock.new.expect :call, true + w_start_mock = Minitest::Mock.new.expect :call, true connection.stub(:flush_read, flush_mock) do connection.stub(:stop_read, r_stop_mock) do @@ -98,7 +98,7 @@ def test_read end def test_parse - mock = MiniTest::Mock.new.expect :call, nil, ['02:00:00'] + mock = Minitest::Mock.new.expect :call, nil, ['02:00:00'] connection.stub(:changed, true) do connection.stub(:notify_observers, mock) do connection.send(:parse, '02:00:00') @@ -132,7 +132,7 @@ def test_write_thread_removes_from_buffer connection.write('message') # Message is written from buffer when we start the write thread. - mock = MiniTest::Mock.new.expect :call, nil, ['message'] + mock = Minitest::Mock.new.expect :call, nil, ['message'] connection.stub(:_write, mock) do # Start the write thread and wait for the buffer to empty. connection.send(:start_write) @@ -144,7 +144,7 @@ def test_write_thread_removes_from_buffer end def test_io_read_single_chars_until_newline_and_strips_it - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect :read, "line\n", [64] connection.stub(:io, mock) do assert_equal "line", connection.send(:read) @@ -153,7 +153,7 @@ def test_io_read_single_chars_until_newline_and_strips_it end def test_io_read_handles_escaped_newlines_and_backslashes - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect :read, "l1\\\nl2\\\\\n", [64] connection.stub(:io, mock) do assert_equal "l1\nl2\\", connection.send(:read) @@ -162,7 +162,7 @@ def test_io_read_handles_escaped_newlines_and_backslashes end def test_io_read_returns_empty_string_if_just_newline - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect :read, "\n", [64] connection.stub(:io, mock) do assert_equal "", connection.send(:read) diff --git a/test/digital_io/input_test.rb b/test/digital_io/input_test.rb index 5c7807f..934e8e9 100644 --- a/test/digital_io/input_test.rb +++ b/test/digital_io/input_test.rb @@ -10,7 +10,7 @@ def part end def test_start_listening_immediately - mock = MiniTest::Mock.new.expect :call, nil, [14, 4] + mock = Minitest::Mock.new.expect :call, nil, [14, 4] board.stub(:digital_listen, mock) do part end @@ -24,7 +24,7 @@ def test_converts_to_integer end def test__read - mock = MiniTest::Mock.new.expect :call, nil, [14] + mock = Minitest::Mock.new.expect :call, nil, [14] board.stub(:digital_read, mock) do part._read end @@ -33,7 +33,7 @@ def test__read def test__listen part - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect :call, nil, [14, 4] mock.expect :call, nil, [14, 32] board.stub(:digital_listen, mock) do @@ -44,8 +44,8 @@ def test__listen end def test_on_low - low_cb = MiniTest::Mock.new.expect :call, nil - high_cb = MiniTest::Mock.new + low_cb = Minitest::Mock.new.expect :call, nil + high_cb = Minitest::Mock.new part.on_low { low_cb.call } part.on_high { high_cb.call } part.update(board.low) @@ -54,8 +54,8 @@ def test_on_low end def test_on_high - low_cb = MiniTest::Mock.new - high_cb = MiniTest::Mock.new.expect :call, nil + low_cb = Minitest::Mock.new + high_cb = Minitest::Mock.new.expect :call, nil part.on_low { low_cb.call } part.on_high { high_cb.call } part.update(board.high) diff --git a/test/digital_io/output_test.rb b/test/digital_io/output_test.rb index 355ed08..08776f0 100644 --- a/test/digital_io/output_test.rb +++ b/test/digital_io/output_test.rb @@ -10,7 +10,7 @@ def part end def test_read_state_on_initialize - mock = MiniTest::Mock.new.expect :call, nil, [14] + mock = Minitest::Mock.new.expect :call, nil, [14] board.stub(:digital_read, mock) do part end @@ -19,7 +19,7 @@ def test_read_state_on_initialize def test_digital_write part - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect :call, nil, [14, board.high] mock.expect :call, nil, [14, board.low] mock.expect :call, nil, [14, board.low] @@ -36,7 +36,7 @@ def test_digital_write def test_high_and_low part - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect :call, nil, [board.high] mock.expect :call, nil, [board.low] part.stub(:digital_write, mock) do @@ -48,14 +48,14 @@ def test_high_and_low def test_toggle part.low - mock = MiniTest::Mock.new.expect :call, nil + mock = Minitest::Mock.new.expect :call, nil part.stub(:high, mock) do part.toggle end mock.verify part.high - mock = MiniTest::Mock.new.expect :call, nil + mock = Minitest::Mock.new.expect :call, nil part.stub(:low, mock) do part.toggle end diff --git a/test/digital_io/rotary_encoder_test.rb b/test/digital_io/rotary_encoder_test.rb index 29cf966..af6951b 100644 --- a/test/digital_io/rotary_encoder_test.rb +++ b/test/digital_io/rotary_encoder_test.rb @@ -1,6 +1,6 @@ require_relative '../test_helper' -class RotaryEncoderTest < MiniTest::Test +class RotaryEncoderTest < Minitest::Test def board @board ||= BoardMock.new end @@ -19,9 +19,9 @@ def test_resets_on_initialize end def test_calls_listen_on_both_pins_with_given_divider - clock_mock = MiniTest::Mock.new.expect(:call, nil, [1]) + clock_mock = Minitest::Mock.new.expect(:call, nil, [1]) clock_mock.expect(:call, nil, [2]) - data_mock = MiniTest::Mock.new.expect(:call, nil, [1]) + data_mock = Minitest::Mock.new.expect(:call, nil, [1]) data_mock.expect(:call, nil, [2]) part.clock.stub(:listen, clock_mock) do @@ -33,7 +33,7 @@ def test_calls_listen_on_both_pins_with_given_divider end def test_observes_on_initialize - mock = MiniTest::Mock.new.expect(:call, nil) + mock = Minitest::Mock.new.expect(:call, nil) part.stub(:observe_pins, mock) do part.send(:after_initialize) end diff --git a/test/display/hd44780_test.rb b/test/display/hd44780_test.rb index a1390b8..ef30ce7 100644 --- a/test/display/hd44780_test.rb +++ b/test/display/hd44780_test.rb @@ -1,6 +1,6 @@ require_relative '../test_helper' -class HD44780Test < MiniTest::Test +class HD44780Test < Minitest::Test def board @board ||= BoardMock.new end diff --git a/test/eeprom/built_in_test.rb b/test/eeprom/built_in_test.rb index ec2bc85..515c8e7 100644 --- a/test/eeprom/built_in_test.rb +++ b/test/eeprom/built_in_test.rb @@ -37,7 +37,7 @@ def test_loads_on_initialize_and_updates_correctly end def test_delegates_to_state_array - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect(:[], 255, [0]) mock.expect(:[]=, 128, [1, 128]) mock.expect(:each, nil) diff --git a/test/i2c/bus_test.rb b/test/i2c/bus_test.rb index 438bfb3..68788b2 100644 --- a/test/i2c/bus_test.rb +++ b/test/i2c/bus_test.rb @@ -4,7 +4,7 @@ class I2CPeripheralBase include Denko::I2C::Peripheral end -class I2CBusTest < MiniTest::Test +class I2CBusTest < Minitest::Test def board @board ||= BoardMock.new end @@ -27,7 +27,7 @@ def test_initialize def test_search board.inject_read_for_pin(5, "48:50") - mock = MiniTest::Mock.new.expect :call, nil + mock = Minitest::Mock.new.expect :call, nil board.stub(:i2c_search, mock) do part.search end @@ -37,7 +37,7 @@ def test_search end def test_write - mock = MiniTest::Mock.new.expect :call, nil, [0x30, [0x01, 0x02], 100000, false] + mock = Minitest::Mock.new.expect :call, nil, [0x30, [0x01, 0x02], 100000, false] board.stub(:i2c_write, mock) do part.write 0x30, [0x01, 0x02] end @@ -47,7 +47,7 @@ def test_write def test__read board.inject_read_for_pin(5, "48-255,0,255,0,255,0") - mock = MiniTest::Mock.new.expect :call, nil, [0x32, 0x03, 6, 100000, false] + mock = Minitest::Mock.new.expect :call, nil, [0x32, 0x03, 6, 100000, false] board.stub(:i2c_read, mock) do part.read 0x32, 0x03, 6 end @@ -55,7 +55,7 @@ def test__read end def test_updates_peripherals - mock = MiniTest::Mock.new.expect :call, nil, [[255, 127]] + mock = Minitest::Mock.new.expect :call, nil, [[255, 127]] peripheral.stub(:update, mock) do part.send(:update, "48-255,127") diff --git a/test/i2c/peripheral_test.rb b/test/i2c/peripheral_test.rb index 1e98266..4dc2650 100644 --- a/test/i2c/peripheral_test.rb +++ b/test/i2c/peripheral_test.rb @@ -4,7 +4,7 @@ class I2CPeripheralBase include Denko::I2C::Peripheral end -class I2CPeripheralTest < MiniTest::Test +class I2CPeripheralTest < Minitest::Test def board @board ||= BoardMock.new end @@ -22,7 +22,7 @@ def part def test_write_and_repeated_start part.i2c_repeated_start = true - mock = MiniTest::Mock.new.expect :call, nil, [0x30, [1,2], 100000, true] + mock = Minitest::Mock.new.expect :call, nil, [0x30, [1,2], 100000, true] bus.stub(:write, mock) do part.i2c_write [1,2] end @@ -31,7 +31,7 @@ def test_write_and_repeated_start def test_frequency part.i2c_frequency = 400000 - mock = MiniTest::Mock.new.expect :call, nil, [0x30, [1,2], 400000, false] + mock = Minitest::Mock.new.expect :call, nil, [0x30, [1,2], 400000, false] bus.stub(:write, mock) do part.i2c_write [1,2] end @@ -42,7 +42,7 @@ def test__read_and_repeated_start board.inject_read_for_component(part, 5, "48-127,127,127,127,127,127") - mock = MiniTest::Mock.new.expect :call, nil, [0x30, 0x03, 6, 100000, true] + mock = Minitest::Mock.new.expect :call, nil, [0x30, 0x03, 6, 100000, true] bus.stub(:read, mock) do part.i2c_read(0x03, 6) end diff --git a/test/led/base_test.rb b/test/led/base_test.rb index fbde9f1..fefa988 100644 --- a/test/led/base_test.rb +++ b/test/led/base_test.rb @@ -1,6 +1,6 @@ require_relative '../test_helper' -class BaseLEDTest < MiniTest::Test +class BaseLEDTest < Minitest::Test def board @board ||= BoardMock.new end @@ -15,7 +15,7 @@ def test_led_new_creates_base_led end def test_blink_runs_in_thread - mock = MiniTest::Mock.new.expect :call, nil + mock = Minitest::Mock.new.expect :call, nil part.stub(:threaded_loop, mock) do part.blink(0.5) end diff --git a/test/led/rgb_test.rb b/test/led/rgb_test.rb index e042dfc..c118c5b 100644 --- a/test/led/rgb_test.rb +++ b/test/led/rgb_test.rb @@ -1,6 +1,6 @@ require_relative '../test_helper' -class RGBLEDTest < MiniTest::Test +class RGBLEDTest < Minitest::Test def board @board ||= BoardMock.new end @@ -20,9 +20,9 @@ def test_proxies end def test_write - red_mock = MiniTest::Mock.new.expect :write, nil, [0] - green_mock = MiniTest::Mock.new.expect :write, nil, [128] - blue_mock = MiniTest::Mock.new.expect :write, nil, [0] + red_mock = Minitest::Mock.new.expect :write, nil, [0] + green_mock = Minitest::Mock.new.expect :write, nil, [128] + blue_mock = Minitest::Mock.new.expect :write, nil, [0] part.stub(:red, red_mock) do part.stub(:green, green_mock) do @@ -37,7 +37,7 @@ def test_write end def test_color_array - mock = MiniTest::Mock.new.expect :call, nil, [[128,0,0]] + mock = Minitest::Mock.new.expect :call, nil, [[128,0,0]] part.stub(:write, mock) do part.color = [128,0,0] end @@ -47,7 +47,7 @@ def test_color_array def test_color_names colors = Denko::LED::RGB::COLORS - mock = MiniTest::Mock.new + mock = Minitest::Mock.new colors.each_value do |color| mock.expect :call, nil, [color] mock.expect :call, nil, [color] diff --git a/test/led/seven_segment_test.rb b/test/led/seven_segment_test.rb index 85518de..a461457 100644 --- a/test/led/seven_segment_test.rb +++ b/test/led/seven_segment_test.rb @@ -1,6 +1,6 @@ require_relative '../test_helper' -class SevenSegmentLEDTest < MiniTest::Test +class SevenSegmentLEDTest < Minitest::Test def board @board ||= BoardMock.new end @@ -25,7 +25,7 @@ def test_clears_during_initialize # Avoid reusing pins which would raise a Board error. def part.initialize_pins(options={}); end - mock = MiniTest::Mock.new.expect :call, nil + mock = Minitest::Mock.new.expect :call, nil part.stub(:clear, mock) do part.send(:initialize, options) end @@ -36,7 +36,7 @@ def test_turns_on_during_initialize # Avoid reusing pins which would raise a Board error. def part.initialize_pins(options={}); end - mock = MiniTest::Mock.new.expect :call, nil + mock = Minitest::Mock.new.expect :call, nil part.stub(:on, mock) do part.send(:initialize, options) end @@ -44,7 +44,7 @@ def part.initialize_pins(options={}); end end def test_on - mock = MiniTest::Mock.new.expect :high, nil + mock = Minitest::Mock.new.expect :high, nil part.stub(:anode, mock) do part.on end @@ -52,7 +52,7 @@ def test_on end def test_off - mock = MiniTest::Mock.new.expect :low, nil + mock = Minitest::Mock.new.expect :low, nil part.stub(:anode, mock) do part.off end @@ -60,7 +60,7 @@ def test_off end def test_scroll - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect :call, nil, ['H'] mock.expect :call, nil, ['I'] part.stub(:write, mock) do @@ -71,7 +71,7 @@ def test_scroll def test_display_ensures_on part.off - mock = MiniTest::Mock.new.expect :call, nil + mock = Minitest::Mock.new.expect :call, nil part.stub(:on, mock) do part.display(1) end @@ -85,7 +85,7 @@ def test_write_clears_if_unknown_char # Expect every segment to get #write(1). Inverted logic because anode. mocks = [] part.segments.each do - mocks << MiniTest::Mock.new.expect(:call, nil, [1]) + mocks << Minitest::Mock.new.expect(:call, nil, [1]) end part.segments[0].stub(:write, mocks[0]) do part.segments[1].stub(:write, mocks[1]) do diff --git a/test/motor/servo_test.rb b/test/motor/servo_test.rb index 9a8afae..e6c0c24 100644 --- a/test/motor/servo_test.rb +++ b/test/motor/servo_test.rb @@ -1,6 +1,6 @@ require_relative '../test_helper' -class ServoMotorTest < MiniTest::Test +class ServoMotorTest < Minitest::Test def board @board ||= BoardMock.new end @@ -10,7 +10,7 @@ def part end def test_toggle_on_initialize - mock = MiniTest::Mock.new.expect(:call, nil, [1, :on], min: 544, max: 2400) + mock = Minitest::Mock.new.expect(:call, nil, [1, :on], min: 544, max: 2400) board.stub(:servo_toggle, mock) do Denko::Motor::Servo.new(board: board, pin:1) end @@ -19,14 +19,14 @@ def test_toggle_on_initialize def test_attach part - mock = MiniTest::Mock.new.expect(:call, nil, [1, :on], min: 0, max: 360) + mock = Minitest::Mock.new.expect(:call, nil, [1, :on], min: 0, max: 360) board.stub(:servo_toggle, mock) { part.attach } mock.verify end def test_detach part - mock = MiniTest::Mock.new.expect(:call, nil, [1, :off]) + mock = Minitest::Mock.new.expect(:call, nil, [1, :off]) board.stub(:servo_toggle, mock) { part.detach } mock.verify end @@ -44,7 +44,7 @@ def test_position_modulo_180 def test_position_writes_mapped_microseconds_to_board part - mock = MiniTest::Mock.new.expect(:call, nil, [1, 20]) + mock = Minitest::Mock.new.expect(:call, nil, [1, 20]) board.stub(:servo_write, mock) do part.position = 10 end @@ -53,7 +53,7 @@ def test_position_writes_mapped_microseconds_to_board def test_speed_writes_mapped_microseconds_to_board part - mock = MiniTest::Mock.new.expect(:call, nil, [1, 180]) + mock = Minitest::Mock.new.expect(:call, nil, [1, 180]) board.stub(:servo_write, mock) do part.speed = 0 end diff --git a/test/motor/stepper_test.rb b/test/motor/stepper_test.rb index aee4be6..a17e00d 100644 --- a/test/motor/stepper_test.rb +++ b/test/motor/stepper_test.rb @@ -1,6 +1,6 @@ require_relative '../test_helper' -class StepperMotorTest < MiniTest::Test +class StepperMotorTest < Minitest::Test def board @board ||= BoardMock.new end @@ -16,10 +16,10 @@ def test_initialize end def test_step_cw - dir_mock = MiniTest::Mock.new + dir_mock = Minitest::Mock.new dir_mock.expect :low?, false dir_mock.expect :low, nil - step_mock = MiniTest::Mock.new + step_mock = Minitest::Mock.new step_mock.expect :high, nil step_mock.expect :low, nil @@ -33,10 +33,10 @@ def test_step_cw end def test_step_cc - dir_mock = MiniTest::Mock.new + dir_mock = Minitest::Mock.new dir_mock.expect :high?, false dir_mock.expect :high, nil - step_mock = MiniTest::Mock.new + step_mock = Minitest::Mock.new step_mock.expect :high, nil step_mock.expect :low, nil diff --git a/test/one_wire/bus_test.rb b/test/one_wire/bus_test.rb index 3a95ab9..d6eff23 100644 --- a/test/one_wire/bus_test.rb +++ b/test/one_wire/bus_test.rb @@ -1,6 +1,6 @@ require_relative '../test_helper' -class OneWireBusTest < MiniTest::Test +class OneWireBusTest < Minitest::Test def board @board ||= BoardMock.new end @@ -19,7 +19,7 @@ def test_initialize end def test_read_power_supply_locks_mutex - mock = MiniTest::Mock.new.expect(:call, nil) + mock = Minitest::Mock.new.expect(:call, nil) part.mutex.stub(:synchronize, mock) do part.read_power_supply end @@ -39,7 +39,7 @@ def test_read_power_supply end def test_read_power_supply_sends_board_commands - board_mock = MiniTest::Mock.new + board_mock = Minitest::Mock.new board_mock.expect(:set_pin_mode, nil, [part.pin, :output]) board_mock.expect(:low, 0) board_mock.expect(:digital_write, nil, [part.pin, 0]) @@ -47,7 +47,7 @@ def test_read_power_supply_sends_board_commands board_mock.expect(:one_wire_write, nil, [part.pin, false, [0xCC, 0xB4]]) # Stub the parasite power response from the board. - read_mock = MiniTest::Mock.new + read_mock = Minitest::Mock.new read_mock.expect(:call, 0, [1]) part.stub(:board, board_mock) do @@ -65,7 +65,7 @@ def test_device_present_in_mutex # part.device_present calls #reset which expects a response. board.inject_read_for_component(part, 1, "1") - mock = MiniTest::Mock.new.expect(:call, nil) + mock = Minitest::Mock.new.expect(:call, nil) part.mutex.stub(:synchronize, mock) do part.device_present end @@ -73,7 +73,7 @@ def test_device_present_in_mutex end def test_set_device_present - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect(:call, nil, [1]) mock.expect(:call, nil, [1]) @@ -96,7 +96,7 @@ def test_pre_callback_filter def test_reset part - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect :call, nil, [1, 1] mock.expect :call, nil, [1, 0] @@ -109,7 +109,7 @@ def test_reset def test__read part - mock = MiniTest::Mock.new.expect :call, nil, [1, 4] + mock = Minitest::Mock.new.expect :call, nil, [1, 4] board.stub(:one_wire_read, mock) do part._read(4) end @@ -118,7 +118,7 @@ def test__read def test_write part - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect :call, nil, [1, true, [255, 177, 0x44]] mock.expect :call, nil, [1, true, [255, 177, 0x48]] mock.expect :call, nil, [1, false, [255, 177, 0x55]] diff --git a/test/one_wire/peripheral_test.rb b/test/one_wire/peripheral_test.rb index 0e79925..f5bb7d1 100644 --- a/test/one_wire/peripheral_test.rb +++ b/test/one_wire/peripheral_test.rb @@ -1,6 +1,6 @@ require_relative '../test_helper' -class OneWirePeripheralTest < MiniTest::Test +class OneWirePeripheralTest < Minitest::Test def board @board ||= BoardMock.new end @@ -21,7 +21,7 @@ def test_requires_address end def test_atomically_locks_the_bus_mutex - mock = MiniTest::Mock.new.expect(:synchronize, nil) + mock = Minitest::Mock.new.expect(:synchronize, nil) bus.stub(:mutex, mock) do part.atomically {} end @@ -29,13 +29,13 @@ def test_atomically_locks_the_bus_mutex end def test_atomically_calls_the_block_once - mock = MiniTest::Mock.new.expect(:call, nil) + mock = Minitest::Mock.new.expect(:call, nil) part.atomically { mock.call } mock.verify end def test_match_calls_reset - mock = MiniTest::Mock.new.expect(:call, nil) + mock = Minitest::Mock.new.expect(:call, nil) bus.stub(:reset, mock) do part.match end @@ -43,7 +43,7 @@ def test_match_calls_reset end def test_match_skips_rom_if_alone - mock = MiniTest::Mock.new.expect(:call, nil, [0xCC]) + mock = Minitest::Mock.new.expect(:call, nil, [0xCC]) bus.stub(:write, mock) do part.match end @@ -51,7 +51,7 @@ def test_match_skips_rom_if_alone end def test_match_matches_rom_if_not_alone - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect(:call, nil, [0x55]) mock.expect(:call, nil, [[255,255,255,255,255,255,255,255]]) bus.instance_variable_set(:@found_devices, [1,2]) @@ -62,19 +62,19 @@ def test_match_matches_rom_if_not_alone end def test_copy_scratch_is_atomic - mock = MiniTest::Mock.new.expect(:call, nil) + mock = Minitest::Mock.new.expect(:call, nil) part.stub(:atomically, mock) { part.copy_scratch } mock.verify end def test_copy_scratch_matches_first - mock = MiniTest::Mock.new.expect(:call, nil) + mock = Minitest::Mock.new.expect(:call, nil) part.stub(:match, mock) { part.copy_scratch } mock.verify end def test_copy_scratch_sends_the_command - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect(:call, nil, [0xCC]) mock.expect(:call, nil, [0x48]) bus.stub(:write, mock) { part.copy_scratch } @@ -82,7 +82,7 @@ def test_copy_scratch_sends_the_command end def test_copy_scratch_resets_after_command_if_parasite_power - mock = MiniTest::Mock.new.expect(:call, nil).expect(:call, nil) + mock = Minitest::Mock.new.expect(:call, nil).expect(:call, nil) bus.stub(:parasite_power, true) do bus.stub(:reset, mock) { part.copy_scratch } end @@ -95,7 +95,7 @@ def test_read_scratch_is_atomic # Will read 9 bytes. board.inject_read_for_component(bus, 1, "255,255,255,255,255,255,255,255") - mock = MiniTest::Mock.new.expect(:call, nil) + mock = Minitest::Mock.new.expect(:call, nil) part.stub(:atomically, mock) { part.read_scratch(9) } mock.verify end @@ -106,7 +106,7 @@ def test_read_scratch_matches_first # Will read 9 bytes. board.inject_read_for_component(bus, 1, "255,255,255,255,255,255,255,255") - mock = MiniTest::Mock.new.expect(:call, nil) + mock = Minitest::Mock.new.expect(:call, nil) part.stub(:match, mock) { part.read_scratch(9) } mock.verify end @@ -117,7 +117,7 @@ def test_read_scratch_sends_the_command # Will read 9 bytes. board.inject_read_for_component(bus, 1, "255,255,255,255,255,255,255,255") - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect(:call, nil, [0xCC]) mock.expect(:call, nil, [0xBE]) bus.stub(:write, mock) { part.read_scratch(9) } @@ -130,25 +130,25 @@ def test_read_scratch_reads_bytes_from_bus # Will read 9 bytes. board.inject_read_for_component(bus, 1, "255,255,255,255,255,255,255,255") - mock = MiniTest::Mock.new.expect(:call, nil, [9]) + mock = Minitest::Mock.new.expect(:call, nil, [9]) bus.stub(:read, mock) { part.read_scratch(9) } mock.verify end def test_write_scratch_is_atomic - mock = MiniTest::Mock.new.expect(:call, nil) + mock = Minitest::Mock.new.expect(:call, nil) part.stub(:atomically, mock) { part.write_scratch(1) } mock.verify end def test_write_scratch_matches_first - mock = MiniTest::Mock.new.expect(:call, nil) + mock = Minitest::Mock.new.expect(:call, nil) part.stub(:match, mock) { part.write_scratch(1) } mock.verify end def test_write_scratch_sends_the_command_and_data - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect(:call, nil, [0xCC]) mock.expect(:call, nil, [0x4E]) mock.expect(:call, nil, [1,2,3]) diff --git a/test/pulse_io/buzzer_test.rb b/test/pulse_io/buzzer_test.rb index 3c4ecee..b7ea416 100644 --- a/test/pulse_io/buzzer_test.rb +++ b/test/pulse_io/buzzer_test.rb @@ -1,6 +1,6 @@ require_relative '../test_helper' -class BuzzerTest < MiniTest::Test +class BuzzerTest < Minitest::Test def board @board ||= BoardMock.new end @@ -14,7 +14,7 @@ def test_low_on_initialize end def test_tone - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect :call, nil, [part.pin, 60, nil] mock.expect :call, nil, [part.pin, 120, 2000] board.stub(:tone, mock) do @@ -26,7 +26,7 @@ def test_tone def test_no_tone part - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect :call, nil, [part.pin] board.stub(:no_tone, mock) do part.no_tone @@ -35,7 +35,7 @@ def test_no_tone end def stop - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect :call, nil mock.expect :call, nil part.stub(:kill_thread, mock) do diff --git a/test/pulse_io/ir_transmitter_test.rb b/test/pulse_io/ir_transmitter_test.rb index b40b019..5ac5625 100644 --- a/test/pulse_io/ir_transmitter_test.rb +++ b/test/pulse_io/ir_transmitter_test.rb @@ -1,6 +1,6 @@ require_relative '../test_helper' -class IRTransmitterTest < MiniTest::Test +class IRTransmitterTest < Minitest::Test def board @board ||= BoardMock.new end @@ -29,7 +29,7 @@ def test_pulse_length_validation def test_emits part - mock = MiniTest::Mock.new.expect(:call, nil, [1, 38, [127,0]]) + mock = Minitest::Mock.new.expect(:call, nil, [1, 38, [127,0]]) board.stub(:infrared_emit, mock) do part.emit([127,0]) end diff --git a/test/pulse_io/pwm_output_test.rb b/test/pulse_io/pwm_output_test.rb index f236dce..ca2fc8d 100644 --- a/test/pulse_io/pwm_output_test.rb +++ b/test/pulse_io/pwm_output_test.rb @@ -10,8 +10,8 @@ def part end def test_pwm_write - enable_mock = MiniTest::Mock.new.expect :call, nil - write_mock = MiniTest::Mock.new + enable_mock = Minitest::Mock.new.expect :call, nil + write_mock = Minitest::Mock.new write_mock.expect :call, nil, [14, 128] board.stub(:pwm_write, write_mock) do @@ -31,7 +31,7 @@ def test_pwm_write end def test_write_uses_digital_write_at_limits - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect :call, nil, [board.high] mock.expect :call, nil, [board.low] part.stub(:digital_write, mock) do @@ -42,7 +42,7 @@ def test_write_uses_digital_write_at_limits end def test_write_uses_analog_write_between_limits - mock = MiniTest::Mock.new.expect :call, nil, [128] + mock = Minitest::Mock.new.expect :call, nil, [128] part.stub(:pwm_write, mock) do part.write(128) end diff --git a/test/rtc/ds3231_test.rb b/test/rtc/ds3231_test.rb index 8025049..4e2ec03 100644 --- a/test/rtc/ds3231_test.rb +++ b/test/rtc/ds3231_test.rb @@ -1,6 +1,6 @@ require_relative '../test_helper' -class DS3231Test < MiniTest::Test +class DS3231Test < Minitest::Test def board @board ||= BoardMock.new end @@ -28,7 +28,7 @@ def test_bcd_to_time end def test_time= - mock = MiniTest::Mock.new.expect :call, nil, [[0, [0, 0, 0, 6, 1, 1, 48]]] + mock = Minitest::Mock.new.expect :call, nil, [[0, [0, 0, 0, 6, 1, 1, 48]]] part.stub(:i2c_write, mock) do part.time = Time.new(2000, 1, 1, 0, 0, 0.0) end @@ -38,7 +38,7 @@ def test_time= def test_read board.inject_read_for_component(part, 5, "104-0,0,0,6,1,1,48") - mock = MiniTest::Mock.new.expect :call, nil, [part.address, 0x00, 7, 100000, false] + mock = Minitest::Mock.new.expect :call, nil, [part.address, 0x00, 7, 100000, false] bus.stub(:_read, mock) do part.time end @@ -46,7 +46,7 @@ def test_read end def test_pre_callback_filter - mock = MiniTest::Mock.new.expect :call, nil, [Time.new(2000, 1, 1, 0, 0, 0.0)] + mock = Minitest::Mock.new.expect :call, nil, [Time.new(2000, 1, 1, 0, 0, 0.0)] part.stub(:update_state, mock) do bus.send(:update, "104-0,0,0,6,1,1,48") end diff --git a/test/sensor/dht_test.rb b/test/sensor/dht_test.rb index 49c838a..aad34a7 100644 --- a/test/sensor/dht_test.rb +++ b/test/sensor/dht_test.rb @@ -1,6 +1,6 @@ require_relative '../test_helper' -class DHTTest < MiniTest::Test +class DHTTest < Minitest::Test PIN = 1 # Actual raw data from a sensor @@ -26,7 +26,7 @@ def part # It should tell the board to do a #pulse_read def test__read part - mock = MiniTest::Mock.new.expect(:call, nil, [PIN], reset: board.low, reset_time: 20000, pulse_limit: 84, timeout: 100) + mock = Minitest::Mock.new.expect(:call, nil, [PIN], reset: board.low, reset_time: 20000, pulse_limit: 84, timeout: 100) board.stub(:pulse_read, mock) do part._read end @@ -36,7 +36,7 @@ def test__read # Callback pre filter should convert string of bytes to array and call #decode with it. def test_pre_callback_filter part - mock = MiniTest::Mock.new.expect(:call, nil, [GOOD_ARRAY]) + mock = Minitest::Mock.new.expect(:call, nil, [GOOD_ARRAY]) part.stub(:decode, mock) do part.update(GOOD_STRING) end diff --git a/test/sensor/ds18b20_test.rb b/test/sensor/ds18b20_test.rb index 89e5912..f9d75aa 100644 --- a/test/sensor/ds18b20_test.rb +++ b/test/sensor/ds18b20_test.rb @@ -1,6 +1,6 @@ require_relative '../test_helper' -class DS18B20Test < MiniTest::Test +class DS18B20Test < Minitest::Test def board @board ||= BoardMock.new end @@ -45,7 +45,7 @@ def test_set_convert_time def test_pre_callback_filter_does_crc_and_returns_error_on_fail raw_bytes = [239, 1, 75, 70, 127, 255, 1, 16, 245] - mock = MiniTest::Mock.new.expect(:call, false, [raw_bytes]) + mock = Minitest::Mock.new.expect(:call, false, [raw_bytes]) Denko::OneWire::Helper.stub(:crc, mock) do assert_equal({crc_error: true}, part.pre_callback_filter(raw_bytes)) @@ -56,7 +56,7 @@ def test_pre_callback_filter_does_crc_and_returns_error_on_fail # test resolution= def test_convert_is_atomic - mock = MiniTest::Mock.new.expect(:call, nil) + mock = Minitest::Mock.new.expect(:call, nil) part.stub(:atomically, mock) do part.convert end @@ -64,8 +64,8 @@ def test_convert_is_atomic end def test_convert_matches_first - match_mock = MiniTest::Mock.new.expect(:call, nil) - sleep_mock = MiniTest::Mock.new.expect(:call, nil, [0.75]) + match_mock = Minitest::Mock.new.expect(:call, nil) + sleep_mock = Minitest::Mock.new.expect(:call, nil, [0.75]) part.stub(:match, match_mock) do part.stub(:sleep, sleep_mock) do @@ -76,10 +76,10 @@ def test_convert_matches_first end def test_convert_sends_the_command - write_mock = MiniTest::Mock.new + write_mock = Minitest::Mock.new write_mock.expect(:call, nil, [0xCC]) write_mock.expect(:call, nil, [0x44]) - sleep_mock = MiniTest::Mock.new.expect(:call, nil, [0.75]) + sleep_mock = Minitest::Mock.new.expect(:call, nil, [0.75]) bus.stub(:write, write_mock) do part.stub(:sleep, sleep_mock) do @@ -90,7 +90,7 @@ def test_convert_sends_the_command end def test_convert_sets_max_convert_time_first - sleep_mock = MiniTest::Mock.new.expect(:call, nil, [0.75]) + sleep_mock = Minitest::Mock.new.expect(:call, nil, [0.75]) part.stub(:sleep, sleep_mock) do part.convert end @@ -99,7 +99,7 @@ def test_convert_sets_max_convert_time_first end def test_convert_sleeps_for_convert_time - mock = MiniTest::Mock.new.expect(:call, nil, [0.75]) + mock = Minitest::Mock.new.expect(:call, nil, [0.75]) part.stub(:sleep, mock) do part.convert end diff --git a/test/spi/bus_test.rb b/test/spi/bus_test.rb index e00cb9b..0b74241 100644 --- a/test/spi/bus_test.rb +++ b/test/spi/bus_test.rb @@ -21,7 +21,7 @@ def part OPTIONS = { read: 2, frequency: 800000, mode: 2, bit_order: :lsbfirst } def test_transfer - mock = MiniTest::Mock.new.expect :call, nil, [PIN], **OPTIONS + mock = Minitest::Mock.new.expect :call, nil, [PIN], **OPTIONS board.stub(:spi_transfer, mock) do part.transfer(PIN, **OPTIONS) end @@ -29,7 +29,7 @@ def test_transfer end def test_listen - mock = MiniTest::Mock.new.expect :call, nil, [PIN], **OPTIONS + mock = Minitest::Mock.new.expect :call, nil, [PIN], **OPTIONS board.stub(:spi_listen, mock) do part.listen(PIN, **OPTIONS) end @@ -37,7 +37,7 @@ def test_listen end def test_stop - mock = MiniTest::Mock.new.expect :call, nil, [PIN] + mock = Minitest::Mock.new.expect :call, nil, [PIN] board.stub(:spi_stop, mock) do part.stop(PIN) end @@ -54,7 +54,7 @@ def test_add_and_remove_component end def test_set_pin_mode - mock = MiniTest::Mock.new.expect :call, nil, [9, :output] + mock = Minitest::Mock.new.expect :call, nil, [9, :output] board.stub(:set_pin_mode, mock) do part.set_pin_mode(9, :output) end diff --git a/test/spi/input_register_test.rb b/test/spi/input_register_test.rb index b049e07..8fee8dd 100644 --- a/test/spi/input_register_test.rb +++ b/test/spi/input_register_test.rb @@ -28,7 +28,7 @@ def test_state_setup end def test_read - mock = MiniTest::Mock.new.expect :call, nil, [9], read: 2, frequency: 800000, mode: 2, bit_order: :lsbfirst + mock = Minitest::Mock.new.expect :call, nil, [9], read: 2, frequency: 800000, mode: 2, bit_order: :lsbfirst bus.stub(:transfer, mock) do part.read end @@ -36,7 +36,7 @@ def test_read end def test_listen - mock = MiniTest::Mock.new.expect :call, nil, [9], read: 2, frequency: 800000, mode: 2, bit_order: :lsbfirst + mock = Minitest::Mock.new.expect :call, nil, [9], read: 2, frequency: 800000, mode: 2, bit_order: :lsbfirst bus.stub(:listen, mock) do part.listen end @@ -44,7 +44,7 @@ def test_listen end def test_stop - mock = MiniTest::Mock.new.expect :call, nil, [9] + mock = Minitest::Mock.new.expect :call, nil, [9] bus.stub(:stop, mock) do part.stop end @@ -69,7 +69,7 @@ def test_bit_array_conversion_and_state_update end def test_callbacks_get_bit_array - mock = MiniTest::Mock.new.expect :call, nil, [[1,1,1,1,1,1,1,0]] + mock = Minitest::Mock.new.expect :call, nil, [[1,1,1,1,1,1,1,0]] part.add_callback do |data| mock.call(data) end @@ -87,7 +87,7 @@ def test_read_proxy part.update("255") end - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect :call, nil part.stub(:read, mock) do button.read @@ -96,7 +96,7 @@ def test_read_proxy end def test_listener_proxy - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect :call, nil part.stub(:listen, mock) do # Tells the register to start listening when it initializees. @@ -119,7 +119,7 @@ def test_stop_listener_proxy button # Calling stop on a child part, when only it is listening, should call stop on the register too. - mock = MiniTest::Mock.new.expect :call, nil + mock = Minitest::Mock.new.expect :call, nil part.stub(:stop, mock) do button.stop end @@ -131,7 +131,7 @@ def test_stop_listener_proxy end def test_gets_reads_through_pin - mock = MiniTest::Mock.new.expect :call, nil, ["127,255"] + mock = Minitest::Mock.new.expect :call, nil, ["127,255"] part.stub(:update, mock) do board.update("#{part.pin}:127,255") end diff --git a/test/spi/output_register_test.rb b/test/spi/output_register_test.rb index 3822878..60260af 100644 --- a/test/spi/output_register_test.rb +++ b/test/spi/output_register_test.rb @@ -23,7 +23,7 @@ def led def test_write part - mock = MiniTest::Mock.new.expect :call, nil, [9], write: [255,127], frequency: 800000, mode: 2, bit_order: :lsbfirst + mock = Minitest::Mock.new.expect :call, nil, [9], write: [255,127], frequency: 800000, mode: 2, bit_order: :lsbfirst bus.stub(:transfer, mock) do arr = Array.new(16) { 1 }; arr[7] = 0 part.instance_variable_set(:@state, arr) @@ -46,7 +46,7 @@ def test_write_buffering_control def test_updates_and_writes_state_for_children led - mock = MiniTest::Mock.new.expect :call, nil, [9], write: [0, 1], frequency: 800000, mode: 2, bit_order: :lsbfirst + mock = Minitest::Mock.new.expect :call, nil, [9], write: [0, 1], frequency: 800000, mode: 2, bit_order: :lsbfirst bus.stub(:transfer, mock) do led.on sleep 0.050 @@ -62,7 +62,7 @@ def test_updates_and_writes_state_for_children def test_implements_digital_read_for_children led - mock = MiniTest::Mock.new.expect :call, nil, [0] + mock = Minitest::Mock.new.expect :call, nil, [0] part.stub(:digital_read, mock) do led.board.digital_read(led.pin) end @@ -73,7 +73,7 @@ def test_bit_and_byte_orders_correct part.instance_variable_set(:@bytes, 2) bit_array = "0101010100001111".split("") - mock = MiniTest::Mock.new.expect :call, nil, [9], write: [0b11110000, 0b10101010], frequency: 800000, mode: 2, bit_order: :lsbfirst + mock = Minitest::Mock.new.expect :call, nil, [9], write: [0b11110000, 0b10101010], frequency: 800000, mode: 2, bit_order: :lsbfirst bus.stub(:transfer, mock) do part.instance_variable_set(:@state, bit_array) part.write diff --git a/test/uart/bitbang_test.rb b/test/uart/bitbang_test.rb index 1ad0b58..6428329 100644 --- a/test/uart/bitbang_test.rb +++ b/test/uart/bitbang_test.rb @@ -1,6 +1,6 @@ require_relative '../test_helper' -class UARTBitBangTest < MiniTest::Test +class UARTBitBangTest < Minitest::Test include TestPacker def board @@ -12,7 +12,7 @@ def part end def test_initialize - mock = MiniTest::Mock.new + mock = Minitest::Mock.new # Set RX to input mock.expect :call, nil, ["0.10.1\n"] # Start BB UART @@ -27,7 +27,7 @@ def test_initialize def test_write part - mock = MiniTest::Mock.new + mock = Minitest::Mock.new mock.expect :call, nil, ["13..8.Testing\\\n\n"] board.stub(:write, mock) do part.write("Testing\n")