Determine environment in type() function
nskins opened this issue · comments
Nicholas Skinsacos commented
In util.rb, we have a function called type() that sleeps between the output of each character. Unfortunately, it's not very good for testing since it slows down the test suite. Is there some way to determine the environment (possibly whether the code is running via ruby vs. rspec) in Ruby? I think in Rails there is an equivalent method called rails.env but clearly it can't work here.
If so, then we can sleep only when the environment is ruby and not rspec. Then type() (and certain other methods) would be testable, which would be quite nice.
EDIT: http://stackoverflow.com/questions/24932504/detect-that-code-run-by-rspec-ruby