I have a test that needs to check if the block specified for the method is being called.
block = lambda {
}
block.should_receive(:call)
get_data_with_timeout(1, &block)
def get_data_with_timeout(timeout)
begin
timeout(timeout) {
data = get_data
yield data
}
rescue Timeout::Error
end
end
Essentially, I want to check that if there is no timeout, then the block is called and vice versa. Is this possible in rspec?
source
share