activeinteractor 1.0.1 → 1.1.0
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 +4 -4
- data/CHANGELOG.md +59 -1
- data/README.md +20 -5
- data/lib/active_interactor.rb +1 -0
- data/lib/active_interactor/config.rb +1 -1
- data/lib/active_interactor/context/attributes.rb +56 -11
- data/lib/active_interactor/context/base.rb +1 -0
- data/lib/active_interactor/context/errors.rb +47 -0
- data/lib/active_interactor/context/loader.rb +1 -1
- data/lib/active_interactor/context/status.rb +12 -19
- data/lib/active_interactor/interactor/context.rb +2 -1
- data/lib/active_interactor/interactor/perform.rb +5 -1
- data/lib/active_interactor/models.rb +13 -28
- data/lib/active_interactor/organizer/interactor_interface.rb +25 -8
- data/lib/active_interactor/organizer/interactor_interface_collection.rb +1 -0
- data/lib/active_interactor/organizer/perform.rb +11 -2
- data/lib/active_interactor/rails/orm/dynamoid.rb +5 -0
- data/lib/active_interactor/rails/orm/mongoid.rb +5 -0
- data/lib/active_interactor/version.rb +1 -1
- data/lib/rails/generators/templates/organizer.erb +2 -2
- data/spec/active_interactor/base_spec.rb +33 -0
- data/spec/active_interactor/context/base_spec.rb +44 -1
- data/spec/active_interactor/organizer/interactor_interface_spec.rb +74 -2
- data/spec/integration/a_basic_organizer_spec.rb +53 -1
- data/spec/integration/active_record_integration_spec.rb +8 -342
- data/spec/integration/an_organizer_with_failing_nested_organizer_spec.rb +47 -0
- data/spec/integration/an_organizer_with_options_callbacks_spec.rb +63 -0
- data/spec/spec_helper.rb +18 -8
- data/spec/support/shared_examples/a_class_that_extends_active_interactor_models_example.rb +81 -0
- metadata +40 -41
- data/spec/support/coverage.rb +0 -4
- data/spec/support/coverage/reporters.rb +0 -11
- data/spec/support/coverage/reporters/codacy.rb +0 -39
- data/spec/support/coverage/reporters/simple_cov.rb +0 -54
- data/spec/support/coverage/runner.rb +0 -66
@@ -1,66 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Spec
|
4
|
-
module Coverage
|
5
|
-
class Runner
|
6
|
-
attr_accessor :filtered_files, :formatters, :tracked_files
|
7
|
-
|
8
|
-
def self.start(&block)
|
9
|
-
instance = new
|
10
|
-
instance.instance_eval(&block) if block
|
11
|
-
instance.start
|
12
|
-
end
|
13
|
-
|
14
|
-
def initialize(options = {})
|
15
|
-
load_reporters!
|
16
|
-
@formatters = options[:formatters] || []
|
17
|
-
@filtered_files = options[:filtered_files] || []
|
18
|
-
@tracked_files = options[:tracked_files] || []
|
19
|
-
end
|
20
|
-
|
21
|
-
def add_formatter(formatter)
|
22
|
-
formatter_class = reporters[:formatters][formatter.to_sym]
|
23
|
-
formatters << formatter_class if formatter_class
|
24
|
-
self
|
25
|
-
end
|
26
|
-
|
27
|
-
def filter(pattern)
|
28
|
-
filtered_files << pattern
|
29
|
-
self
|
30
|
-
end
|
31
|
-
|
32
|
-
def start
|
33
|
-
initialize_reporters
|
34
|
-
run_reporters
|
35
|
-
end
|
36
|
-
|
37
|
-
def track(pattern)
|
38
|
-
tracked_files << pattern
|
39
|
-
self
|
40
|
-
end
|
41
|
-
|
42
|
-
private
|
43
|
-
|
44
|
-
attr_reader :reporters
|
45
|
-
|
46
|
-
def initialize_reporters
|
47
|
-
reporters[:initialize_steps].each { |step| step.call(self) }
|
48
|
-
end
|
49
|
-
|
50
|
-
def load_reporters!
|
51
|
-
@reporters = { formatters: {}, initialize_steps: [], run_steps: [] }
|
52
|
-
%w[SimpleCov Codacy].each do |dep|
|
53
|
-
reporter = Reporters.const_get(dep)
|
54
|
-
formatters, initialize_steps, run_steps = reporter.load
|
55
|
-
@reporters[:formatters].merge!(formatters)
|
56
|
-
@reporters[:initialize_steps].concat(initialize_steps)
|
57
|
-
@reporters[:run_steps].concat(run_steps)
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
def run_reporters
|
62
|
-
reporters[:run_steps].each { |step| step.call(self) }
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|