lonely_planet_tours 1.0.3 → 1.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 +4 -4
- data/README.md +24 -5
- data/lib/lonely_planet/lonelyplanet_scrap.rb +32 -14
- data/lib/lonely_planet/version.rb +2 -2
- data/spec/fixtures/vcr_cassettes/taiwan_tours_full.yml +2461 -0
- data/spec/fixtures/vcr_cassettes/taiwan_tours_json.yml +2461 -0
- data/spec/lonelyplanet_spec.rb +32 -13
- data/spec/tours.yml +0 -37
- metadata +6 -2
data/spec/lonelyplanet_spec.rb
CHANGED
@@ -9,30 +9,49 @@ require 'webmock/minitest'
|
|
9
9
|
require './lib/lonely_planet/lonelyplanet_scrap'
|
10
10
|
require './spec/support/vcr_setup'
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
VCR.use_cassette('taiwan_tours') do
|
12
|
+
VCR.use_cassette('taiwan_tours_json') do
|
15
13
|
obj = LonelyPlanetScrape::LonelyPlanetTours.new('taiwan')
|
16
14
|
tours_found = JSON.parse(obj.tours) if !obj.tours.nil?
|
17
15
|
|
18
|
-
describe '
|
16
|
+
describe 'Validate structure of result' do
|
17
|
+
|
18
|
+
0.upto(tours_found.length - 1) do |index|
|
19
|
+
|
20
|
+
|
21
|
+
it 'check if title exist and is not empty' do
|
22
|
+
|
23
|
+
refute_nil tours_found[index]['title'], "Expect Tittle not nil value for Object #{index}"
|
24
|
+
refute_empty tours_found[index]['title'], "Expect Tittle not empty value for Object #{index}"
|
25
|
+
end
|
19
26
|
|
20
|
-
it 'check if
|
21
|
-
|
27
|
+
it 'check if content exist and is not empty' do
|
28
|
+
|
29
|
+
refute_nil tours_found[index]['content'], "Expect description not nil for Object #{index}"
|
30
|
+
refute_empty tours_found[index]['content'], "Expect description not value for Object #{index}"
|
22
31
|
end
|
23
32
|
|
24
|
-
|
25
|
-
|
26
|
-
|
33
|
+
it 'check if location exist and is not empty' do
|
34
|
+
|
35
|
+
refute_nil tours_found[index]['location'], "Expect location not nil for Object #{index}"
|
36
|
+
refute_empty tours_found[index]['location'], "Expect location not value for Object #{index}"
|
27
37
|
end
|
28
38
|
|
29
|
-
it 'check
|
30
|
-
|
39
|
+
it 'check if price_currency exist and is not empty' do
|
40
|
+
|
41
|
+
refute_nil tours_found[index]['price_currency'], "Expect price_currency not nil for Object #{index}"
|
42
|
+
refute_empty tours_found[index]['price_currency'], "Expect price_currency not value for Object #{index}"
|
31
43
|
end
|
32
44
|
|
33
|
-
it 'check
|
34
|
-
|
45
|
+
it 'check if price exist and is not empty' do
|
46
|
+
refute_nil tours_found[index]['price'] , "Expect Price not nil value for Object #{index}"
|
47
|
+
refute_empty tours_found[index]['price'] , "Expect Price not empty value for Object #{index}"
|
35
48
|
end
|
49
|
+
|
50
|
+
it 'check if category exist and is not empty' do
|
51
|
+
refute_nil tours_found[index]['category'] , "Expect Category not nil value for Object #{index}"
|
52
|
+
refute_empty tours_found[index]['category'] , "Expect Category not empty value for Object #{index}"
|
53
|
+
end
|
54
|
+
|
36
55
|
end
|
37
56
|
end
|
38
57
|
end
|
data/spec/tours.yml
CHANGED
@@ -77,40 +77,3 @@
|
|
77
77
|
location: Taiwan
|
78
78
|
price_currency: "$"
|
79
79
|
price: '340'
|
80
|
-
- img: http://cache-graphicslib.viator.com/graphicslib/thumbs674x446/5972/SITours/experience-beijing-opera-private-makeup-session-and-show-at-taipeieye-in-taipei-170230.jpg
|
81
|
-
title: 'Experience Beijing Opera: Private Makeup Session and Show at TaipeiEYE'
|
82
|
-
content: You'll feel like a Chinese opera star during this 2-hour session with a
|
83
|
-
professional makeup artist...
|
84
|
-
location: Taiwan
|
85
|
-
price_currency: "$"
|
86
|
-
price: '177'
|
87
|
-
- img: http://cache-graphicslib.viator.com/graphicslib/thumbs674x446/5972/SITours/2-day-private-yilan-trip-from-taipei-in-taipei-156503.jpg
|
88
|
-
title: 2-Day Private Yilan Trip from Taipei
|
89
|
-
content: Experience the scenic farms, rustic walking paths and folk culture of Yilan,
|
90
|
-
one of the most breathtaking regions outside Taipei...
|
91
|
-
location: Taiwan
|
92
|
-
price_currency: "$"
|
93
|
-
price: '233'
|
94
|
-
- img: http://cache-graphicslib.viator.com/graphicslib/thumbs674x446/6279/SITours/3-day-east-coast-and-hualien-tour-from-taipei-in-taipei-164762.jpg
|
95
|
-
title: 3-Day East Coast and Hualien Tour from Taipei
|
96
|
-
content: Experience the breathtaking beauty of Taiwan’s east coast on a 3-day small-group
|
97
|
-
tour from Taipei...
|
98
|
-
location: Taiwan
|
99
|
-
price_currency: "$"
|
100
|
-
price: '395'
|
101
|
-
- img: http://cache-graphicslib.viator.com/graphicslib/thumbs674x446/6279/SITours/3-day-taroko-gorge-adventure-from-taipei-hiking-night-market-and-in-taipei-159737.jpg
|
102
|
-
title: '3-Day Taroko Gorge Adventure from Taipei: Hiking, Night Market and Shrimp
|
103
|
-
Fishing'
|
104
|
-
content: Experience the breathtaking beauty of Taroko Gorge, including guided day
|
105
|
-
hikes along the Shakadang Trail and the steep Jhuilu Old Trail...
|
106
|
-
location: Taiwan
|
107
|
-
price_currency: "$"
|
108
|
-
price: '395'
|
109
|
-
- img: http://cache-graphicslib.viator.com/graphicslib/thumbs674x446/7326/SITours/taiwan-5-day-cycling-escapade-tour-in-taipei-201712.jpg
|
110
|
-
title: Taiwan 5-Day Cycling Escapade Tour
|
111
|
-
content: What better way to explore Taiwan than on a stimulating bicycle ride? Join
|
112
|
-
us on this exuberant journey as we guide you along the beautiful terrains of the
|
113
|
-
eastern coastline...
|
114
|
-
location: Taiwan
|
115
|
-
price_currency: "$"
|
116
|
-
price: '2990'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lonely_planet_tours
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bayardo Salgado
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2015-
|
14
|
+
date: 2015-11-18 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: minitest
|
@@ -108,6 +108,8 @@ files:
|
|
108
108
|
- lib/lonelyplanet_scrap_test.rb
|
109
109
|
- lonely_planet_tours.gemspec
|
110
110
|
- spec/fixtures/vcr_cassettes/taiwan_tours.yml
|
111
|
+
- spec/fixtures/vcr_cassettes/taiwan_tours_full.yml
|
112
|
+
- spec/fixtures/vcr_cassettes/taiwan_tours_json.yml
|
111
113
|
- spec/lonelyplanet_spec.rb
|
112
114
|
- spec/support/vcr_setup.rb
|
113
115
|
- spec/tours.yml
|
@@ -138,6 +140,8 @@ summary: The lonelyplanet web scraper service traverses details of tour packages
|
|
138
140
|
on specified country
|
139
141
|
test_files:
|
140
142
|
- spec/fixtures/vcr_cassettes/taiwan_tours.yml
|
143
|
+
- spec/fixtures/vcr_cassettes/taiwan_tours_full.yml
|
144
|
+
- spec/fixtures/vcr_cassettes/taiwan_tours_json.yml
|
141
145
|
- spec/lonelyplanet_spec.rb
|
142
146
|
- spec/support/vcr_setup.rb
|
143
147
|
- spec/tours.yml
|