Module: Glib::TestHelpers::ClassMethods

Defined in:
lib/glib/test_helpers.rb

Instance Method Summary collapse

Instance Method Details

#define_crawler_test(user, crawled_at, &on_after_crawl) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/glib/test_helpers.rb', line 10

def define_crawler_test(user, crawled_at, &on_after_crawl)
  test "crawl api for #{user[:email]} #{user[:device]} #{user[:version] || 'current'}" do
    Timecop.freeze(crawled_at || user[:crawled_at]) do
      router = crawl_json_pages(user)
      on_after_crawl&.call(router)
    end

    # Right now we're not benefitting from these due to Ruby's limited concurrency.
    # Thread.new(user) { crawl_pages(user) }.join
  end
end