use_cases 0.2.8 → 0.3.3
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77207afa5f5968912f856f321850ff0be1baca220af443e541f666a47ce73f53
|
4
|
+
data.tar.gz: e57443d5a9e82500bf3174b8fa8962b1dc0dff8e2bb761eadb15412a7ce117be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f6e3bb967a99f4fe28e5e5d75310e31b595a6943845d225fc29e46bed0d292f1b18b2057bd0cd1e443a8af2615f78210ae3918a18dd2fd0c879510fb238711a
|
7
|
+
data.tar.gz: d6981340c2c428f900071c605d712d06528cd463ff9c5271cd11f13a231e915b3dbf8944ac3fb737d8bcbd06d2fa4df3e80cc6fcd5ce49cae3f35fb455b38a97
|
@@ -2,30 +2,62 @@
|
|
2
2
|
|
3
3
|
require "rspec"
|
4
4
|
|
5
|
-
RSpec::Matchers.define(:
|
5
|
+
RSpec::Matchers.define(:be_failure_with_code) do |expected_code|
|
6
6
|
match do |test_subject|
|
7
7
|
expect(test_subject.failure?).to be true
|
8
|
-
expect(test_subject.failure.first).to
|
8
|
+
expect(test_subject.failure.first).to eql expected_code
|
9
|
+
end
|
10
|
+
|
11
|
+
failure_message do |test_subject|
|
12
|
+
if text_subject.failure?
|
13
|
+
"the use case was expected to fail with code #{expected_code} but it returned #{test_subject.failure.first}"
|
14
|
+
else
|
15
|
+
"the use case was expected to fail with code #{expected_code} but it did not fail"
|
16
|
+
end
|
9
17
|
end
|
10
18
|
end
|
11
19
|
|
12
|
-
RSpec::Matchers.define(:
|
20
|
+
RSpec::Matchers.define(:be_failure_with_payload) do |expected_result|
|
13
21
|
match do |test_subject|
|
14
22
|
expect(test_subject.failure?).to be true
|
15
|
-
expect(test_subject.failure.last).to
|
23
|
+
expect(test_subject.failure.last).to eql expected_result
|
16
24
|
end
|
25
|
+
|
26
|
+
failure_message do |test_subject|
|
27
|
+
if test_subject.failure?
|
28
|
+
"the use case was expected to fail with #{expected_result.inspect} but it returned #{test_subject.failure.last.inspect}"
|
29
|
+
else
|
30
|
+
"the use case was expected to fail but it succeeded with #{test_subject.success.inspect}"
|
31
|
+
end
|
32
|
+
end
|
17
33
|
end
|
18
34
|
|
19
|
-
RSpec::Matchers.define(:
|
35
|
+
RSpec::Matchers.define(:be_failure_with) do |*expected_failure|
|
20
36
|
match do |test_subject|
|
21
37
|
expect(test_subject.failure?).to be true
|
22
|
-
expect(test_subject.failure).to
|
38
|
+
expect(test_subject.failure).to eql expected_failure
|
23
39
|
end
|
40
|
+
|
41
|
+
failure_message do |test_subject|
|
42
|
+
if test_subject.failure?
|
43
|
+
"the use case was expected to fail with #{expected_result.inspect} but it returned #{test_subject.failure.inspect}"
|
44
|
+
else
|
45
|
+
"the use case was expected to fail but it succeeded with #{test_subject.success.inspect}"
|
46
|
+
end
|
47
|
+
end
|
24
48
|
end
|
25
49
|
|
26
|
-
RSpec::Matchers.define(:
|
50
|
+
RSpec::Matchers.define(:be_successful_with) do |expected_result|
|
27
51
|
match do |test_subject|
|
28
52
|
expect(test_subject.success?).to be true
|
29
|
-
expect(test_subject.success).to
|
53
|
+
expect(test_subject.success).to eql expected_result
|
30
54
|
end
|
55
|
+
|
56
|
+
failure_message do |test_subject|
|
57
|
+
if test_subject.success?
|
58
|
+
"the use case was expected to succeed with #{expected_result.inspect} but it returned #{test_subject.success.inspect}"
|
59
|
+
else
|
60
|
+
"the use case was expected to succeed but it failed with #{test_subject.failure.inspect}"
|
61
|
+
end
|
62
|
+
end
|
31
63
|
end
|
@@ -26,14 +26,13 @@ module UseCases
|
|
26
26
|
def self.serialize_step_arguments(args)
|
27
27
|
args.select.map.with_index do |arg, index|
|
28
28
|
ActiveJob::Arguments.send(:serialize_argument, arg)
|
29
|
-
false
|
30
29
|
rescue ActiveJob::SerializationError => _e
|
31
|
-
|
32
|
-
|
30
|
+
arg.serialize.merge("_serialized_by_use_case" => true, "_class" => arg.class.name)
|
33
31
|
rescue NoMethodError => _e
|
34
32
|
puts "[WARNING] #{arg} of class (#{arg.clas}) (index = #{index})" \
|
35
33
|
"is not serializable and does not repond to #serialize and will be ignored."
|
36
|
-
|
34
|
+
else
|
35
|
+
arg
|
37
36
|
end
|
38
37
|
end
|
39
38
|
end
|
@@ -6,7 +6,7 @@ module UseCases
|
|
6
6
|
def do_call(*base_args)
|
7
7
|
args = [object.class.name, name.to_s, *base_args]
|
8
8
|
args = ::UseCases::StepActiveJobAdapter.serialize_step_arguments(args)
|
9
|
-
|
9
|
+
byebug
|
10
10
|
job_options = options.slice(:queue, :wait, :wait_until, :priority)
|
11
11
|
|
12
12
|
::UseCases::StepActiveJobAdapter.set(job_options).perform_later(*args)
|
data/lib/use_cases/version.rb
CHANGED