mock_search 0.7 → 0.8
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 +8 -8
- data/lib/mock_search.rb +42 -41
- data/lib/mock_search/mock_search_multipledestinations.rb +61 -59
- data/lib/mock_search/mock_search_oneway.rb +64 -62
- data/lib/mock_search/mock_search_roundtrip.rb +72 -70
- data/mock_search.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YmU3YjY3MWIxNmY4NjU2YjdiODIzYzdhNGE0Y2Y5MjczMWJiMjE5NA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MTY3MmY2MjVhYTRlMjQxMWVhNjI0ZWQ0ZjAzOGQ4MzJmYjcwYzIzMQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YzIwYjM2N2RjNjNhNzM1NTFjYWJlNjBlNWZmMTZmMmVlM2FkNTNiYTgyMjQx
|
10
|
+
YzZkYzg4YTIzNDRmYmZiNzU3OWIyZWRhYzU5NjdkODY5MGIwYmMxZWYzMTgz
|
11
|
+
NThjM2UwZDI4MjUzZTc4OWQwM2FhMDk4NjhjOTUzZTA5YjIzNzc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZWVjNjIzMWNhNTQ5N2NmNWJmNTVkZTViNmY0ZmJjOGUxZDMyMjZlZjRiNTBm
|
14
|
+
ZDk5YzBmNTA1OWZhNjIxMDAzNTZjZGFkN2Y4N2JiNTgwNzU0ZTU1YjZkOTI4
|
15
|
+
NjZkYTEzMDRmZjYwMTQ4ZTY5MmQ3MWZiNzk5YjYyY2UyMDQ1NjA=
|
data/lib/mock_search.rb
CHANGED
@@ -1,50 +1,51 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
require_relative 'mock_city'
|
3
3
|
|
4
|
+
module Mock
|
5
|
+
class Search
|
4
6
|
|
5
|
-
|
7
|
+
attr_reader :adt, :cnn, :inf, :host, :cabotage
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
@host = generar_host(site,env)
|
12
|
-
@cabotage = (cabotage=='true')
|
13
|
-
end
|
14
|
-
|
15
|
-
def generar_host(site,env)
|
16
|
-
host = YAML.load(File.open("features/data/host.yml"))
|
17
|
-
return host[site][env]
|
18
|
-
end
|
19
|
-
|
20
|
-
def passengers()
|
21
|
-
@adt = [1,2,3][rand(3)]
|
22
|
-
@cnn = [0,1,2][rand(@adt)]
|
23
|
-
@inf = [0,1,2][rand(@adt-@cnn)]
|
24
|
-
return "#{@adt}/#{@cnn}/#{@inf}"
|
25
|
-
end
|
26
|
-
|
27
|
-
def to_city_change(site)
|
28
|
-
unless site == @site
|
29
|
-
@to_city = MockCity.new(site)
|
30
|
-
@path = @path.gsub(/^...\/...\//,"#{@from_city.code}/#{@to_city.code}/")
|
9
|
+
def create(site,env,cabotage)
|
10
|
+
@site = site
|
11
|
+
@host = generar_host(site,env)
|
12
|
+
@cabotage = (cabotage=='true')
|
31
13
|
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def generate_post_alert_url()
|
35
|
-
return @host + "/subscriptions-ui/subscriptions/price-alert-by-month/add"
|
36
|
-
end
|
37
|
-
|
38
|
-
def get_childrens
|
39
|
-
@cnn + @inf
|
40
|
-
end
|
41
14
|
|
42
|
-
|
43
|
-
|
44
|
-
|
15
|
+
def generar_host(site,env)
|
16
|
+
host = YAML.load(File.open("features/data/host.yml"))
|
17
|
+
return host[site][env]
|
18
|
+
end
|
19
|
+
|
20
|
+
def passengers()
|
21
|
+
@adt = [1,2,3][rand(3)]
|
22
|
+
@cnn = [0,1,2][rand(@adt)]
|
23
|
+
@inf = [0,1,2][rand(@adt-@cnn)]
|
24
|
+
return "#{@adt}/#{@cnn}/#{@inf}"
|
25
|
+
end
|
26
|
+
|
27
|
+
def to_city_change(site)
|
28
|
+
unless site == @site
|
29
|
+
@to_city = MockCity.new(site)
|
30
|
+
@path = @path.gsub(/^...\/...\//,"#{@from_city.code}/#{@to_city.code}/")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def generate_post_alert_url()
|
35
|
+
return @host + "/subscriptions-ui/subscriptions/price-alert-by-month/add"
|
36
|
+
end
|
37
|
+
|
38
|
+
def get_childrens
|
39
|
+
@cnn + @inf
|
40
|
+
end
|
41
|
+
|
42
|
+
def set_from_city(code)
|
43
|
+
@city_from_1 = MockCity.new(@site,code)
|
44
|
+
end
|
45
|
+
|
46
|
+
def set_to_city(code)
|
47
|
+
@city_to_1 = MockCity.new(@site,code)
|
48
|
+
end
|
45
49
|
|
46
|
-
def set_to_city(code)
|
47
|
-
@city_to_1 = MockCity.new(@site,code)
|
48
50
|
end
|
49
|
-
|
50
|
-
end
|
51
|
+
end
|
@@ -1,62 +1,64 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
end
|
48
|
-
|
49
|
-
def generate_search_url_for_country(site_country)
|
50
|
-
to_city_change(site_country)
|
1
|
+
module Mock
|
2
|
+
class SearchMultipledestinations < Search
|
3
|
+
|
4
|
+
attr_reader :city_from_1, :city_from_2, :city_from_3, :city_to_1, :city_to_2, :city_to_3, :date_from_1, :date_from_2, :date_from_3, :description, :path
|
5
|
+
|
6
|
+
def initialize(site,env,cabotage)
|
7
|
+
super(site,env,cabotage)
|
8
|
+
@city_from_1 = MockCity.new(@site,"CCS")
|
9
|
+
@city_to_1 = MockCity.new(@site,"BUE")
|
10
|
+
@city_from_2 = @city_to_1
|
11
|
+
@city_to_2 = MockCity.new(@site,"RIO")
|
12
|
+
@city_from_3 = @city_to_2
|
13
|
+
@city_to_3 = @city_from_1
|
14
|
+
@date_from_1 = Date.today+60
|
15
|
+
@date_from_2 = Date.today+68
|
16
|
+
@date_from_3 = Date.today+75
|
17
|
+
@description = "multipledestinations"
|
18
|
+
@path = "#{@city_from_1.code},#{@city_from_2.code},#{@city_from_3.code}/#{@city_to_1.code},#{@city_to_2.code},#{@city_to_3.code}/#{@date_from_1},#{@date_from_2},#{@date_from_3}/#{passengers}"
|
19
|
+
end
|
20
|
+
|
21
|
+
def generate_search_url()
|
22
|
+
return @host + "/shop/flights/results/multipledestinations/" + @path
|
23
|
+
end
|
24
|
+
|
25
|
+
def advanced_bussinnes
|
26
|
+
return ""
|
27
|
+
end
|
28
|
+
|
29
|
+
def generate_query_string_search_url()
|
30
|
+
return @host + "/shop/flights/search/multipledestinations/" + @path + "?param1=1"
|
31
|
+
end
|
32
|
+
|
33
|
+
def generate_airports_disambiguation_search_url(city)
|
34
|
+
@path = "#{@city_from_1.code},#{city},#{@city_from_3.code}/#{city},#{@city_to_2.code},#{@city_to_3.code}/#{@date_from_1},#{@date_from_2},#{@date_from_3}/#{passengers}"
|
35
|
+
return @host + "/shop/flights/disambiguation/airports/multipledestinations/" + @path
|
36
|
+
end
|
37
|
+
|
38
|
+
def generate_city_disambiguation_search_url()
|
39
|
+
return @host + "/shop/flights/search/multipledestinations/" + @path.gsub(/(\D{3}),(\D{3}),(\D{3})\/(\D{3}),(\D{3}),(\D{3})\//,"___,___,___/___,___,___/") + "?toDescriptions=test1,test2,test3&fromDescriptions=test4,test5,test6"
|
40
|
+
end
|
41
|
+
|
42
|
+
def generate_anticipated_search_url()
|
43
|
+
return @host + "/shop/flights/test/data/search/begin/multipledestinations/" + @path
|
44
|
+
end
|
45
|
+
|
46
|
+
def generate_search_url_for_cabotage()
|
51
47
|
return @host + "/shop/flights/results/multipledestinations/" + @path
|
52
|
-
|
48
|
+
end
|
49
|
+
|
50
|
+
def generate_search_url_for_country(site_country)
|
51
|
+
to_city_change(site_country)
|
52
|
+
return @host + "/shop/flights/results/multipledestinations/" + @path
|
53
|
+
end
|
53
54
|
|
54
|
-
|
55
|
-
|
56
|
-
|
55
|
+
def get_indec_airlines(env)
|
56
|
+
return []
|
57
|
+
end
|
57
58
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
end
|
59
|
+
def to_city_description()
|
60
|
+
return "#{@city_to_1},#{@city_to_2},#{@city_to_3}"
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
end
|
@@ -1,62 +1,64 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
1
|
+
module Mock
|
2
|
+
class SearchOneway < Search
|
3
|
+
attr_reader :city_from_1, :city_to_1, :date_from_1, :description, :path
|
4
|
+
|
5
|
+
def initialize(site,env,cabotage)
|
6
|
+
super(site,env,cabotage)
|
7
|
+
@city_from_1 = MockCity.new(@site)
|
8
|
+
@city_to_1 = @city_from_1.generate_to_city(@cabotage)
|
9
|
+
@date_from_1 = Date.today + 60 + rand(15)
|
10
|
+
@description = "oneway"
|
11
|
+
@path = "#{@city_from_1.code}/#{@city_to_1.code}/#{@date_from_1}/#{passengers}"
|
12
|
+
end
|
13
|
+
|
14
|
+
def generate_search_url()
|
15
|
+
return @host + "/shop/flights/results/oneway/" + @path
|
16
|
+
end
|
17
|
+
|
18
|
+
def advanced_bussinnes
|
19
|
+
return "/NA/C/NA/NA"
|
20
|
+
end
|
21
|
+
|
22
|
+
def generate_query_string_search_url()
|
23
|
+
return @host + "/shop/flights/search/oneway/" + @path + "?param1=1"
|
24
|
+
end
|
25
|
+
|
26
|
+
def generate_airports_disambiguation_search_url(city)
|
27
|
+
@path = "#{@city_from_1.code}/#{city}/#{@date_from_1}/#{passengers}"
|
28
|
+
return @host + "/shop/flights/disambiguation/airports/oneway/" + @path
|
29
|
+
end
|
30
|
+
|
31
|
+
def generate_city_disambiguation_search_url()
|
32
|
+
return @host + "/shop/flights/search/oneway/" + @path.gsub(/(\D{3})\/(\D{3})\//,"___/___/") + "?toDescriptions=test1&fromDescriptions=test2"
|
33
|
+
end
|
34
|
+
|
35
|
+
def generate_anticipated_search_url()
|
36
|
+
return @host + "/shop/flights/test/data/search/begin/oneway/" + @path
|
37
|
+
end
|
38
|
+
|
39
|
+
def generate_search_url_for_cabotage()
|
40
|
+
return @host + "/shop/flights/results/oneway/" + @path
|
41
|
+
end
|
42
|
+
|
43
|
+
def generate_search_url_for_country(site_country)
|
44
|
+
to_city_change(site_country)
|
45
|
+
return @host + "/shop/flights/results/oneway/" + @path
|
46
|
+
end
|
47
|
+
|
48
|
+
def get_indec_airlines(env)
|
49
|
+
servers = {
|
50
|
+
"rc"=>"http://lb.despegar.it/",
|
51
|
+
"beta"=>"http://backoffice.despegar.com/",
|
52
|
+
"produccion"=>"http://backoffice.despegar.com/"
|
53
|
+
}
|
54
|
+
puts "#{servers[env.downcase]}indec/airlines/byroute/#{@site}/#{@city_from_1.code}/#{@city_to_1.code}"
|
55
|
+
respond = HTTParty.get("#{servers[env.downcase]}indec/airlines/byroute/#{@site}/#{@city_from_1.code}/#{@city_to_1.code}")
|
56
|
+
return respond
|
57
|
+
end
|
58
|
+
|
59
|
+
def to_city_description()
|
60
|
+
return @city_to_1.name.no_accents
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
end
|
@@ -1,86 +1,88 @@
|
|
1
|
-
|
1
|
+
module Mock
|
2
|
+
class SearchRoundtrip < Search
|
2
3
|
|
3
|
-
|
4
|
+
attr_reader :city_from_1, :city_to_1, :date_from_1, :date_to_1, :description, :path
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
def generate_search_url()
|
16
|
-
return @host + "/shop/flights/results/roundtrip/" + @path
|
17
|
-
end
|
18
|
-
|
19
|
-
def advanced_bussinnes
|
20
|
-
return "/NA/NA/C/NA/NA"
|
21
|
-
end
|
22
|
-
|
23
|
-
def generate_query_string_search_url()
|
24
|
-
return @host + "/shop/flights/search/roundtrip/" + @path + "?param1=1"
|
25
|
-
end
|
6
|
+
def initialize(site,env,cabotage)
|
7
|
+
super(site,env,cabotage)
|
8
|
+
@city_from_1 = MockCity.new(@site)
|
9
|
+
@city_to_1 = @city_from_1.generate_to_city(@cabotage)
|
10
|
+
@date_from_1 = Date.today + 60 + rand(15)
|
11
|
+
@date_to_1 = @date_from_1 + rand(15)
|
12
|
+
@description = "roundtrip"
|
13
|
+
@path = "#{@city_from_1.code}/#{@city_to_1.code}/#{@date_from_1}/#{@date_to_1}/#{passengers}"
|
14
|
+
end
|
26
15
|
|
27
|
-
def
|
28
|
-
|
29
|
-
return @host + "/shop/flights/disambiguation/airports/roundtrip/" + @path
|
16
|
+
def generate_search_url()
|
17
|
+
return @host + "/shop/flights/results/roundtrip/" + @path
|
30
18
|
end
|
31
19
|
|
32
|
-
def
|
33
|
-
|
34
|
-
|
20
|
+
def advanced_bussinnes
|
21
|
+
return "/NA/NA/C/NA/NA"
|
22
|
+
end
|
35
23
|
|
36
|
-
def
|
37
|
-
|
24
|
+
def generate_query_string_search_url()
|
25
|
+
return @host + "/shop/flights/search/roundtrip/" + @path + "?param1=1"
|
38
26
|
end
|
27
|
+
|
28
|
+
def generate_airports_disambiguation_search_url(city)
|
29
|
+
@path = "#{@city_from_1.code}/#{city}/#{@date_from_1}/#{@date_to_1}/#{passengers}"
|
30
|
+
return @host + "/shop/flights/disambiguation/airports/roundtrip/" + @path
|
31
|
+
end
|
39
32
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
def generate_search_url_for_country(site_country)
|
45
|
-
to_city_change(site_country)
|
46
|
-
return @host + "/shop/flights/results/roundtrip/" + @path
|
47
|
-
end
|
48
|
-
|
49
|
-
def generate_results_landing(dep,ret)
|
50
|
-
landing = (@site == "BR" ? "/passagens-aereas" : "/vuelos")
|
51
|
-
return @host + landing + "/#{dep}/#{ret}"
|
52
|
-
end
|
33
|
+
def generate_city_disambiguation_search_url()
|
34
|
+
return @host + "/shop/flights/search/roundtrip/" + @path.gsub(/(\D{3})\/(\D{3})\//,"___/___/") + "?toDescriptions=test1&fromDescriptions=test2"
|
35
|
+
end
|
53
36
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
end
|
37
|
+
def generate_anticipated_search_url()
|
38
|
+
return @host + "/shop/flights/test/data/search/begin/roundtrip/" + @path
|
39
|
+
end
|
58
40
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
"beta"=>"http://backoffice.despegar.com/",
|
63
|
-
"produccion"=>"http://backoffice.despegar.com/"
|
64
|
-
}
|
65
|
-
puts "#{servers[env.downcase]}indec/airlines/byroute/#{@site}/#{@city_from_1.code}/#{@city_to_1.code}"
|
66
|
-
respond = HTTParty.get("#{servers[env.downcase]}indec/airlines/byroute/#{@site}/#{@city_from_1.code}/#{@city_to_1.code}")
|
67
|
-
return respond
|
68
|
-
end
|
41
|
+
def generate_search_url_for_cabotage()
|
42
|
+
return @host + "/shop/flights/results/roundtrip/" + @path
|
43
|
+
end
|
69
44
|
|
70
|
-
def
|
71
|
-
|
45
|
+
def generate_search_url_for_country(site_country)
|
46
|
+
to_city_change(site_country)
|
47
|
+
return @host + "/shop/flights/results/roundtrip/" + @path
|
72
48
|
end
|
73
49
|
|
74
|
-
def
|
75
|
-
|
76
|
-
|
77
|
-
@path = "#{@city_from_1.code}/#{@city_to_1.code}/#{@date_from_1}/#{@date_to_1}/#{passengers}"
|
50
|
+
def generate_results_landing(dep,ret)
|
51
|
+
landing = (@site == "BR" ? "/passagens-aereas" : "/vuelos")
|
52
|
+
return @host + landing + "/#{dep}/#{ret}"
|
78
53
|
end
|
79
54
|
|
80
|
-
def
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
55
|
+
def generate_home_landing()
|
56
|
+
landing = (@site == "BR" ? "/passagens-aereas" : "/vuelos")
|
57
|
+
return @host + landing
|
58
|
+
end
|
59
|
+
|
60
|
+
def get_indec_airlines(env)
|
61
|
+
servers = {
|
62
|
+
"rc"=>"http://lb.despegar.it/",
|
63
|
+
"beta"=>"http://backoffice.despegar.com/",
|
64
|
+
"produccion"=>"http://backoffice.despegar.com/"
|
65
|
+
}
|
66
|
+
puts "#{servers[env.downcase]}indec/airlines/byroute/#{@site}/#{@city_from_1.code}/#{@city_to_1.code}"
|
67
|
+
respond = HTTParty.get("#{servers[env.downcase]}indec/airlines/byroute/#{@site}/#{@city_from_1.code}/#{@city_to_1.code}")
|
68
|
+
return respond
|
69
|
+
end
|
70
|
+
|
71
|
+
def to_city_description()
|
72
|
+
return @city_to_1.name.no_accents
|
73
|
+
end
|
74
|
+
|
75
|
+
def add_day_to_search()
|
76
|
+
@date_from_1 = @date_from_1 + 1
|
77
|
+
@date_to_1 = @date_to_1 + 1
|
78
|
+
@path = "#{@city_from_1.code}/#{@city_to_1.code}/#{@date_from_1}/#{@date_to_1}/#{passengers}"
|
79
|
+
end
|
80
|
+
|
81
|
+
def set_new_date(date_from,date_to)
|
82
|
+
@date_from_1 = date_from
|
83
|
+
@date_to_1 = date_to
|
84
|
+
@path = "#{@city_from_1.code}/#{@city_to_1.code}/#{@date_from_1}/#{@date_to_1}/#{passengers}"
|
85
|
+
end
|
85
86
|
|
86
|
-
end
|
87
|
+
end
|
88
|
+
end
|
data/mock_search.gemspec
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
|
16
16
|
gem.require_paths = ["lib"] #Usualmente es solo lib -> ["lib"]
|
17
17
|
|
18
|
-
gem.version = '0.
|
18
|
+
gem.version = '0.8' #La version se debe incrementar cada vez que se desea publicar una nueva version del test.
|
19
19
|
|
20
20
|
gem.add_development_dependency('geminabox')
|
21
21
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mock_search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.8'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lgonzalez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: geminabox
|