writefully 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/writefully/hooks_controller.rb +1 -3
- data/lib/writefully/cli.rb +7 -7
- data/lib/writefully/tools/dispatcher.rb +3 -7
- data/lib/writefully/version.rb +1 -1
- data/spec/dummy/log/test.log +9869 -0
- data/spec/lib/writefully/tools/dispatcher_spec.rb +8 -29
- data/spec/lib/writefully/workers/journalist_spec.rb +1 -1
- data/spec/spec_helper.rb +3 -1
- metadata +2 -2
@@ -12,12 +12,13 @@ module Writefully
|
|
12
12
|
slug: '1-hash-selector-pattern' }
|
13
13
|
}}
|
14
14
|
|
15
|
-
let(:retry_data) {
|
16
|
-
|
15
|
+
let(:retry_data) { { worker: job[:workeer],
|
16
|
+
message: job[:message].merge({ tries: 2, run: false }) } }
|
17
17
|
|
18
18
|
describe "#run_job" do
|
19
19
|
it "should call dispatch" do
|
20
20
|
Dispatcher.any_instance.stub(:job).and_return(job)
|
21
|
+
Dispatcher.any_instance.stub(:retry_job).and_return(false)
|
21
22
|
Dispatcher.any_instance.stub(:dispatch).and_return(true)
|
22
23
|
dispatch = Dispatcher.new
|
23
24
|
dispatch.run_job.should be_true
|
@@ -26,48 +27,26 @@ module Writefully
|
|
26
27
|
|
27
28
|
it "should call retry_job" do
|
28
29
|
Dispatcher.any_instance.stub(:job).and_return(retry_data)
|
30
|
+
Dispatcher.any_instance.stub(:dispatch).and_return(false)
|
29
31
|
Dispatcher.any_instance.stub(:retry_job).and_return(true)
|
30
32
|
dispatch = Dispatcher.new
|
31
33
|
dispatch.run_job.should be_true
|
32
34
|
dispatch.terminate
|
33
35
|
end
|
34
|
-
|
35
|
-
it "should call retry_job" do
|
36
|
-
Dispatcher.any_instance.stub(:job).and_return(failure)
|
37
|
-
Dispatcher.any_instance.stub(:mark_as_failed).and_return(true)
|
38
|
-
dispatch = Dispatcher.new
|
39
|
-
dispatch.run_job.should be_true
|
40
|
-
dispatch.terminate
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
|
45
|
-
it "should be retry" do
|
46
|
-
Dispatcher.any_instance.stub(:job).and_return(retry_data)
|
47
|
-
dispatch = Dispatcher.new
|
48
|
-
dispatch.is_job?.should be_true
|
49
|
-
dispatch.job_valid?.should be_false
|
50
|
-
dispatch.is_retry?.should be_true
|
51
|
-
dispatch.retry_valid?.should be_true
|
52
|
-
dispatch.terminate
|
53
36
|
end
|
54
37
|
|
55
38
|
it "should be job and valid" do
|
56
39
|
Dispatcher.any_instance.stub(:job).and_return(job)
|
57
40
|
dispatch = Dispatcher.new
|
58
|
-
dispatch.is_job?.should be_true
|
59
41
|
dispatch.job_valid?.should be_true
|
60
|
-
dispatch.
|
42
|
+
dispatch.retry_valid?.should be_false
|
61
43
|
dispatch.terminate
|
62
44
|
end
|
63
45
|
|
64
|
-
it "should be
|
65
|
-
Dispatcher.any_instance.stub(:job).and_return(
|
46
|
+
it "should be retry" do
|
47
|
+
Dispatcher.any_instance.stub(:job).and_return(retry_data)
|
66
48
|
dispatch = Dispatcher.new
|
67
|
-
dispatch.
|
68
|
-
dispatch.job_valid?.should be_false
|
69
|
-
dispatch.is_retry?.should be_true
|
70
|
-
dispatch.retry_valid?.should be_false
|
49
|
+
dispatch.retry_valid?.should be_true
|
71
50
|
dispatch.terminate
|
72
51
|
end
|
73
52
|
end
|
@@ -7,7 +7,7 @@ module Writefully
|
|
7
7
|
module Workers
|
8
8
|
describe Journalist do
|
9
9
|
let(:message) { { resource: 'posts', slug: '1-hash-selector-pattern' } }
|
10
|
-
let(:message_with_tries) { message.merge({tries: 2}) }
|
10
|
+
let(:message_with_tries) { message.merge({tries: 2, run: false}) }
|
11
11
|
let(:pencil) { double("Pencil", perform: true) }
|
12
12
|
subject(:journalist) { Journalist.new }
|
13
13
|
|
data/spec/spec_helper.rb
CHANGED
@@ -42,7 +42,9 @@ RSpec.configure do |config|
|
|
42
42
|
# examples within a transaction, remove the following line or assign false
|
43
43
|
# instead of true.
|
44
44
|
config.use_transactional_fixtures = true
|
45
|
-
|
45
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
46
|
+
config.filter_run :focus => true
|
47
|
+
config.run_all_when_everything_filtered = true
|
46
48
|
# If true, the base class of anonymous controllers will be inferred
|
47
49
|
# automatically. This will be the default behavior in future versions of
|
48
50
|
# rspec-rails.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: writefully
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zack Siri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|