Showing the changes to test (1 of 21 files). Show all
Unified · Split
| @@ -28,4 +28,16 @@ class DocsParserTest < MiniTest::Spec · 27 unmodified lines | |||
| 28 | end | 28 | end |
| 29 | end | 29 | end |
| 30 | end | 30 | end |
| 31 | |||
| 32 | describe "#title" do | ||
| 33 | it "returns nil when there is no <title>" do | ||
| 34 | body = '<!doctype html><meta charset=utf-8><div>Test</div>' | ||
| 35 | assert_nil parser(body).title | ||
| 36 | end | ||
| 37 | |||
| 38 | it "returns the <title> when there is one" do | ||
| 39 | body = '<!doctype html><meta charset=utf-8><title>Title</title><div>Test</div>' | ||
| 40 | assert_equal 'Title', parser(body).title | ||
| 41 | end | ||
| 42 | end | ||
| 31 | end | 43 | end |