mock_search 0.9 → 0.10
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/mock_search_multipledestinations.rb +59 -65
- data/lib/mock_search/mock_search_oneway.rb +62 -68
- data/lib/mock_search/mock_search_roundtrip.rb +74 -80
- data/lib/mock_search.rb +46 -43
- data/mock_search.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
!binary "U0hBMQ==":
|
|
3
3
|
metadata.gz: !binary |-
|
|
4
|
-
|
|
4
|
+
MDFlNDJhYTVkNzA0ZDM1MGIyMDQ0NTY5MDBhMTQxOWRjODQ1NmE0Mg==
|
|
5
5
|
data.tar.gz: !binary |-
|
|
6
|
-
|
|
6
|
+
YTE2ZDc3OTc0MzkwNzEzNWQyZDg3NzU1Yzc2NTI0OGRlNDEwYzJhNw==
|
|
7
7
|
SHA512:
|
|
8
8
|
metadata.gz: !binary |-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
YWQ2Y2I3NWQxMTM2OTc5ZDFmYzhlZTUzZWEyOTBlNWE4NWViNmI5ODIyODg1
|
|
10
|
+
Njg0NzNkY2FmMWVmYzQxNGI5N2E0MDI4MGNhYzQ1ZmI2NjZkZDI5NzFmNzg2
|
|
11
|
+
NWRjZTQ5ODg2MGZkMGI5ZmFmMTcwYTYxMjMyNWQxOTIzYTk2YTc=
|
|
12
12
|
data.tar.gz: !binary |-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
YTQ5NDJmOWQ4Yzk4NGRlM2Y5Nzg2NDhkZTU5MTgxZDg5NzQ2MjE1YjFlNzdm
|
|
14
|
+
YzhhMDFlMDUxNDhmZmZmODg3MGVhZmQwODRiYjViNThkN2Y1OWM1OGYwMWFh
|
|
15
|
+
ZWU2OTY1NDM4MjYyMTBkMDIxYzU4MWU1N2EwZjg2MmRlNmUxMzM=
|
|
@@ -1,68 +1,62 @@
|
|
|
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
|
-
|
|
1
|
+
class MockSearchMultipledestinations < Search
|
|
2
|
+
|
|
3
|
+
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
|
|
4
|
+
|
|
5
|
+
def initialize(site,env,cabotage)
|
|
6
|
+
super(site,env,cabotage)
|
|
7
|
+
@city_from_1 = MockCity.new(@site,"CCS")
|
|
8
|
+
@city_to_1 = MockCity.new(@site,"BUE")
|
|
9
|
+
@city_from_2 = @city_to_1
|
|
10
|
+
@city_to_2 = MockCity.new(@site,"RIO")
|
|
11
|
+
@city_from_3 = @city_to_2
|
|
12
|
+
@city_to_3 = @city_from_1
|
|
13
|
+
@date_from_1 = Date.today+60
|
|
14
|
+
@date_from_2 = Date.today+68
|
|
15
|
+
@date_from_3 = Date.today+75
|
|
16
|
+
@description = "multipledestinations"
|
|
17
|
+
@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}"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def generate_search_url()
|
|
21
|
+
return @host + "/shop/flights/results/multipledestinations/" + @path
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def advanced_bussinnes
|
|
25
|
+
return ""
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def generate_query_string_search_url()
|
|
29
|
+
return @host + "/shop/flights/search/multipledestinations/" + @path + "?param1=1"
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def generate_airports_disambiguation_search_url(city)
|
|
33
|
+
@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}"
|
|
34
|
+
return @host + "/shop/flights/disambiguation/airports/multipledestinations/" + @path
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def generate_city_disambiguation_search_url()
|
|
38
|
+
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"
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def generate_anticipated_search_url()
|
|
42
|
+
return @host + "/shop/flights/test/data/search/begin/multipledestinations/" + @path
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def generate_search_url_for_cabotage()
|
|
46
|
+
return @host + "/shop/flights/results/multipledestinations/" + @path
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def generate_search_url_for_country(site_country)
|
|
50
|
+
to_city_change(site_country)
|
|
51
51
|
return @host + "/shop/flights/results/multipledestinations/" + @path
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
def generate_search_url_for_country(site_country)
|
|
55
|
-
to_city_change(site_country)
|
|
56
|
-
return @host + "/shop/flights/results/multipledestinations/" + @path
|
|
57
|
-
end
|
|
52
|
+
end
|
|
58
53
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
54
|
+
def get_indec_airlines(env)
|
|
55
|
+
return []
|
|
56
|
+
end
|
|
62
57
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
end
|
|
58
|
+
def to_city_description()
|
|
59
|
+
return "#{@city_to_1},#{@city_to_2},#{@city_to_3}"
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
end
|
|
@@ -1,69 +1,63 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
class MockSearchOneway < Search
|
|
2
|
+
|
|
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
|
|
3
13
|
|
|
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
|
-
servers = {
|
|
55
|
-
"rc"=>"http://lb.despegar.it/",
|
|
56
|
-
"beta"=>"http://backoffice.despegar.com/",
|
|
57
|
-
"produccion"=>"http://backoffice.despegar.com/"
|
|
58
|
-
}
|
|
59
|
-
puts "#{servers[env.downcase]}indec/airlines/byroute/#{@site}/#{@city_from_1.code}/#{@city_to_1.code}"
|
|
60
|
-
respond = HTTParty.get("#{servers[env.downcase]}indec/airlines/byroute/#{@site}/#{@city_from_1.code}/#{@city_to_1.code}")
|
|
61
|
-
return respond
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
def to_city_description()
|
|
65
|
-
return @city_to_1.name.no_accents
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
end
|
|
69
|
-
end
|
|
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
|
|
@@ -1,92 +1,86 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
class MockSearchRoundtrip < Search
|
|
2
|
+
|
|
3
|
+
attr_reader :city_from_1, :city_to_1, :date_from_1, :date_to_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
|
+
@date_to_1 = @date_from_1 + rand(15)
|
|
11
|
+
@description = "roundtrip"
|
|
12
|
+
@path = "#{@city_from_1.code}/#{@city_to_1.code}/#{@date_from_1}/#{@date_to_1}/#{passengers}"
|
|
13
|
+
end
|
|
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
|
|
19
26
|
|
|
20
|
-
def
|
|
21
|
-
|
|
27
|
+
def generate_airports_disambiguation_search_url(city)
|
|
28
|
+
@path = "#{@city_from_1.code}/#{city}/#{@date_from_1}/#{@date_to_1}/#{passengers}"
|
|
29
|
+
return @host + "/shop/flights/disambiguation/airports/roundtrip/" + @path
|
|
22
30
|
end
|
|
23
31
|
|
|
24
|
-
def
|
|
25
|
-
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def generate_query_string_search_url()
|
|
29
|
-
return @host + "/shop/flights/search/roundtrip/" + @path + "?param1=1"
|
|
32
|
+
def generate_city_disambiguation_search_url()
|
|
33
|
+
return @host + "/shop/flights/search/roundtrip/" + @path.gsub(/(\D{3})\/(\D{3})\//,"___/___/") + "?toDescriptions=test1&fromDescriptions=test2"
|
|
30
34
|
end
|
|
31
|
-
|
|
32
|
-
def generate_airports_disambiguation_search_url(city)
|
|
33
|
-
@path = "#{@city_from_1.code}/#{city}/#{@date_from_1}/#{@date_to_1}/#{passengers}"
|
|
34
|
-
return @host + "/shop/flights/disambiguation/airports/roundtrip/" + @path
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def generate_city_disambiguation_search_url()
|
|
38
|
-
return @host + "/shop/flights/search/roundtrip/" + @path.gsub(/(\D{3})\/(\D{3})\//,"___/___/") + "?toDescriptions=test1&fromDescriptions=test2"
|
|
39
|
-
end
|
|
40
35
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def generate_search_url_for_cabotage()
|
|
46
|
-
return @host + "/shop/flights/results/roundtrip/" + @path
|
|
36
|
+
def generate_anticipated_search_url()
|
|
37
|
+
return @host + "/shop/flights/test/data/search/begin/roundtrip/" + @path
|
|
47
38
|
end
|
|
48
39
|
|
|
49
|
-
def
|
|
50
|
-
|
|
51
|
-
|
|
40
|
+
def generate_search_url_for_cabotage()
|
|
41
|
+
return @host + "/shop/flights/results/roundtrip/" + @path
|
|
42
|
+
end
|
|
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
|
|
53
|
+
|
|
54
|
+
def generate_home_landing()
|
|
55
|
+
landing = (@site == "BR" ? "/passagens-aereas" : "/vuelos")
|
|
56
|
+
return @host + landing
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def get_indec_airlines(env)
|
|
60
|
+
servers = {
|
|
61
|
+
"rc"=>"http://lb.despegar.it/",
|
|
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
|
|
69
|
+
|
|
70
|
+
def to_city_description()
|
|
71
|
+
return @city_to_1.name.no_accents
|
|
52
72
|
end
|
|
53
73
|
|
|
54
|
-
def
|
|
55
|
-
|
|
56
|
-
|
|
74
|
+
def add_day_to_search()
|
|
75
|
+
@date_from_1 = @date_from_1 + 1
|
|
76
|
+
@date_to_1 = @date_to_1 + 1
|
|
77
|
+
@path = "#{@city_from_1.code}/#{@city_to_1.code}/#{@date_from_1}/#{@date_to_1}/#{passengers}"
|
|
57
78
|
end
|
|
58
79
|
|
|
59
|
-
def
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
def get_indec_airlines(env)
|
|
65
|
-
servers = {
|
|
66
|
-
"rc"=>"http://lb.despegar.it/",
|
|
67
|
-
"beta"=>"http://backoffice.despegar.com/",
|
|
68
|
-
"produccion"=>"http://backoffice.despegar.com/"
|
|
69
|
-
}
|
|
70
|
-
puts "#{servers[env.downcase]}indec/airlines/byroute/#{@site}/#{@city_from_1.code}/#{@city_to_1.code}"
|
|
71
|
-
respond = HTTParty.get("#{servers[env.downcase]}indec/airlines/byroute/#{@site}/#{@city_from_1.code}/#{@city_to_1.code}")
|
|
72
|
-
return respond
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
def to_city_description()
|
|
76
|
-
return @city_to_1.name.no_accents
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
def add_day_to_search()
|
|
80
|
-
@date_from_1 = @date_from_1 + 1
|
|
81
|
-
@date_to_1 = @date_to_1 + 1
|
|
82
|
-
@path = "#{@city_from_1.code}/#{@city_to_1.code}/#{@date_from_1}/#{@date_to_1}/#{passengers}"
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
def set_new_date(date_from,date_to)
|
|
86
|
-
@date_from_1 = date_from
|
|
87
|
-
@date_to_1 = date_to
|
|
88
|
-
@path = "#{@city_from_1.code}/#{@city_to_1.code}/#{@date_from_1}/#{@date_to_1}/#{passengers}"
|
|
89
|
-
end
|
|
80
|
+
def set_new_date(date_from,date_to)
|
|
81
|
+
@date_from_1 = date_from
|
|
82
|
+
@date_to_1 = date_to
|
|
83
|
+
@path = "#{@city_from_1.code}/#{@city_to_1.code}/#{@date_from_1}/#{@date_to_1}/#{passengers}"
|
|
84
|
+
end
|
|
90
85
|
|
|
91
|
-
|
|
92
|
-
end
|
|
86
|
+
end
|
data/lib/mock_search.rb
CHANGED
|
@@ -1,49 +1,52 @@
|
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
|
2
2
|
require_relative 'mock_city'
|
|
3
|
+
require_relative 'mock_search/mock_search_oneway'
|
|
4
|
+
require_relative 'mock_search/mock_search_multipledestinations'
|
|
5
|
+
require_relative 'mock_search/mock_search_roundtrip'
|
|
6
|
+
|
|
7
|
+
class Search
|
|
8
|
+
|
|
9
|
+
attr_reader :adt, :cnn, :inf, :host, :cabotage
|
|
10
|
+
|
|
11
|
+
def initialize(type)
|
|
12
|
+
@site = site
|
|
13
|
+
@host = generar_host(site,env)
|
|
14
|
+
@cabotage = (cabotage=='true')
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def generar_host(site,env)
|
|
18
|
+
host = YAML.load(File.open("features/data/host.yml"))
|
|
19
|
+
return host[site][env]
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def passengers()
|
|
23
|
+
@adt = [1,2,3][rand(3)]
|
|
24
|
+
@cnn = [0,1,2][rand(@adt)]
|
|
25
|
+
@inf = [0,1,2][rand(@adt-@cnn)]
|
|
26
|
+
return "#{@adt}/#{@cnn}/#{@inf}"
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def to_city_change(site)
|
|
30
|
+
unless site == @site
|
|
31
|
+
@to_city = MockCity.new(site)
|
|
32
|
+
@path = @path.gsub(/^...\/...\//,"#{@from_city.code}/#{@to_city.code}/")
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def generate_post_alert_url()
|
|
37
|
+
return @host + "/subscriptions-ui/subscriptions/price-alert-by-month/add"
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def get_childrens
|
|
41
|
+
@cnn + @inf
|
|
42
|
+
end
|
|
3
43
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
attr_reader :adt, :cnn, :inf, :host, :cabotage
|
|
8
|
-
|
|
9
|
-
def initialize(type,site,env,cabotage)
|
|
10
|
-
@search=Class.const_get("Mock::Search#{type.capitalize}").new(site,env,cabotage)
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def generar_host(site,env)
|
|
14
|
-
host = YAML.load(File.open("features/data/host.yml"))
|
|
15
|
-
return host[site][env]
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def passengers()
|
|
19
|
-
@adt = [1,2,3][rand(3)]
|
|
20
|
-
@cnn = [0,1,2][rand(@adt)]
|
|
21
|
-
@inf = [0,1,2][rand(@adt-@cnn)]
|
|
22
|
-
return "#{@adt}/#{@cnn}/#{@inf}"
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def to_city_change(site)
|
|
26
|
-
unless site == @site
|
|
27
|
-
@to_city = MockCity.new(site)
|
|
28
|
-
@path = @path.gsub(/^...\/...\//,"#{@from_city.code}/#{@to_city.code}/")
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def generate_post_alert_url()
|
|
33
|
-
return @host + "/subscriptions-ui/subscriptions/price-alert-by-month/add"
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def get_childrens
|
|
37
|
-
@cnn + @inf
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def set_from_city(code)
|
|
41
|
-
@city_from_1 = MockCity.new(@site,code)
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def set_to_city(code)
|
|
45
|
-
@city_to_1 = MockCity.new(@site,code)
|
|
46
|
-
end
|
|
44
|
+
def set_from_city(code)
|
|
45
|
+
@city_from_1 = MockCity.new(@site,code)
|
|
46
|
+
end
|
|
47
47
|
|
|
48
|
+
def set_to_city(code)
|
|
49
|
+
@city_to_1 = MockCity.new(@site,code)
|
|
48
50
|
end
|
|
51
|
+
|
|
49
52
|
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.10' #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
|
|