massive 0.1.0 → 0.1.1
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/Gemfile.lock +1 -1
- data/lib/massive/file.rb +4 -0
- data/lib/massive/process.rb +4 -0
- data/lib/massive/step.rb +1 -0
- data/lib/massive/version.rb +1 -1
- data/spec/models/massive/file_spec.rb +22 -0
- data/spec/models/massive/process_spec.rb +24 -1
- data/spec/models/massive/status_spec.rb +4 -1
- data/spec/models/massive/step_spec.rb +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NGVlNDc0ZmZjOWYzNDljMTdhMGViMTZmNWM4ZWRkMmZiOTIyOTBiNQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NzlmZGUwMDQ1MzM0NWNmNGU5NzUyYTU3ODAyNGNmOTZkMDAyMDRlMA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NzdjYzI4OTNiZTZiMDIxMmQ3OWRlN2JhNGIwZTlkNmI3YTE0YzNkYTBmMWMy
|
10
|
+
ODZkMjJlNjlmOGIxYjQ2ZjQ4ODYzMDg2YzYwY2ZkYjM4NDc5NDdkY2QxMjAx
|
11
|
+
N2UyMGJiYTg5Nzg5MDBjZGY5Y2Y1YzQ4NDM1OGYyYmU1YjU2OGM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Yzk3NmI5ZWY2MTM3NjNkODIzOTNhYWMyYWU5MGMzM2QzNjY4MDc0ZTcxNzFk
|
14
|
+
Nzk0OGM0OWFhZWMxY2UzZTlhMGIxNmU4MjQyMzVmZDMyOGFmNGQ3MDVkMDBm
|
15
|
+
NWRmZGZlNGI3NDY1ZGZmOGIyYzYwZDNkZmRjMWJmNmVjNmMwZjI=
|
data/Gemfile.lock
CHANGED
data/lib/massive/file.rb
CHANGED
data/lib/massive/process.rb
CHANGED
data/lib/massive/step.rb
CHANGED
data/lib/massive/version.rb
CHANGED
@@ -206,4 +206,26 @@ describe Massive::File do
|
|
206
206
|
end
|
207
207
|
end
|
208
208
|
end
|
209
|
+
|
210
|
+
describe "#has_info?" do
|
211
|
+
context "when file already has gathered info" do
|
212
|
+
before do
|
213
|
+
file.encoding = 'utf-8'
|
214
|
+
file.col_sep = '|'
|
215
|
+
file.total_count = 3000
|
216
|
+
end
|
217
|
+
|
218
|
+
its(:has_info?) { should be_true }
|
219
|
+
end
|
220
|
+
|
221
|
+
context "when file has not gathered info" do
|
222
|
+
before do
|
223
|
+
file.encoding = nil
|
224
|
+
file.col_sep = nil
|
225
|
+
file.total_count = nil
|
226
|
+
end
|
227
|
+
|
228
|
+
its(:has_info?) { should be_false }
|
229
|
+
end
|
230
|
+
end
|
209
231
|
end
|
@@ -9,6 +9,12 @@ describe Massive::Process do
|
|
9
9
|
let!(:second_step) { process.steps.build }
|
10
10
|
let!(:third_step) { process.steps.build }
|
11
11
|
|
12
|
+
before do
|
13
|
+
first_step.stub(:reload).and_return(first_step)
|
14
|
+
second_step.stub(:reload).and_return(second_step)
|
15
|
+
third_step.stub(:reload).and_return(third_step)
|
16
|
+
end
|
17
|
+
|
12
18
|
context "and none of them are completed" do
|
13
19
|
it "enqueues the first step" do
|
14
20
|
first_step.should_receive(:enqueue)
|
@@ -173,7 +179,7 @@ describe Massive::Process do
|
|
173
179
|
its(:completed?) { should be_false }
|
174
180
|
end
|
175
181
|
|
176
|
-
context "when
|
182
|
+
context "when there are no incompleted steps" do
|
177
183
|
before do
|
178
184
|
step_1.update_attributes(finished_at: Time.now, failed_at: nil)
|
179
185
|
step_2.update_attributes(finished_at: Time.now, failed_at: nil)
|
@@ -183,6 +189,23 @@ describe Massive::Process do
|
|
183
189
|
end
|
184
190
|
end
|
185
191
|
|
192
|
+
describe "#failed?" do
|
193
|
+
let!(:step_1) { process.steps.build }
|
194
|
+
let!(:step_2) { process.steps.build }
|
195
|
+
|
196
|
+
before { process.save }
|
197
|
+
|
198
|
+
context "when the steps not failed" do
|
199
|
+
its(:failed?) { should be_false }
|
200
|
+
end
|
201
|
+
|
202
|
+
context "when any step failed" do
|
203
|
+
before { step_2.update_attributes(failed_at: Time.now) }
|
204
|
+
|
205
|
+
its(:failed?) { should be_true }
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
186
209
|
describe "#cancel" do
|
187
210
|
let!(:now) do
|
188
211
|
Time.now.tap do |now|
|
@@ -77,7 +77,10 @@ shared_examples_for Massive::Status do
|
|
77
77
|
|
78
78
|
describe "#enqueued?" do
|
79
79
|
context "when model is enqueued" do
|
80
|
-
before
|
80
|
+
before do
|
81
|
+
model.stub(:reload).and_return(model)
|
82
|
+
model.enqueue
|
83
|
+
end
|
81
84
|
|
82
85
|
its(:enqueued?) { should be_true }
|
83
86
|
end
|
@@ -38,11 +38,18 @@ describe Massive::Step do
|
|
38
38
|
end
|
39
39
|
|
40
40
|
describe "#enqueue" do
|
41
|
+
before { step.stub(:reload).and_return(step) }
|
42
|
+
|
41
43
|
it "enqueues itself, passing ids as strings" do
|
42
44
|
Resque.should_receive(:enqueue).with(step.class, step.process.id.to_s, step.id.to_s)
|
43
45
|
step.enqueue
|
44
46
|
end
|
45
47
|
|
48
|
+
it "sends a :enqueued notification" do
|
49
|
+
step.should_receive(:notify).with(:enqueued)
|
50
|
+
step.enqueue
|
51
|
+
end
|
52
|
+
|
46
53
|
context "when a subclass redefines calculate_total_count" do
|
47
54
|
subject(:step) { CustomStep.new }
|
48
55
|
before { process.steps << step }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: massive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vicente Mundim
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: resque
|