Update input_box to use instance_of? instead of class ==

* cleaner implementation
* works around rspec stacklevel too deep, see
  rspec/rspec-mocks#687