use_cases 0.2.7 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e37115bbba6763134166d41497c5b1bd75725618cfa81a0cca04dccdeda1590
|
4
|
+
data.tar.gz: bc732410906c5e053d75bf982561a34c663faafed062f5f6ccac006f4f1f3cee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7a9ff7502bf8b6db76f10a56d68a4d43055ecd54a106c50a37abde3543ba832611deb3561f03dd4a0a65e07642144b51620beede3701cb2f437634f39aab100
|
7
|
+
data.tar.gz: a170718b5d281df6f761b4c297d6cbb5ecfa0dbf5deb34ac01254dfd21a125898de4cf9935b05d49b73a2699c2007b52fcac1caa2e6c160d66e580307deec83a
|
@@ -2,30 +2,46 @@
|
|
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
8
|
expect(test_subject.failure.first).to eq expected_code
|
9
9
|
end
|
10
|
+
|
11
|
+
failure_message do |test_subject|
|
12
|
+
"the use case was expected to fail with code #{expected_code} but it returned #{test_subject.failure.first}"
|
13
|
+
end
|
10
14
|
end
|
11
15
|
|
12
|
-
RSpec::Matchers.define(:
|
16
|
+
RSpec::Matchers.define(:be_failure_with_payload) do |expected_result|
|
13
17
|
match do |test_subject|
|
14
18
|
expect(test_subject.failure?).to be true
|
15
19
|
expect(test_subject.failure.last).to eq expected_result
|
16
20
|
end
|
21
|
+
|
22
|
+
failure_message do |test_subject|
|
23
|
+
"the use case was expected to fail with #{expected_result.inspect} but it returned #{test_subject.failure.last.inspect}"
|
24
|
+
end
|
17
25
|
end
|
18
26
|
|
19
|
-
RSpec::Matchers.define(:
|
27
|
+
RSpec::Matchers.define(:be_failure_with) do |*expected_failure|
|
20
28
|
match do |test_subject|
|
21
29
|
expect(test_subject.failure?).to be true
|
22
30
|
expect(test_subject.failure).to eq expected_failure
|
23
31
|
end
|
32
|
+
|
33
|
+
failure_message do |test_subject|
|
34
|
+
"the use case was expected to fail with #{expected_result.inspect} but it returned #{test_subject.failure.inspect}"
|
35
|
+
end
|
24
36
|
end
|
25
37
|
|
26
|
-
RSpec::Matchers.define(:
|
38
|
+
RSpec::Matchers.define(:be_successful_with) do |expected_result|
|
27
39
|
match do |test_subject|
|
28
40
|
expect(test_subject.success?).to be true
|
29
41
|
expect(test_subject.success).to eq expected_result
|
30
42
|
end
|
43
|
+
|
44
|
+
failure_message do |test_subject|
|
45
|
+
"the use case was expected to succeed with #{expected_result.inspect} but it returned #{test_subject.success.inspect}"
|
46
|
+
end
|
31
47
|
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
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: use_cases
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ring Twice
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-10-
|
11
|
+
date: 2021-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|