Skip to content

Commit

Permalink
avoid flexmock deprecation warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
adammck committed May 26, 2011
1 parent 6371e44 commit 18e22b2
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/test_cm17a_device.rb
Expand Up @@ -24,11 +24,11 @@ class MockController < FlexMock
class << self
def setup_controller(controller)
X10.controller = controller
controller.mock_handle(:device, 1) { |house, unit|
controller.should_receive(:device).returns { |house, unit|
X10::Cm17a::Device.new(house, unit, controller)
}
end

def use
super do |mock|
setup_controller(mock)
Expand Down Expand Up @@ -56,7 +56,7 @@ def test_create

def test_on
MockController.use do |controller|
controller.mock_handle(:command, 1) { |house, unit, cmd, step|
controller.should_receive(:command).returns { |house, unit, cmd, step|
assert_equal :on, cmd
assert_equal 0, step
}
Expand All @@ -67,7 +67,7 @@ def test_on

def test_off
MockController.use do |controller|
controller.mock_handle(:command, 1) { |house, unit, cmd, step|
controller.should_receive(:command).returns { |house, unit, cmd, step|
assert_equal :off, cmd
assert_equal 0, step
}
Expand All @@ -78,7 +78,7 @@ def test_off

def test_adjust
MockController.use do |controller|
controller.mock_handle(:command, 2) { |house, unit, cmd, step|
controller.should_receive(:command).times(2).returns { |house, unit, cmd, step|
if step == 4
assert_equal 4, step
assert_equal :brighten, cmd
Expand All @@ -95,7 +95,7 @@ def test_adjust

def test_big_adjustments
MockController.use do |controller|
controller.mock_handle(:command, 2) { |house, unit, cmd, step|
controller.should_receive(:command) { |house, unit, cmd, step|
assert_equal :dim, cmd
if step == 6
assert_equal 6, step
Expand All @@ -110,15 +110,15 @@ def test_big_adjustments

def test_small_adjustments
MockController.use do |controller|
controller.mock_handle(:command, 0) { }
controller.should_receive(:command).returns { }
dev = X10.device('a1')
dev.step(0)
end
end

def test_device_addressing
MockController.use do |controller|
controller.mock_handle(:command) { |house, unit, cmd, step|
controller.should_receive(:command).returns { |house, unit, cmd, step|
assert_equal 1, house
assert_equal 2, unit
}
Expand Down

0 comments on commit 18e22b2

Please sign in to comment.