epilicious 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +8 -0
- data/epilicious.gemspec +28 -0
- data/lib/epilicious/fetcher.rb +59 -0
- data/lib/epilicious/parser.rb +37 -0
- data/lib/epilicious/recipe.rb +13 -0
- data/lib/epilicious/version.rb +3 -0
- data/lib/epilicious.rb +8 -0
- data/recipes_page.html +2690 -0
- data/recipes_page.xml +2690 -0
- data/test/epilicious_test.rb +1 -0
- data/test/fetcher_test.rb +32 -0
- data/test/fixtures/recipes_page.html +3295 -0
- data/test/parser_test.rb +56 -0
- data/test/test_helper.rb +10 -0
- metadata +151 -0
@@ -0,0 +1 @@
|
|
1
|
+
require 'test_helper'
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
describe Epilicious::Fetcher do
|
4
|
+
let(:fetcher) { Epilicious::Fetcher.new }
|
5
|
+
|
6
|
+
context '#fetch_recipes' do
|
7
|
+
let(:recipes) { fetcher.fetch_recipes }
|
8
|
+
|
9
|
+
it 'should return a list of recipes' do
|
10
|
+
recipes.length.must_equal 15
|
11
|
+
recipes.last.must_be_instance_of Epilicious::Recipe
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context '#fetch_recipe' do
|
16
|
+
let(:recipe) { fetcher.fetch_recipe }
|
17
|
+
it' should return a recipe' do
|
18
|
+
recipe.must_be_instance_of Epilicious::Recipe
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context 'private methods' do
|
23
|
+
let(:url) { "/articlesguides/bestof/toprecipes/bestburgerrecipes" }
|
24
|
+
let(:recipes_page) { fetcher.send(:fetch_page, url) }
|
25
|
+
|
26
|
+
context '#fetch_page' do
|
27
|
+
it 'should return a nokogiri document' do
|
28
|
+
recipes_page.must_be_instance_of Nokogiri::HTML::Document
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|