kalibro_entities 0.0.1.rc1
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 +7 -0
- data/.gitignore +19 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +21 -0
- data/AUTHORS +4 -0
- data/COPYING +674 -0
- data/COPYING.LESSER +165 -0
- data/Gemfile +4 -0
- data/README.md +77 -0
- data/Rakefile +6 -0
- data/cucumber.yml +1 -0
- data/features/base_tool/all_names.feature +8 -0
- data/features/base_tool/find_by_name.feature +12 -0
- data/features/configuration/all.feature +10 -0
- data/features/metric_configuration/find.feature +18 -0
- data/features/metric_configuration/metric_configurations_of.feature +18 -0
- data/features/metric_result/descendant_results.feature +19 -0
- data/features/metric_result/history_of.feature +20 -0
- data/features/metric_result/metric_results_of.feature +19 -0
- data/features/module_result/children.feature +18 -0
- data/features/module_result/find.feature +15 -0
- data/features/module_result/history_of.feature +11 -0
- data/features/processing/first_processing_after.feature +18 -0
- data/features/processing/first_processing_of.feature +18 -0
- data/features/processing/has_processing.feature +18 -0
- data/features/processing/has_processing_after.feature +18 -0
- data/features/processing/has_processing_before.feature +18 -0
- data/features/processing/has_ready_processing.feature +18 -0
- data/features/processing/last_processing_before.feature +18 -0
- data/features/processing/last_processing_of.feature +18 -0
- data/features/processing/last_processing_state_of.feature +18 -0
- data/features/processing/last_ready_processing_of.feature +18 -0
- data/features/processing/processing_of.feature +32 -0
- data/features/processing/processing_with_date_of.feature +32 -0
- data/features/project/all.feature +10 -0
- data/features/project/creation.feature +9 -0
- data/features/project/destroy.feature +10 -0
- data/features/project/exists.feature +9 -0
- data/features/project/find.feature +10 -0
- data/features/range/ranges_of.feature +22 -0
- data/features/range/save.feature +32 -0
- data/features/reading/find.feature +11 -0
- data/features/reading/readings_of.feature +11 -0
- data/features/reading_group/all.feature +10 -0
- data/features/repository/all.feature +14 -0
- data/features/repository/cancel_processing.feature +14 -0
- data/features/repository/find.feature +14 -0
- data/features/repository/of.feature +15 -0
- data/features/repository/process.feature +16 -0
- data/features/repository/types.feature +9 -0
- data/features/step_definitions/base_tool_steps.rb +28 -0
- data/features/step_definitions/configuration_steps.rb +11 -0
- data/features/step_definitions/metric_configuration_steps.rb +52 -0
- data/features/step_definitions/metric_result_steps.rb +29 -0
- data/features/step_definitions/metric_steps.rb +3 -0
- data/features/step_definitions/module_result_steps.rb +30 -0
- data/features/step_definitions/processing_steps.rb +91 -0
- data/features/step_definitions/project_steps.rb +48 -0
- data/features/step_definitions/range_steps.rb +41 -0
- data/features/step_definitions/reading_group_steps.rb +19 -0
- data/features/step_definitions/reading_steps.rb +20 -0
- data/features/step_definitions/repository_steps.rb +57 -0
- data/features/support/env.rb +25 -0
- data/features/support/kalibro_cucumber_helpers.yml.sample +10 -0
- data/kalibro_entities.gemspec +48 -0
- data/lib/kalibro_entities.rb +61 -0
- data/lib/kalibro_entities/entities.rb +37 -0
- data/lib/kalibro_entities/entities/base_tool.rb +54 -0
- data/lib/kalibro_entities/entities/configuration.rb +33 -0
- data/lib/kalibro_entities/entities/date_metric_result.rb +39 -0
- data/lib/kalibro_entities/entities/date_module_result.rb +39 -0
- data/lib/kalibro_entities/entities/metric.rb +21 -0
- data/lib/kalibro_entities/entities/metric_configuration.rb +70 -0
- data/lib/kalibro_entities/entities/metric_configuration_snapshot.rb +57 -0
- data/lib/kalibro_entities/entities/metric_result.rb +63 -0
- data/lib/kalibro_entities/entities/model.rb +162 -0
- data/lib/kalibro_entities/entities/module.rb +27 -0
- data/lib/kalibro_entities/entities/module_result.rb +69 -0
- data/lib/kalibro_entities/entities/process_time.rb +31 -0
- data/lib/kalibro_entities/entities/processing.rb +113 -0
- data/lib/kalibro_entities/entities/project.rb +34 -0
- data/lib/kalibro_entities/entities/range.rb +75 -0
- data/lib/kalibro_entities/entities/range_snapshot.rb +37 -0
- data/lib/kalibro_entities/entities/reading.rb +51 -0
- data/lib/kalibro_entities/entities/reading_group.rb +43 -0
- data/lib/kalibro_entities/entities/repository.rb +78 -0
- data/lib/kalibro_entities/entities/repository_observer.rb +50 -0
- data/lib/kalibro_entities/entities/stack_trace_element.rb +31 -0
- data/lib/kalibro_entities/entities/throwable.rb +42 -0
- data/lib/kalibro_entities/errors.rb +18 -0
- data/lib/kalibro_entities/errors/record_not_found.rb +22 -0
- data/lib/kalibro_entities/errors/standard.rb +24 -0
- data/lib/kalibro_entities/helpers/aggregation_options.rb +25 -0
- data/lib/kalibro_entities/helpers/hash_converters.rb +48 -0
- data/lib/kalibro_entities/helpers/request_methods.rb +47 -0
- data/lib/kalibro_entities/helpers/xml_converters.rb +20 -0
- data/lib/kalibro_entities/kalibro_cucumber_helpers.rb +40 -0
- data/lib/kalibro_entities/kalibro_cucumber_helpers/configuration.rb +39 -0
- data/lib/kalibro_entities/kalibro_cucumber_helpers/hooks.rb +50 -0
- data/lib/kalibro_entities/kalibro_cucumber_helpers/scripts/delete_all_kalibro_entries.sh +23 -0
- data/lib/kalibro_entities/kalibro_cucumber_helpers/scripts/prepare_kalibro_query_file.sh +38 -0
- data/lib/kalibro_entities/kalibro_cucumber_helpers/scripts/put_kalibro_on_test_mode.sh +35 -0
- data/lib/kalibro_entities/kalibro_cucumber_helpers/scripts/return_kalibro_from_test_mode.sh +26 -0
- data/lib/kalibro_entities/version.rb +19 -0
- data/lib/rake/test_task.rb +57 -0
- data/spec/entities/base_tool_spec.rb +168 -0
- data/spec/entities/configuration_spec.rb +61 -0
- data/spec/entities/date_metric_result_spec.rb +62 -0
- data/spec/entities/date_module_result_spec.rb +61 -0
- data/spec/entities/metric_configuration_snapshot_spec.rb +107 -0
- data/spec/entities/metric_configuration_spec.rb +149 -0
- data/spec/entities/metric_result_spec.rb +193 -0
- data/spec/entities/metric_spec.rb +47 -0
- data/spec/entities/model_spec.rb +275 -0
- data/spec/entities/module_result_spec.rb +135 -0
- data/spec/entities/process_time_spec.rb +33 -0
- data/spec/entities/processing_spec.rb +334 -0
- data/spec/entities/project_spec.rb +68 -0
- data/spec/entities/range_snapshot_spec.rb +50 -0
- data/spec/entities/range_spec.rb +181 -0
- data/spec/entities/reading_group_spec.rb +90 -0
- data/spec/entities/reading_spec.rb +106 -0
- data/spec/entities/repository_observer_spec.rb +123 -0
- data/spec/entities/repository_spec.rb +167 -0
- data/spec/entities/stack_trace_element_spec.rb +26 -0
- data/spec/entities/throwable_spec.rb +51 -0
- data/spec/factories/base_tools.rb +31 -0
- data/spec/factories/configurations.rb +29 -0
- data/spec/factories/date_metric_results.rb +28 -0
- data/spec/factories/date_module_results.rb +22 -0
- data/spec/factories/metric_configurations.rb +28 -0
- data/spec/factories/metric_configurations_snapshot.rb +26 -0
- data/spec/factories/metric_results.rb +24 -0
- data/spec/factories/metrics.rb +35 -0
- data/spec/factories/models.rb +20 -0
- data/spec/factories/module_results.rb +33 -0
- data/spec/factories/modules.rb +22 -0
- data/spec/factories/process_times.rb +27 -0
- data/spec/factories/processings.rb +25 -0
- data/spec/factories/projects.rb +29 -0
- data/spec/factories/ranges.rb +30 -0
- data/spec/factories/ranges_snapshot.rb +26 -0
- data/spec/factories/reading_groups.rb +23 -0
- data/spec/factories/readings.rb +25 -0
- data/spec/factories/repositories.rb +34 -0
- data/spec/factories/repository_observers.rb +24 -0
- data/spec/factories/stack_trace_elements.rb +24 -0
- data/spec/factories/throwables.rb +23 -0
- data/spec/helpers/aggregation_options_spec.rb +31 -0
- data/spec/helpers/hash_converters_spec.rb +111 -0
- data/spec/helpers/xml_converters_spec.rb +64 -0
- data/spec/kalibro_entities_spec.rb +108 -0
- data/spec/savon/fixtures/config.yml +1 -0
- data/spec/savon/fixtures/invalid_config.yml +2 -0
- data/spec/savon/fixtures/project/does_not_exists.xml +1 -0
- data/spec/savon/savon_test_helper.rb +14 -0
- data/spec/spec_helper.rb +60 -0
- metadata +461 -0
@@ -0,0 +1,33 @@
|
|
1
|
+
# This file is part of KalibroEntities
|
2
|
+
# Copyright (C) 2013 it's respectives authors (please see the AUTHORS file)
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
|
17
|
+
require 'spec_helper'
|
18
|
+
|
19
|
+
describe KalibroEntities::Entities::ProcessTime do
|
20
|
+
describe 'time=' do
|
21
|
+
subject {FactoryGirl.build(:process_time)}
|
22
|
+
|
23
|
+
it 'should set the time attribute to 6' do
|
24
|
+
subject.time = 6
|
25
|
+
subject.time.should eq 6
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should convert to integer' do
|
29
|
+
subject.time = "5"
|
30
|
+
subject.time.should eq 5
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,334 @@
|
|
1
|
+
# This file is part of KalibroEntities
|
2
|
+
# Copyright (C) 2013 it's respectives authors (please see the AUTHORS file)
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
|
17
|
+
require 'spec_helper'
|
18
|
+
|
19
|
+
describe KalibroEntities::Entities::Processing do
|
20
|
+
subject {FactoryGirl.build(:processing)}
|
21
|
+
let(:date) { DateTime.now }
|
22
|
+
describe 'id=' do
|
23
|
+
it 'should convert the id attribute to integer' do
|
24
|
+
subject.id = "41"
|
25
|
+
subject.id.should eq 41
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'date=' do
|
30
|
+
it 'should set the date attribute' do
|
31
|
+
subject.date = date
|
32
|
+
subject.date.should eq date
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'should convert strings to date format' do
|
36
|
+
subject.date = "2013-09-17T18:26:43.151+00:00"
|
37
|
+
subject.date.should be_kind_of(DateTime)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe 'using process_time attribute' do
|
42
|
+
let(:another_process_time) { FactoryGirl.build(:analyzing_process_time) }
|
43
|
+
|
44
|
+
context 'process_time=' do
|
45
|
+
it 'should set the process_time attribute as a list of objects' do
|
46
|
+
subject.process_time = another_process_time.to_hash
|
47
|
+
subject.process_time.should eq [another_process_time]
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
context 'process_times=' do
|
52
|
+
it 'should set the process_time attribute' do
|
53
|
+
subject.process_times = [another_process_time]
|
54
|
+
subject.process_time.should eq [another_process_time]
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
context 'process_times' do
|
59
|
+
it 'should get the process_time attribute' do
|
60
|
+
subject.process_times.should eq subject.process_time
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe 'error=' do
|
66
|
+
let(:error) { FactoryGirl.build(:throwable, message: 'Another Error!') }
|
67
|
+
|
68
|
+
it 'should set the attribute error as an object' do
|
69
|
+
subject.error = error.to_hash
|
70
|
+
subject.error.should eq error
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
describe 'results_root_id=' do
|
75
|
+
it 'should set the attribute results root id as an integer' do
|
76
|
+
subject.results_root_id = "36"
|
77
|
+
subject.results_root_id.should eq 36
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
context 'static methods' do
|
82
|
+
context 'using repository as parametter' do
|
83
|
+
let(:repository) { FactoryGirl.build(:repository) }
|
84
|
+
describe 'has_processing' do
|
85
|
+
before :each do
|
86
|
+
KalibroEntities::Entities::Processing.
|
87
|
+
expects(:request).once.
|
88
|
+
with(:has_processing, {:repository_id => repository.id}).
|
89
|
+
returns({exists: false})
|
90
|
+
end
|
91
|
+
|
92
|
+
it 'should convert the hash to a Boolean class' do
|
93
|
+
response = KalibroEntities::Entities::Processing.has_processing repository.id
|
94
|
+
response.should be_a_kind_of(FalseClass)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
describe 'has_ready_processing' do
|
99
|
+
before :each do
|
100
|
+
KalibroEntities::Entities::Processing.
|
101
|
+
expects(:request).once.
|
102
|
+
with(:has_ready_processing, {:repository_id => repository.id}).
|
103
|
+
returns({exists: false})
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'should convert the hash to a Boolean class' do
|
107
|
+
response = KalibroEntities::Entities::Processing.has_ready_processing repository.id
|
108
|
+
response.should be_a_kind_of(FalseClass)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
describe 'has_processing_after' do
|
113
|
+
before :each do
|
114
|
+
KalibroEntities::Entities::Processing.
|
115
|
+
expects(:request).once.
|
116
|
+
with(:has_processing_after, {:repository_id => repository.id, :date => date}).
|
117
|
+
returns({exists: false})
|
118
|
+
end
|
119
|
+
|
120
|
+
it 'should convert the hash to a Boolean class' do
|
121
|
+
response = KalibroEntities::Entities::Processing.has_processing_after(repository.id, date)
|
122
|
+
response.should be_a_kind_of(FalseClass)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
describe 'has_processing_before' do
|
127
|
+
before :each do
|
128
|
+
KalibroEntities::Entities::Processing.
|
129
|
+
expects(:request).once.
|
130
|
+
with(:has_processing_before, {:repository_id => repository.id, :date => date}).
|
131
|
+
returns({exists: false})
|
132
|
+
end
|
133
|
+
|
134
|
+
it 'should convert the hash to a Boolean class' do
|
135
|
+
response = KalibroEntities::Entities::Processing.has_processing_before(repository.id, date)
|
136
|
+
response.should be_a_kind_of(FalseClass)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
describe 'last_processing_state_of' do
|
141
|
+
let(:any_state) { "READY" }
|
142
|
+
before :each do
|
143
|
+
KalibroEntities::Entities::Processing.
|
144
|
+
expects(:request).once.
|
145
|
+
with(:last_processing_state, {:repository_id => repository.id}).
|
146
|
+
returns({process_state: any_state})
|
147
|
+
end
|
148
|
+
|
149
|
+
it 'should return the state as string' do
|
150
|
+
response = KalibroEntities::Entities::Processing.last_processing_state_of repository.id
|
151
|
+
response.should eq(any_state)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
context 'getting processing entity from Kalibro web service' do
|
156
|
+
let(:processing) { FactoryGirl.build(:processing) }
|
157
|
+
|
158
|
+
describe 'processing_of' do
|
159
|
+
context 'when the repository has a ready processing' do
|
160
|
+
before do
|
161
|
+
KalibroEntities::Entities::Processing.
|
162
|
+
expects(:request).once.
|
163
|
+
with(:has_ready_processing, {:repository_id => repository.id}).
|
164
|
+
returns({exists: true})
|
165
|
+
|
166
|
+
KalibroEntities::Entities::Processing.
|
167
|
+
expects(:request).once.
|
168
|
+
with(:last_ready_processing, {:repository_id => repository.id}).
|
169
|
+
returns({processing: processing.to_hash})
|
170
|
+
end
|
171
|
+
|
172
|
+
it 'should return the last ready processing' do
|
173
|
+
response = KalibroEntities::Entities::Processing.processing_of repository.id
|
174
|
+
response.state.should eq(processing.state)
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
context 'when the repository has not a ready processing' do
|
179
|
+
before do
|
180
|
+
KalibroEntities::Entities::Processing.
|
181
|
+
expects(:request).once.
|
182
|
+
with(:has_ready_processing, {:repository_id => repository.id}).
|
183
|
+
returns({exists: false})
|
184
|
+
|
185
|
+
KalibroEntities::Entities::Processing.
|
186
|
+
expects(:request).once.
|
187
|
+
with(:last_processing, {:repository_id => repository.id}).
|
188
|
+
returns({processing: processing.to_hash})
|
189
|
+
end
|
190
|
+
|
191
|
+
it 'should return the last processing' do
|
192
|
+
response = KalibroEntities::Entities::Processing.processing_of repository.id
|
193
|
+
response.state.should eq(processing.state)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
describe 'processing_with_date_of' do
|
199
|
+
context 'when the repository has a processing after the given date' do
|
200
|
+
before do
|
201
|
+
KalibroEntities::Entities::Processing.
|
202
|
+
expects(:request).once.
|
203
|
+
with(:has_processing_after, {:repository_id => repository.id, :date => date}).
|
204
|
+
returns({exists: true})
|
205
|
+
|
206
|
+
KalibroEntities::Entities::Processing.
|
207
|
+
expects(:request).once.
|
208
|
+
with(:first_processing_after, {:repository_id => repository.id, :date => date}).
|
209
|
+
returns({processing: processing.to_hash})
|
210
|
+
end
|
211
|
+
|
212
|
+
it 'should return the first processing after the given date' do
|
213
|
+
response = KalibroEntities::Entities::Processing.processing_with_date_of(repository.id, date)
|
214
|
+
response.state.should eq(processing.state)
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
context 'when the repository has a processing before the given date' do
|
219
|
+
before do
|
220
|
+
KalibroEntities::Entities::Processing.
|
221
|
+
expects(:request).once.
|
222
|
+
with(:has_processing_after, {:repository_id => repository.id, :date => date}).
|
223
|
+
returns({exists: false})
|
224
|
+
|
225
|
+
KalibroEntities::Entities::Processing.
|
226
|
+
expects(:request).once.
|
227
|
+
with(:has_processing_before, {:repository_id => repository.id, :date => date}).
|
228
|
+
returns({exists: true})
|
229
|
+
|
230
|
+
KalibroEntities::Entities::Processing.
|
231
|
+
expects(:request).once.
|
232
|
+
with(:last_processing_before, {:repository_id => repository.id, :date => date}).
|
233
|
+
returns({processing: processing.to_hash})
|
234
|
+
end
|
235
|
+
|
236
|
+
it 'should return the last ready processing' do
|
237
|
+
response = KalibroEntities::Entities::Processing.processing_with_date_of(repository.id, date)
|
238
|
+
response.state.should eq(processing.state)
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
context 'when the repository has not a processing after or before the given date' do
|
243
|
+
before do
|
244
|
+
KalibroEntities::Entities::Processing.
|
245
|
+
expects(:request).once.
|
246
|
+
with(:has_processing_after, {:repository_id => repository.id, :date => date}).
|
247
|
+
returns({exists: false})
|
248
|
+
|
249
|
+
KalibroEntities::Entities::Processing.
|
250
|
+
expects(:request).once.
|
251
|
+
with(:has_processing_before, {:repository_id => repository.id, :date => date}).
|
252
|
+
returns({exists: false})
|
253
|
+
end
|
254
|
+
|
255
|
+
it 'should return the last ready processing' do
|
256
|
+
response = KalibroEntities::Entities::Processing.processing_with_date_of(repository.id, date)
|
257
|
+
response.should be_nil
|
258
|
+
end
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
describe 'last_ready_processing_of' do
|
263
|
+
before :each do
|
264
|
+
KalibroEntities::Entities::Processing.
|
265
|
+
expects(:request).once.
|
266
|
+
with(:last_ready_processing, {:repository_id => repository.id}).
|
267
|
+
returns({processing: processing.to_hash})
|
268
|
+
end
|
269
|
+
|
270
|
+
it 'should return a processing object' do
|
271
|
+
response = KalibroEntities::Entities::Processing.last_ready_processing_of repository.id
|
272
|
+
response.state.should eq(processing.state)
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
describe 'first_processing_of' do
|
277
|
+
before :each do
|
278
|
+
KalibroEntities::Entities::Processing.
|
279
|
+
expects(:request).once.
|
280
|
+
with(:first_processing, {:repository_id => repository.id}).
|
281
|
+
returns({processing: processing.to_hash})
|
282
|
+
end
|
283
|
+
|
284
|
+
it 'should return a processing object' do
|
285
|
+
response = KalibroEntities::Entities::Processing.first_processing_of repository.id
|
286
|
+
response.state.should eq(processing.state)
|
287
|
+
end
|
288
|
+
end
|
289
|
+
|
290
|
+
describe 'last_processing_of' do
|
291
|
+
before :each do
|
292
|
+
KalibroEntities::Entities::Processing.
|
293
|
+
expects(:request).once.
|
294
|
+
with(:last_processing, {:repository_id => repository.id}).
|
295
|
+
returns({processing: processing.to_hash})
|
296
|
+
end
|
297
|
+
|
298
|
+
it 'should return a processing object' do
|
299
|
+
response = KalibroEntities::Entities::Processing.last_processing_of repository.id
|
300
|
+
response.state.should eq(processing.state)
|
301
|
+
end
|
302
|
+
end
|
303
|
+
|
304
|
+
describe 'first_processing_after' do
|
305
|
+
before :each do
|
306
|
+
KalibroEntities::Entities::Processing.
|
307
|
+
expects(:request).once.
|
308
|
+
with(:first_processing_after, {:repository_id => repository.id, :date => date}).
|
309
|
+
returns({processing: processing.to_hash})
|
310
|
+
end
|
311
|
+
|
312
|
+
it 'should return a processing object' do
|
313
|
+
response = KalibroEntities::Entities::Processing.first_processing_after(repository.id, date)
|
314
|
+
response.state.should eq(processing.state)
|
315
|
+
end
|
316
|
+
end
|
317
|
+
|
318
|
+
describe 'last_processing_before' do
|
319
|
+
before :each do
|
320
|
+
KalibroEntities::Entities::Processing.
|
321
|
+
expects(:request).once.
|
322
|
+
with(:last_processing_before, {:repository_id => repository.id, :date => date}).
|
323
|
+
returns({processing: processing.to_hash})
|
324
|
+
end
|
325
|
+
|
326
|
+
it 'should return a processing object' do
|
327
|
+
response = KalibroEntities::Entities::Processing.last_processing_before(repository.id, date)
|
328
|
+
response.state.should eq(processing.state)
|
329
|
+
end
|
330
|
+
end
|
331
|
+
end
|
332
|
+
end
|
333
|
+
end
|
334
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# This file is part of KalibroEntities
|
2
|
+
# Copyright (C) 2013 it's respectives authors (please see the AUTHORS file)
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
|
17
|
+
require 'spec_helper'
|
18
|
+
|
19
|
+
describe KalibroEntities::Entities::Project do
|
20
|
+
describe 'initialize' do
|
21
|
+
subject { FactoryGirl.build(:project, {id: 42}) }
|
22
|
+
|
23
|
+
it 'should have the id set to 42' do
|
24
|
+
subject.id.should eq(42)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe 'id=' do
|
29
|
+
it 'should set the value of the attribute id as integer' do
|
30
|
+
subject.id = "42"
|
31
|
+
subject.id.should eq(42)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe 'all' do
|
36
|
+
context 'with no projects' do
|
37
|
+
before :each do
|
38
|
+
KalibroEntities::Entities::Project.
|
39
|
+
expects(:request).
|
40
|
+
with(:all_projects).
|
41
|
+
returns({:project => nil})
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should return nil' do
|
45
|
+
KalibroEntities::Entities::Project.all.should be_empty
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
context 'with many projects' do
|
50
|
+
let(:project) { FactoryGirl.build(:project) }
|
51
|
+
let(:another_project) { FactoryGirl.build(:another_project) }
|
52
|
+
|
53
|
+
before :each do
|
54
|
+
KalibroEntities::Entities::Project.
|
55
|
+
expects(:request).
|
56
|
+
with(:all_projects).
|
57
|
+
returns({:project => [project.to_hash, another_project.to_hash]})
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'should return a list with projects' do
|
61
|
+
projects = KalibroEntities::Entities::Project.all
|
62
|
+
|
63
|
+
projects.first.name.should eq(project.name)
|
64
|
+
projects.last.name.should eq(another_project.name)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# This file is part of KalibroEntities
|
2
|
+
# Copyright (C) 2013 it's respectives authors (please see the AUTHORS file)
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
|
17
|
+
require 'spec_helper'
|
18
|
+
|
19
|
+
describe KalibroEntities::Entities::RangeSnapshot do
|
20
|
+
describe 'beginning=' do
|
21
|
+
it 'should set the value of the attribute beginning' do
|
22
|
+
subject.beginning = 3
|
23
|
+
subject.beginning.should eq(3)
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should value -1.0/0 when value be set to -INF' do
|
27
|
+
subject.beginning = "-INF"
|
28
|
+
subject.beginning.should eq(-1.0/0)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe 'end=' do
|
33
|
+
it 'should set the value of the attribute end' do
|
34
|
+
subject.end = 6
|
35
|
+
subject.end.should eq(6)
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should value 1.0/0 when value be set to INF' do
|
39
|
+
subject.end = "INF"
|
40
|
+
subject.end.should eq(1.0/0)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe 'grade=' do
|
45
|
+
it 'should set the value of the attribute grade' do
|
46
|
+
subject.grade = 18
|
47
|
+
subject.grade.should eq(18)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|