-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Engine now support and optional crawl_id argument. If crawl_id is not provided it will be generated automatically.
- Loading branch information
1 parent
b40fced
commit 940f27d
Showing
2 changed files
with
45 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
defmodule ManagerTest do | ||
use ExUnit.Case, async: false | ||
|
||
setup do | ||
on_exit(fn -> | ||
Crawly.Engine.stop_spider(TestSpider) | ||
end) | ||
end | ||
|
||
test "Engine automatically tags a job on startup" do | ||
:ok = Crawly.Engine.start_spider(TestSpider) | ||
assert Crawly.Engine.get_crawl_id(TestSpider) | ||
end | ||
|
||
|
||
test "Engine will use a tag from external system if set" do | ||
tag = "custom_crawl_tag" | ||
:ok = Crawly.Engine.start_spider(TestSpider, tag) | ||
assert {:ok, tag} == Crawly.Engine.get_crawl_id(TestSpider) | ||
end | ||
end |