Skip to content
Browse files

Modify sensor tests to validate data

  • Loading branch information...
1 parent 0adfb83 commit 61d29b1aedfa5905cafb7a8251f514101a1802ca @pcasaretto pcasaretto committed Feb 22, 2013
Showing with 5 additions and 5 deletions.
  1. +5 −5 spec/lib/components/sensor_spec.rb
View
10 spec/lib/components/sensor_spec.rb
@@ -44,17 +44,17 @@ module Components
it 'should call all callbacks passing in the given data' do
sensor = Sensor.new(board: board, pin: 'a pin')
- first_block_called = false
- second_block_called = false
+ first_block_data = nil
+ second_block_data = nil
sensor.when_data_received do |data|
- first_block_called = true
+ first_block_data = data
end
sensor.when_data_received do |data|
- second_block_called = true
+ second_block_data = data
end
sensor.update('Some data')
- fail unless first_block_called && second_block_called
+ [first_block_data, second_block_data].each { |block_data| block_data.should == "Some data" }
end
end
end

0 comments on commit 61d29b1

Please sign in to comment.
Something went wrong with that request. Please try again.