@@ -1,196 +0,0 @@ |
||
1 |
-{ |
|
2 |
- "currency": "USD", |
|
3 |
- "results": [ |
|
4 |
- { |
|
5 |
- "cost": 431.74000000000001, |
|
6 |
- "date": 1372032000, |
|
7 |
- "route": [ |
|
8 |
- "PDX", |
|
9 |
- "DFW", |
|
10 |
- "ORD" |
|
11 |
- ] |
|
12 |
- }, |
|
13 |
- { |
|
14 |
- "cost": 431.74000000000001, |
|
15 |
- "date": 1372118400, |
|
16 |
- "route": [ |
|
17 |
- "PDX", |
|
18 |
- "DFW", |
|
19 |
- "ORD" |
|
20 |
- ] |
|
21 |
- }, |
|
22 |
- { |
|
23 |
- "cost": 341.72000000000003, |
|
24 |
- "date": 1372204800, |
|
25 |
- "route": [ |
|
26 |
- "PDX", |
|
27 |
- "LAS", |
|
28 |
- "ORD" |
|
29 |
- ] |
|
30 |
- }, |
|
31 |
- { |
|
32 |
- "cost": 625.57000000000005, |
|
33 |
- "date": 1372291200, |
|
34 |
- "route": [ |
|
35 |
- "PDX", |
|
36 |
- "LAX", |
|
37 |
- "ORD" |
|
38 |
- ] |
|
39 |
- }, |
|
40 |
- { |
|
41 |
- "cost": 348.14999999999998, |
|
42 |
- "date": 1372377600, |
|
43 |
- "route": [ |
|
44 |
- "PDX", |
|
45 |
- "LAS", |
|
46 |
- "ORD" |
|
47 |
- ] |
|
48 |
- }, |
|
49 |
- { |
|
50 |
- "cost": 306.81, |
|
51 |
- "date": 1372464000, |
|
52 |
- "route": [ |
|
53 |
- "PDX", |
|
54 |
- "LAS", |
|
55 |
- "ORD" |
|
56 |
- ] |
|
57 |
- }, |
|
58 |
- { |
|
59 |
- "cost": 307.73000000000002, |
|
60 |
- "date": 1372550400, |
|
61 |
- "route": [ |
|
62 |
- "PDX", |
|
63 |
- "LAS", |
|
64 |
- "ORD" |
|
65 |
- ] |
|
66 |
- }, |
|
67 |
- { |
|
68 |
- "cost": 257.20999999999998, |
|
69 |
- "date": 1372636800, |
|
70 |
- "route": [ |
|
71 |
- "PDX", |
|
72 |
- "DFW", |
|
73 |
- "ORD" |
|
74 |
- ] |
|
75 |
- }, |
|
76 |
- { |
|
77 |
- "cost": 245.27000000000001, |
|
78 |
- "date": 1372723200, |
|
79 |
- "route": [ |
|
80 |
- "PDX", |
|
81 |
- "LAS", |
|
82 |
- "ORD" |
|
83 |
- ] |
|
84 |
- }, |
|
85 |
- { |
|
86 |
- "cost": 293.02999999999997, |
|
87 |
- "date": 1372809600, |
|
88 |
- "route": [ |
|
89 |
- "PDX", |
|
90 |
- "LAS", |
|
91 |
- "ORD" |
|
92 |
- ] |
|
93 |
- }, |
|
94 |
- { |
|
95 |
- "cost": 194.74000000000001, |
|
96 |
- "date": 1372896000, |
|
97 |
- "route": [ |
|
98 |
- "PDX", |
|
99 |
- "LAS", |
|
100 |
- "ORD" |
|
101 |
- ] |
|
102 |
- }, |
|
103 |
- { |
|
104 |
- "cost": 244.34999999999999, |
|
105 |
- "date": 1372982400, |
|
106 |
- "route": [ |
|
107 |
- "PDX", |
|
108 |
- "LAS", |
|
109 |
- "ORD" |
|
110 |
- ] |
|
111 |
- }, |
|
112 |
- { |
|
113 |
- "cost": 305.88999999999999, |
|
114 |
- "date": 1373068800, |
|
115 |
- "route": [ |
|
116 |
- "PDX", |
|
117 |
- "LAS", |
|
118 |
- "ORD" |
|
119 |
- ] |
|
120 |
- }, |
|
121 |
- { |
|
122 |
- "cost": 306.81, |
|
123 |
- "date": 1373155200, |
|
124 |
- "route": [ |
|
125 |
- "PDX", |
|
126 |
- "LAS", |
|
127 |
- "ORD" |
|
128 |
- ] |
|
129 |
- }, |
|
130 |
- { |
|
131 |
- "cost": 248.94, |
|
132 |
- "date": 1373241600, |
|
133 |
- "route": [ |
|
134 |
- "PDX", |
|
135 |
- "LAS", |
|
136 |
- "ORD" |
|
137 |
- ] |
|
138 |
- }, |
|
139 |
- { |
|
140 |
- "cost": 244.34999999999999, |
|
141 |
- "date": 1373328000, |
|
142 |
- "route": [ |
|
143 |
- "PDX", |
|
144 |
- "LAS", |
|
145 |
- "ORD" |
|
146 |
- ] |
|
147 |
- }, |
|
148 |
- { |
|
149 |
- "cost": 245.27000000000001, |
|
150 |
- "date": 1373414400, |
|
151 |
- "route": [ |
|
152 |
- "PDX", |
|
153 |
- "LAS", |
|
154 |
- "ORD" |
|
155 |
- ] |
|
156 |
- }, |
|
157 |
- { |
|
158 |
- "cost": 277.42000000000002, |
|
159 |
- "date": 1373500800, |
|
160 |
- "route": [ |
|
161 |
- "PDX", |
|
162 |
- "DFW", |
|
163 |
- "ORD" |
|
164 |
- ] |
|
165 |
- }, |
|
166 |
- { |
|
167 |
- "cost": 297.63, |
|
168 |
- "date": 1373587200, |
|
169 |
- "route": [ |
|
170 |
- "PDX", |
|
171 |
- "LAS", |
|
172 |
- "ORD" |
|
173 |
- ] |
|
174 |
- }, |
|
175 |
- { |
|
176 |
- "cost": 209.44, |
|
177 |
- "date": 1373673600, |
|
178 |
- "route": [ |
|
179 |
- "PDX", |
|
180 |
- "LAS", |
|
181 |
- "ORD" |
|
182 |
- ] |
|
183 |
- }, |
|
184 |
- { |
|
185 |
- "cost": 259.95999999999998, |
|
186 |
- "date": 1373760000, |
|
187 |
- "route": [ |
|
188 |
- "PDX", |
|
189 |
- "LAS", |
|
190 |
- "ORD" |
|
191 |
- ] |
|
192 |
- } |
|
193 |
- ], |
|
194 |
- "type": "calendar", |
|
195 |
- "warnings": null |
|
196 |
-} |
@@ -1,19 +0,0 @@ |
||
1 |
-{ |
|
2 |
- "cost_max": null, |
|
3 |
- "currency": "USD", |
|
4 |
- "date_end": 1403740799, |
|
5 |
- "date_start": 1372032000, |
|
6 |
- "dest_codes": [ |
|
7 |
- "CGX", |
|
8 |
- "MDW", |
|
9 |
- "ORD", |
|
10 |
- "GYY" |
|
11 |
- ], |
|
12 |
- "duration_max": null, |
|
13 |
- "origin_codes": [ |
|
14 |
- "PDX", |
|
15 |
- "SLE" |
|
16 |
- ], |
|
17 |
- "search_url": "http://api.adioso.com/v2/search/fares?currency=USD&date_end=1403740799&date_start=1372032000&dest_codes=CGX%2CMDW%2CORD%2CGYY&origin_codes=PDX%2CSLE", |
|
18 |
- "segments_max": null |
|
19 |
-} |
@@ -1,38 +0,0 @@ |
||
1 |
-require 'rails_helper' |
|
2 |
- |
|
3 |
-describe Agents::AdiosoAgent do |
|
4 |
- before do |
|
5 |
- stub_request(:get, /parse/).to_return(:body => File.read(Rails.root.join("spec/data_fixtures/adioso_parse.json")), :status => 200, :headers => {"Content-Type" => "text/json"}) |
|
6 |
- stub_request(:get, /fares/).to_return(:body => File.read(Rails.root.join("spec/data_fixtures/adioso_fare.json")), :status => 200, :headers => {"Content-Type" => "text/json"}) |
|
7 |
- @valid_params = { |
|
8 |
- :start_date => "June 25 2013", |
|
9 |
- :end_date => "July 15 2013", |
|
10 |
- :from => "Portland", |
|
11 |
- :to => "Chicago", |
|
12 |
- :username => "xx", |
|
13 |
- :password => "xx", |
|
14 |
- :expected_update_period_in_days => "2" |
|
15 |
- } |
|
16 |
- |
|
17 |
- @checker = Agents::AdiosoAgent.new(:name => "somename", :options => @valid_params) |
|
18 |
- @checker.user = users(:jane) |
|
19 |
- @checker.save! |
|
20 |
- end |
|
21 |
- |
|
22 |
- describe "#check" do |
|
23 |
- it "should check that initial run creates an event" do |
|
24 |
- expect { @checker.check }.to change { Event.count }.by(1) |
|
25 |
- end |
|
26 |
- end |
|
27 |
- |
|
28 |
- describe "#working?" do |
|
29 |
- it "checks if its generating events as scheduled" do |
|
30 |
- expect(@checker).not_to be_working |
|
31 |
- @checker.check |
|
32 |
- expect(@checker.reload).to be_working |
|
33 |
- three_days_from_now = 3.days.from_now |
|
34 |
- stub(Time).now { three_days_from_now } |
|
35 |
- expect(@checker).not_to be_working |
|
36 |
- end |
|
37 |
- end |
|
38 |
-end |