Module: MixpanelTestHelpers

Defined in:
lib/generators/mixpanel_test/cucumber/templates/mixpanel_test_service.rb

Instance Method Summary collapse

Instance Method Details

#mixpanel_synchronize_until(secs = 2) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/generators/mixpanel_test/cucumber/templates/mixpanel_test_service.rb', line 9

def mixpanel_synchronize_until(secs = 2)
  start_time = Time.now

  until (res=yield) || Time.now >= start_time+2.seconds
    sleep 0.05
  end

  res || nil
end