utilities_spec.rb 743 B

1234567891011121314151617181920212223242526272829303132
  1. require 'utilities'
  2. describe JBidwatcher do
  3. it "should test okay" do
  4. JBidwatcher.test_basics
  5. end
  6. it "should handle private mapped actions" do
  7. class MockUserActions < Hash
  8. private
  9. def CancelSnipe(x, y)
  10. self['cancel_snipe_called'] = true
  11. end
  12. end
  13. m = Hash.new
  14. def m.logMessage(x)
  15. self['log_result'] = x
  16. end
  17. JConfig.set_logger(m)
  18. c = "Component" # A mock swing component.
  19. ae = "Auction Entry" # A mock auction entry
  20. user_actions = MockUserActions.new
  21. JBidwatcher.handle_action('Cancel Snipe', user_actions, c, ae)
  22. # Assert that nothing was logged.
  23. expect(m['log_result']).to be_nil
  24. expect(user_actions['cancel_snipe_called']).to be true
  25. end
  26. end