kalibro_client 0.0.1 → 0.0.2
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/.travis.yml +1 -1
- data/features/kalibro_configuration/all.feature +6 -6
- data/features/kalibro_configuration/creation.feature +5 -5
- data/features/kalibro_configuration/destroy.feature +6 -6
- data/features/kalibro_configuration/metric_configurations.feature +4 -4
- data/features/{range → kalibro_range}/destroy.feature +2 -2
- data/features/{range → kalibro_range}/exists.feature +2 -2
- data/features/{range → kalibro_range}/find.feature +2 -2
- data/features/{range → kalibro_range}/ranges_of.feature +4 -4
- data/features/{range → kalibro_range}/save.feature +2 -2
- data/features/kalibro_range/update.feature +54 -0
- data/features/metric_configuration/creation.feature +2 -2
- data/features/metric_configuration/destroy.feature +2 -2
- data/features/metric_configuration/find.feature +2 -2
- data/features/metric_configuration/metric_configurations_of.feature +8 -8
- data/features/metric_result/descendant_values.feature +2 -2
- data/features/metric_result/history_of.feature +2 -2
- data/features/metric_result/metric_results_of.feature +2 -2
- data/features/module_result/children.feature +2 -2
- data/features/module_result/find.feature +2 -2
- data/features/module_result/history_of.feature +2 -2
- data/features/processing/first_processing_after.feature +2 -2
- data/features/processing/first_processing_of.feature +2 -2
- data/features/processing/has_processing.feature +2 -2
- data/features/processing/has_processing_after.feature +2 -2
- data/features/processing/has_processing_before.feature +2 -2
- data/features/processing/has_ready_processing.feature +2 -2
- data/features/processing/last_processing_before.feature +2 -2
- data/features/processing/last_processing_of.feature +2 -2
- data/features/processing/last_processing_state_of.feature +2 -2
- data/features/processing/last_ready_processing_of.feature +2 -2
- data/features/processing/processing_of.feature +4 -4
- data/features/processing/processing_with_date_of.feature +4 -4
- data/features/project/update.feature +13 -0
- data/features/repository/all.feature +1 -1
- data/features/repository/cancel_processing.feature +1 -1
- data/features/repository/destroy.feature +1 -1
- data/features/repository/exists.feature +1 -1
- data/features/repository/find.feature +1 -1
- data/features/repository/of.feature +1 -1
- data/features/repository/process.feature +2 -2
- data/features/step_definitions/kalibro_configuration_steps.rb +40 -0
- data/features/step_definitions/metric_configuration_steps.rb +9 -9
- data/features/step_definitions/module_result_steps.rb +1 -1
- data/features/step_definitions/project_steps.rb +12 -0
- data/features/step_definitions/range_steps.rb +25 -1
- data/features/step_definitions/reading_steps.rb +1 -1
- data/features/step_definitions/repository_steps.rb +1 -1
- data/lib/kalibro_client/entities/base.rb +53 -19
- data/lib/kalibro_client/entities/configurations/base.rb +4 -1
- data/lib/kalibro_client/entities/configurations/kalibro_configuration.rb +1 -1
- data/lib/kalibro_client/entities/configurations/kalibro_range.rb +8 -8
- data/lib/kalibro_client/entities/configurations/metric_configuration.rb +7 -5
- data/lib/kalibro_client/entities/configurations/reading.rb +4 -4
- data/lib/kalibro_client/entities/configurations/reading_group.rb +4 -0
- data/lib/kalibro_client/entities/processor/base.rb +2 -1
- data/lib/kalibro_client/entities/processor/kalibro_module.rb +1 -0
- data/lib/kalibro_client/entities/processor/metric_collector_details.rb +7 -2
- data/lib/kalibro_client/entities/processor/metric_result.rb +9 -10
- data/lib/kalibro_client/entities/processor/module_result.rb +10 -2
- data/lib/kalibro_client/entities/processor/processing.rb +26 -10
- data/lib/kalibro_client/entities/processor/project.rb +4 -0
- data/lib/kalibro_client/entities/processor/repository.rb +63 -4
- data/lib/kalibro_client/helpers/date_attributes.rb +11 -0
- data/lib/kalibro_client/helpers/request_methods.rb +9 -0
- data/lib/kalibro_client/version.rb +1 -1
- data/spec/entities/base_spec.rb +106 -24
- data/spec/entities/configurations/kalibro_configuration_spec.rb +8 -8
- data/spec/entities/configurations/kalibro_range_spec.rb +18 -24
- data/spec/entities/configurations/metric_configuration_spec.rb +22 -23
- data/spec/entities/configurations/reading_group_spec.rb +27 -0
- data/spec/entities/configurations/reading_spec.rb +15 -7
- data/spec/entities/processor/metric_collector_details_spec.rb +19 -7
- data/spec/entities/processor/metric_result_spec.rb +40 -54
- data/spec/entities/processor/module_result_spec.rb +52 -3
- data/spec/entities/processor/processing_spec.rb +35 -92
- data/spec/entities/processor/project_spec.rb +52 -5
- data/spec/entities/processor/repository_spec.rb +255 -5
- data/spec/factories/kalibro_configurations.rb +3 -3
- data/spec/factories/kalibro_ranges.rb +9 -3
- data/spec/factories/metrics.rb +1 -1
- data/spec/factories/readings.rb +1 -1
- data/spec/factories/repositories.rb +1 -1
- data/spec/helpers/date_attributes_spec.rb +30 -0
- metadata +21 -14
- data/features/step_definitions/configuration_steps.rb +0 -40
@@ -18,9 +18,19 @@ require 'spec_helper'
|
|
18
18
|
|
19
19
|
describe KalibroClient::Entities::Processor::MetricResult do
|
20
20
|
let(:metric_configuration) { FactoryGirl.build(:metric_configuration_with_id) }
|
21
|
-
subject { FactoryGirl.build(:metric_result
|
21
|
+
subject { FactoryGirl.build(:metric_result) }
|
22
|
+
|
23
|
+
before do
|
24
|
+
KalibroClient::Entities::Configurations::MetricConfiguration.
|
25
|
+
stubs(:request).
|
26
|
+
with(':id', {id: metric_configuration.id}, :get).
|
27
|
+
returns({'metric_configuration' => metric_configuration.to_hash})
|
28
|
+
end
|
22
29
|
|
23
30
|
describe 'new' do
|
31
|
+
before :each do
|
32
|
+
subject.metric_configuration_id = metric_configuration.id
|
33
|
+
end
|
24
34
|
context 'with value NaN' do
|
25
35
|
it 'should set the value with aggregated_value' do
|
26
36
|
attributes_hash = FactoryGirl.build(:metric_result, {"aggregated_value" => 1.6}).to_hash
|
@@ -49,30 +59,6 @@ describe KalibroClient::Entities::Processor::MetricResult do
|
|
49
59
|
end
|
50
60
|
end
|
51
61
|
|
52
|
-
describe 'metric_configuration' do
|
53
|
-
|
54
|
-
context 'without a set metric configuration' do
|
55
|
-
it 'should fetch and return the metric configuration' do
|
56
|
-
KalibroClient::Entities::Configurations::MetricConfiguration.expects(:find).with(metric_configuration.id).returns(metric_configuration)
|
57
|
-
expect(subject.metric_configuration).to eq(metric_configuration)
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
context 'with a set metric configuration' do
|
62
|
-
before :each do
|
63
|
-
subject.metric_configuration = metric_configuration
|
64
|
-
end
|
65
|
-
|
66
|
-
it 'should only return the metric configuration' do
|
67
|
-
expect(subject.metric_configuration).to eq(metric_configuration)
|
68
|
-
end
|
69
|
-
|
70
|
-
it 'should set the metric configuration id' do
|
71
|
-
expect(subject.metric_configuration_id).to eq(metric_configuration.id)
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
62
|
describe 'value=' do
|
77
63
|
it 'should set the value of the attribute value' do
|
78
64
|
subject.value = 42
|
@@ -91,9 +77,9 @@ describe KalibroClient::Entities::Processor::MetricResult do
|
|
91
77
|
context 'when there is one descendant value for the given metric_result' do
|
92
78
|
before :each do
|
93
79
|
KalibroClient::Entities::Processor::MetricResult.
|
94
|
-
|
95
|
-
|
96
|
-
|
80
|
+
expects(:request).
|
81
|
+
with(':id/descendant_values', { id: subject.id }, :get).
|
82
|
+
returns({'descendant_values' => [13.3]})
|
97
83
|
end
|
98
84
|
|
99
85
|
it 'should return an unitary list with the descendant value' do
|
@@ -104,9 +90,9 @@ describe KalibroClient::Entities::Processor::MetricResult do
|
|
104
90
|
context 'when there is no descendant value for the given metric_result' do
|
105
91
|
before :each do
|
106
92
|
KalibroClient::Entities::Processor::MetricResult.
|
107
|
-
|
108
|
-
|
109
|
-
|
93
|
+
expects(:request).
|
94
|
+
with(':id/descendant_values', { id: subject.id }, :get).
|
95
|
+
returns({'descendant_values' => []})
|
110
96
|
end
|
111
97
|
|
112
98
|
it 'should return an empty list' do
|
@@ -116,42 +102,42 @@ describe KalibroClient::Entities::Processor::MetricResult do
|
|
116
102
|
end
|
117
103
|
|
118
104
|
describe 'metric_results_of' do
|
105
|
+
let(:module_result) { FactoryGirl.build(:module_result) }
|
106
|
+
|
107
|
+
before :each do
|
108
|
+
KalibroClient::Entities::Processor::ModuleResult.
|
109
|
+
expects(:find).
|
110
|
+
with(module_result.id).
|
111
|
+
returns(module_result)
|
112
|
+
end
|
113
|
+
|
119
114
|
context 'when there is one metric result for the given module_result' do
|
120
115
|
before :each do
|
121
|
-
|
122
|
-
expects(:request).
|
123
|
-
with(':id/metric_results', { id: 123 }, :get).
|
124
|
-
returns({'metric_results' => [subject.to_hash]})
|
116
|
+
module_result.expects(:metric_results).returns([subject])
|
125
117
|
end
|
126
118
|
|
127
119
|
it 'should return an unitary list with the metric result' do
|
128
|
-
expect(KalibroClient::Entities::Processor::MetricResult.metric_results_of(
|
120
|
+
expect(KalibroClient::Entities::Processor::MetricResult.metric_results_of(module_result.id).first.value).to eq(subject.value)
|
129
121
|
end
|
130
122
|
end
|
131
123
|
|
132
124
|
context 'when there is no metric result for the given module_result' do
|
133
125
|
before :each do
|
134
|
-
|
135
|
-
expects(:request).
|
136
|
-
with(':id/metric_results', { :id => 42 }, :get).
|
137
|
-
returns({'metric_results' => []})
|
126
|
+
module_result.expects(:metric_results).returns([])
|
138
127
|
end
|
139
128
|
|
140
129
|
it 'should return an empty list' do
|
141
|
-
expect(KalibroClient::Entities::Processor::MetricResult.metric_results_of(
|
130
|
+
expect(KalibroClient::Entities::Processor::MetricResult.metric_results_of(module_result.id)).to eq([])
|
142
131
|
end
|
143
132
|
end
|
144
133
|
|
145
134
|
context 'when there are many metric results for the given module_result' do
|
146
135
|
before :each do
|
147
|
-
|
148
|
-
expects(:request).
|
149
|
-
with(':id/metric_results', { :id => 28 }, :get).
|
150
|
-
returns({'metric_results' => [subject.to_hash, subject.to_hash]})
|
136
|
+
module_result.expects(:metric_results).returns([subject, subject])
|
151
137
|
end
|
152
138
|
|
153
139
|
it 'should return a list with the descendant results' do
|
154
|
-
expect(KalibroClient::Entities::Processor::MetricResult.metric_results_of(
|
140
|
+
expect(KalibroClient::Entities::Processor::MetricResult.metric_results_of(module_result.id).first.value).to eq(subject.value)
|
155
141
|
end
|
156
142
|
end
|
157
143
|
end
|
@@ -164,9 +150,9 @@ describe KalibroClient::Entities::Processor::MetricResult do
|
|
164
150
|
context 'when there is not a date metric result' do
|
165
151
|
before :each do
|
166
152
|
KalibroClient::Entities::Processor::Repository.
|
167
|
-
|
168
|
-
|
169
|
-
|
153
|
+
expects(:request).
|
154
|
+
with(':id/metric_result_history_of', {:metric_name => metric.name, :kalibro_module_id => kalibro_module.id, id: repository.id}).
|
155
|
+
returns({'metric_result_history_of' => []})
|
170
156
|
end
|
171
157
|
|
172
158
|
it 'should return an empty list' do
|
@@ -179,8 +165,8 @@ describe KalibroClient::Entities::Processor::MetricResult do
|
|
179
165
|
|
180
166
|
before :each do
|
181
167
|
KalibroClient::Entities::Processor::Repository.
|
182
|
-
|
183
|
-
|
168
|
+
expects(:request).with(':id/metric_result_history_of', {:metric_name => metric.name, :kalibro_module_id => kalibro_module.id, id: repository.id})
|
169
|
+
.returns({'metric_result_history_of' => [date_metric_result.to_hash]})
|
184
170
|
end
|
185
171
|
|
186
172
|
it 'should return the date metric result as an object into a list' do
|
@@ -194,9 +180,9 @@ describe KalibroClient::Entities::Processor::MetricResult do
|
|
194
180
|
|
195
181
|
before :each do
|
196
182
|
KalibroClient::Entities::Processor::Repository.
|
197
|
-
|
198
|
-
|
199
|
-
|
183
|
+
expects(:request).
|
184
|
+
with(':id/metric_result_history_of', {:metric_name => metric.name, :kalibro_module_id => kalibro_module.id, id: repository.id}).
|
185
|
+
returns({'metric_result_history_of' => [date_metric_result.to_hash, another_date_metric_result.to_hash]})
|
200
186
|
end
|
201
187
|
|
202
188
|
it 'should return a list of date metric results as objects' do
|
@@ -134,16 +134,18 @@ describe KalibroClient::Entities::Processor::ModuleResult do
|
|
134
134
|
end
|
135
135
|
|
136
136
|
describe 'history_of' do
|
137
|
+
let(:subject) { FactoryGirl.build(:module_result, kalibro_module: FactoryGirl.build(:kalibro_module_with_id)) }
|
138
|
+
let(:repository) { FactoryGirl.build(:repository) }
|
137
139
|
let(:date_module_result) { FactoryGirl.build(:date_module_result) }
|
138
140
|
before :each do
|
139
|
-
KalibroClient::Entities::Processor::
|
141
|
+
KalibroClient::Entities::Processor::Repository.
|
140
142
|
expects(:request).
|
141
|
-
with('
|
143
|
+
with(':id/module_result_history_of', {id: repository.id, kalibro_module_id: subject.kalibro_module.id}).
|
142
144
|
returns({'date_module_results' => [[date_module_result.date, date_module_result.module_result.to_hash]]})
|
143
145
|
end
|
144
146
|
|
145
147
|
it 'should return a list of date_module_results' do
|
146
|
-
date_module_results = KalibroClient::Entities::Processor::ModuleResult.history_of
|
148
|
+
date_module_results = KalibroClient::Entities::Processor::ModuleResult.history_of(subject, repository.id)
|
147
149
|
expect(date_module_results.first.result).to eq date_module_result.result
|
148
150
|
end
|
149
151
|
end
|
@@ -175,4 +177,51 @@ describe KalibroClient::Entities::Processor::ModuleResult do
|
|
175
177
|
end
|
176
178
|
end
|
177
179
|
end
|
180
|
+
|
181
|
+
describe 'metric_results' do
|
182
|
+
subject { FactoryGirl.build(:root_module_result) }
|
183
|
+
let(:metric_configuration) { FactoryGirl.build(:metric_configuration_with_id) }
|
184
|
+
let(:metric_result_1) { FactoryGirl.build(:metric_result, metric_configuration: metric_configuration) }
|
185
|
+
let(:metric_result_2) { FactoryGirl.build(:metric_result, metric_configuration: metric_configuration) }
|
186
|
+
|
187
|
+
context 'with metric results' do
|
188
|
+
before :each do
|
189
|
+
KalibroClient::Entities::Processor::ModuleResult.
|
190
|
+
expects(:request).
|
191
|
+
with(':id/metric_results', {id: subject.id}, :get).
|
192
|
+
returns({'metric_results' => [metric_result_1.to_hash, metric_result_2.to_hash]})
|
193
|
+
KalibroClient::Entities::Configurations::MetricConfiguration.
|
194
|
+
expects(:request).
|
195
|
+
with(':id', {id: metric_configuration.id}, :get).twice.
|
196
|
+
returns({'metric_configuration' => metric_configuration.to_hash})
|
197
|
+
end
|
198
|
+
|
199
|
+
it 'should return the metric results' do
|
200
|
+
expect(subject.metric_results).to eq([metric_result_1, metric_result_2])
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
context 'without metric results' do
|
205
|
+
before :each do
|
206
|
+
KalibroClient::Entities::Processor::ModuleResult.
|
207
|
+
expects(:request).
|
208
|
+
with(':id/metric_results', {id: subject.id}, :get).
|
209
|
+
returns({'metric_results' => []})
|
210
|
+
end
|
211
|
+
|
212
|
+
it 'should return the metric results' do
|
213
|
+
expect(subject.metric_results).to eq([])
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
describe 'processing' do
|
219
|
+
let(:processing) { FactoryGirl.build(:processing) }
|
220
|
+
|
221
|
+
it 'is expected to find the processing' do
|
222
|
+
KalibroClient::Entities::Processor::Processing.expects(:find).with(subject.processing_id).returns(processing)
|
223
|
+
|
224
|
+
expect(subject.processing).to eq(processing)
|
225
|
+
end
|
226
|
+
end
|
178
227
|
end
|
@@ -79,13 +79,15 @@ describe KalibroClient::Entities::Processor::Processing do
|
|
79
79
|
|
80
80
|
context 'static methods' do
|
81
81
|
context 'using repository as parametter' do
|
82
|
-
let(:repository) { FactoryGirl.build(:
|
82
|
+
let!(:repository) { FactoryGirl.build(:repository_with_id) }
|
83
|
+
|
84
|
+
before :each do
|
85
|
+
KalibroClient::Entities::Processor::Repository.stubs(:find).with(repository.id).returns(repository)
|
86
|
+
end
|
87
|
+
|
83
88
|
describe 'has_processing' do
|
84
89
|
before :each do
|
85
|
-
|
86
|
-
expects(:request).once.
|
87
|
-
with("#{repository.id}/has_processing").
|
88
|
-
returns({'has_processing' => false})
|
90
|
+
repository.expects(:has_processing).returns(false)
|
89
91
|
end
|
90
92
|
|
91
93
|
it 'should convert the hash to a Boolean class' do
|
@@ -96,10 +98,7 @@ describe KalibroClient::Entities::Processor::Processing do
|
|
96
98
|
|
97
99
|
describe 'has_ready_processing' do
|
98
100
|
before :each do
|
99
|
-
|
100
|
-
expects(:request).once.
|
101
|
-
with("#{repository.id}/has_ready_processing", {}, :get).
|
102
|
-
returns({'has_ready_processing' => false})
|
101
|
+
repository.expects(:has_ready_processing).returns(false)
|
103
102
|
end
|
104
103
|
|
105
104
|
it 'should convert the hash to a Boolean class' do
|
@@ -110,10 +109,7 @@ describe KalibroClient::Entities::Processor::Processing do
|
|
110
109
|
|
111
110
|
describe 'has_processing_after' do
|
112
111
|
before :each do
|
113
|
-
|
114
|
-
expects(:request).once.
|
115
|
-
with("#{repository.id}/has_processing/after", {date: date}).
|
116
|
-
returns({'has_processing_in_time' => false})
|
112
|
+
repository.expects(:has_processing_after).with(date).returns(false)
|
117
113
|
end
|
118
114
|
|
119
115
|
it 'should convert the hash to a Boolean class' do
|
@@ -124,10 +120,7 @@ describe KalibroClient::Entities::Processor::Processing do
|
|
124
120
|
|
125
121
|
describe 'has_processing_before' do
|
126
122
|
before :each do
|
127
|
-
|
128
|
-
expects(:request).once.
|
129
|
-
with("#{repository.id}/has_processing/before", {date: date}).
|
130
|
-
returns({'has_processing_in_time' => false})
|
123
|
+
repository.expects(:has_processing_before).with(date).returns(false)
|
131
124
|
end
|
132
125
|
|
133
126
|
it 'should convert the hash to a Boolean class' do
|
@@ -137,12 +130,10 @@ describe KalibroClient::Entities::Processor::Processing do
|
|
137
130
|
end
|
138
131
|
|
139
132
|
describe 'last_processing_state_of' do
|
140
|
-
let(:any_state) { "READY" }
|
133
|
+
let!(:any_state) { "READY" }
|
134
|
+
|
141
135
|
before :each do
|
142
|
-
|
143
|
-
expects(:request).once.
|
144
|
-
with("#{repository.id}/last_processing_state", {}, :get).
|
145
|
-
returns({'processing_state' => any_state})
|
136
|
+
repository.expects(:last_processing_state).returns(any_state)
|
146
137
|
end
|
147
138
|
|
148
139
|
it 'should return the state as string' do
|
@@ -157,15 +148,9 @@ describe KalibroClient::Entities::Processor::Processing do
|
|
157
148
|
describe 'processing_of' do
|
158
149
|
context 'when the repository has a ready processing' do
|
159
150
|
before do
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
returns({'has_ready_processing' => true})
|
164
|
-
|
165
|
-
KalibroClient::Entities::Processor::Repository.
|
166
|
-
expects(:request).once.
|
167
|
-
with(':id/last_ready_processing', {id: repository.id}, :get).
|
168
|
-
returns({'last_ready_processing' => processing.to_hash})
|
151
|
+
repository.expects(:has_ready_processing).returns(true)
|
152
|
+
|
153
|
+
repository.expects(:last_ready_processing).returns(processing)
|
169
154
|
end
|
170
155
|
|
171
156
|
it 'should return the last ready processing' do
|
@@ -176,15 +161,9 @@ describe KalibroClient::Entities::Processor::Processing do
|
|
176
161
|
|
177
162
|
context 'when the repository has not a ready processing' do
|
178
163
|
before do
|
179
|
-
KalibroClient::Entities::Processor::
|
180
|
-
|
181
|
-
|
182
|
-
returns({'exists' => false})
|
183
|
-
|
184
|
-
KalibroClient::Entities::Processor::Repository.
|
185
|
-
expects(:request).once.
|
186
|
-
with("#{repository.id}/last_processing").
|
187
|
-
returns({'processing' => processing.to_hash})
|
164
|
+
KalibroClient::Entities::Processor::Processing.expects(:has_ready_processing).returns(false)
|
165
|
+
|
166
|
+
KalibroClient::Entities::Processor::Processing.expects(:last_processing_of).returns(processing)
|
188
167
|
end
|
189
168
|
|
190
169
|
it 'should return the last processing' do
|
@@ -197,15 +176,9 @@ describe KalibroClient::Entities::Processor::Processing do
|
|
197
176
|
describe 'processing_with_date_of' do
|
198
177
|
context 'when the repository has a processing after the given date' do
|
199
178
|
before do
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
returns({'has_processing_in_time' => true})
|
204
|
-
|
205
|
-
KalibroClient::Entities::Processor::Repository.
|
206
|
-
expects(:request).once.
|
207
|
-
with("#{repository.id}/first_processing/after", {date: date}).
|
208
|
-
returns({'processing' => processing.to_hash})
|
179
|
+
repository.expects(:has_processing_after).with(date).returns(true)
|
180
|
+
|
181
|
+
repository.expects(:first_processing_after).with(date).returns(processing)
|
209
182
|
end
|
210
183
|
|
211
184
|
it 'should return the first processing after the given date' do
|
@@ -216,20 +189,11 @@ describe KalibroClient::Entities::Processor::Processing do
|
|
216
189
|
|
217
190
|
context 'when the repository has a processing before the given date' do
|
218
191
|
before do
|
219
|
-
KalibroClient::Entities::Processor::
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
KalibroClient::Entities::Processor::Repository.
|
225
|
-
expects(:request).once.
|
226
|
-
with("#{repository.id}/has_processing/before", {date: date}).
|
227
|
-
returns({'has_processing_in_time' => true})
|
228
|
-
|
229
|
-
KalibroClient::Entities::Processor::Repository.
|
230
|
-
expects(:request).once.
|
231
|
-
with("#{repository.id}/last_processing/before", {date: date}).
|
232
|
-
returns({'processing' => processing.to_hash})
|
192
|
+
KalibroClient::Entities::Processor::Processing.expects(:has_processing_after).with(repository.id, date).returns(false)
|
193
|
+
|
194
|
+
KalibroClient::Entities::Processor::Processing.expects(:has_processing_before).with(repository.id, date).returns(true)
|
195
|
+
|
196
|
+
KalibroClient::Entities::Processor::Processing.expects(:last_processing_before).with(repository.id, date).returns(processing)
|
233
197
|
end
|
234
198
|
|
235
199
|
it 'should return the last ready processing' do
|
@@ -240,15 +204,9 @@ describe KalibroClient::Entities::Processor::Processing do
|
|
240
204
|
|
241
205
|
context 'when the repository has not a processing after or before the given date' do
|
242
206
|
before do
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
returns({'has_processing_in_time' => false})
|
247
|
-
|
248
|
-
KalibroClient::Entities::Processor::Repository.
|
249
|
-
expects(:request).once.
|
250
|
-
with("#{repository.id}/has_processing/before", {date: date}).
|
251
|
-
returns({'has_processing_in_time' => false})
|
207
|
+
repository.expects(:has_processing_after).with(date).returns(false)
|
208
|
+
|
209
|
+
repository.expects(:has_processing_before).with(date).returns(false)
|
252
210
|
end
|
253
211
|
|
254
212
|
it 'should return the last ready processing' do
|
@@ -260,10 +218,7 @@ describe KalibroClient::Entities::Processor::Processing do
|
|
260
218
|
|
261
219
|
describe 'last_ready_processing_of' do
|
262
220
|
before :each do
|
263
|
-
|
264
|
-
expects(:request).once.
|
265
|
-
with(':id/last_ready_processing', {id: repository.id}, :get).
|
266
|
-
returns({'last_ready_processing' => processing.to_hash})
|
221
|
+
repository.expects(:last_ready_processing).returns(processing)
|
267
222
|
end
|
268
223
|
|
269
224
|
it 'should return a processing object' do
|
@@ -274,10 +229,7 @@ describe KalibroClient::Entities::Processor::Processing do
|
|
274
229
|
|
275
230
|
describe 'first_processing_of' do
|
276
231
|
before :each do
|
277
|
-
|
278
|
-
expects(:request).once.
|
279
|
-
with("#{repository.id}/first_processing").
|
280
|
-
returns({'processing' => processing.to_hash})
|
232
|
+
repository.expects(:first_processing).returns(processing)
|
281
233
|
end
|
282
234
|
|
283
235
|
it 'should return a processing object' do
|
@@ -288,10 +240,7 @@ describe KalibroClient::Entities::Processor::Processing do
|
|
288
240
|
|
289
241
|
describe 'last_processing_of' do
|
290
242
|
before :each do
|
291
|
-
|
292
|
-
expects(:request).once.
|
293
|
-
with("#{repository.id}/last_processing").
|
294
|
-
returns({'processing' => processing.to_hash})
|
243
|
+
repository.expects(:last_processing).returns(processing)
|
295
244
|
end
|
296
245
|
|
297
246
|
it 'should return a processing object' do
|
@@ -302,10 +251,7 @@ describe KalibroClient::Entities::Processor::Processing do
|
|
302
251
|
|
303
252
|
describe 'first_processing_after' do
|
304
253
|
before :each do
|
305
|
-
|
306
|
-
expects(:request).once.
|
307
|
-
with("#{repository.id}/first_processing/after", {date: date}).
|
308
|
-
returns({'processing' => processing.to_hash})
|
254
|
+
repository.expects(:first_processing_after).with(date).returns(processing)
|
309
255
|
end
|
310
256
|
|
311
257
|
it 'should return a processing object' do
|
@@ -316,10 +262,7 @@ describe KalibroClient::Entities::Processor::Processing do
|
|
316
262
|
|
317
263
|
describe 'last_processing_before' do
|
318
264
|
before :each do
|
319
|
-
|
320
|
-
expects(:request).once.
|
321
|
-
with("#{repository.id}/last_processing/before", {date: date}).
|
322
|
-
returns({'processing' => processing.to_hash})
|
265
|
+
repository.expects(:last_processing_before).with(date).returns(processing)
|
323
266
|
end
|
324
267
|
|
325
268
|
it 'should return a processing object' do
|