activeinteractor 1.1.1 → 1.1.4
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 +28 -1
- data/README.md +10 -29
- data/lib/active_interactor/context/errors.rb +11 -1
- data/lib/active_interactor/version.rb +41 -3
- data/spec/active_interactor/base_spec.rb +1 -0
- data/spec/active_interactor/config_spec.rb +1 -0
- data/spec/active_interactor/context/base_spec.rb +16 -0
- data/spec/active_interactor/error_spec.rb +3 -1
- data/spec/active_interactor/interactor/worker_spec.rb +3 -0
- data/spec/active_interactor/organizer/base_spec.rb +18 -1
- data/spec/active_interactor/organizer/interactor_interface_collection_spec.rb +2 -0
- data/spec/active_interactor/organizer/interactor_interface_spec.rb +1 -0
- data/spec/active_interactor/version_spec.rb +119 -0
- data/spec/active_interactor_spec.rb +0 -6
- data/spec/integration/a_basic_organizer_spec.rb +7 -0
- data/spec/integration/a_failing_interactor_spec.rb +1 -0
- data/spec/integration/an_interactor_with_after_perform_callbacks_spec.rb +1 -0
- data/spec/integration/an_interactor_with_after_rollback_callbacks_spec.rb +1 -0
- data/spec/integration/an_interactor_with_an_existing_context_class_spec.rb +1 -0
- data/spec/integration/an_interactor_with_before_perform_callbacks_spec.rb +1 -0
- data/spec/integration/an_interactor_with_before_rollback_callbacks_spec.rb +1 -0
- data/spec/integration/an_interactor_with_validations_on_called_spec.rb +1 -0
- data/spec/integration/an_interactor_with_validations_on_calling_spec.rb +1 -0
- data/spec/integration/an_interactor_with_validations_spec.rb +2 -0
- data/spec/integration/an_organizer_with_after_each_callbacks_spec.rb +1 -0
- data/spec/integration/an_organizer_with_before_each_callbacks_spec.rb +1 -0
- data/spec/integration/an_organizer_with_conditionally_organized_interactors_spec.rb +14 -2
- data/spec/integration/an_organizer_with_options_callbacks_spec.rb +1 -0
- data/spec/spec_helper.rb +3 -20
- data/spec/support/coverage.rb +50 -0
- data/spec/support/shared_examples/a_class_with_interactor_callback_methods_example.rb +8 -0
- data/spec/support/shared_examples/a_class_with_interactor_context_methods_example.rb +2 -0
- data/spec/support/shared_examples/a_class_with_organizer_callback_methods_example.rb +3 -0
- metadata +45 -41
@@ -60,11 +60,13 @@ RSpec.describe 'A basic organizer', type: :integration do
|
|
60
60
|
it { expect { subject }.not_to raise_error }
|
61
61
|
it { is_expected.to be_a interactor_class.context_class }
|
62
62
|
it { is_expected.to be_failure }
|
63
|
+
|
63
64
|
it 'is expected to receive #rollback on the first interactor' do
|
64
65
|
expect_any_instance_of(test_interactor_1).to receive(:rollback)
|
65
66
|
.and_call_original
|
66
67
|
subject
|
67
68
|
end
|
69
|
+
|
68
70
|
it 'is expected not to receive #perform! on the second interactor' do
|
69
71
|
expect_any_instance_of(test_interactor_2).not_to receive(:perform!)
|
70
72
|
subject
|
@@ -84,6 +86,7 @@ RSpec.describe 'A basic organizer', type: :integration do
|
|
84
86
|
it { is_expected.to be_a interactor_class.context_class }
|
85
87
|
it { is_expected.to be_failure }
|
86
88
|
it { expect(subject.errors.count).to eq 1 }
|
89
|
+
|
87
90
|
it 'is expected to have errors "something went wrong" on :context' do
|
88
91
|
expect(subject.errors[:context]).not_to be_empty
|
89
92
|
expect(subject.errors[:context]).to include 'something went wrong'
|
@@ -107,6 +110,7 @@ RSpec.describe 'A basic organizer', type: :integration do
|
|
107
110
|
it { expect { subject }.not_to raise_error }
|
108
111
|
it { is_expected.to be_a interactor_class.context_class }
|
109
112
|
it { is_expected.to be_failure }
|
113
|
+
|
110
114
|
it 'is expected to receive #rollback on all interactors' do
|
111
115
|
expect_any_instance_of(test_interactor_2).to receive(:rollback)
|
112
116
|
expect_any_instance_of(test_interactor_1).to receive(:rollback)
|
@@ -127,6 +131,7 @@ RSpec.describe 'A basic organizer', type: :integration do
|
|
127
131
|
it { is_expected.to be_a interactor_class.context_class }
|
128
132
|
it { is_expected.to be_failure }
|
129
133
|
it { expect(subject.errors.count).to eq 1 }
|
134
|
+
|
130
135
|
it 'is expected to have errors "something went wrong" on :context' do
|
131
136
|
expect(subject.errors[:context]).not_to be_empty
|
132
137
|
expect(subject.errors[:context]).to include 'something went wrong'
|
@@ -175,6 +180,7 @@ RSpec.describe 'A basic organizer', type: :integration do
|
|
175
180
|
|
176
181
|
describe '.perform' do
|
177
182
|
subject(:result) { interactor_class.perform(context_attributes) }
|
183
|
+
|
178
184
|
it { is_expected.to have_attributes(foo: 'foo', bar: 'bar', baz: 'baz', zoo: 'zoo') }
|
179
185
|
|
180
186
|
it 'is expected to copy all attributes in the contexts to each interactor' do
|
@@ -206,6 +212,7 @@ RSpec.describe 'A basic organizer', type: :integration do
|
|
206
212
|
|
207
213
|
describe '.perform' do
|
208
214
|
subject(:result) { interactor_class.perform(context_attributes) }
|
215
|
+
|
209
216
|
it { is_expected.to have_attributes(foo: 'foo', bar: 'bar') }
|
210
217
|
|
211
218
|
it 'is expected to copy all attributes in the contexts to each interactor' do
|
@@ -28,6 +28,7 @@ RSpec.describe 'A failing interactor', type: :integration do
|
|
28
28
|
it { expect { subject }.not_to raise_error }
|
29
29
|
it { is_expected.to be_a interactor_class.context_class }
|
30
30
|
it { is_expected.to be_failure }
|
31
|
+
|
31
32
|
it 'is expected to receive #rollback' do
|
32
33
|
expect_any_instance_of(interactor_class).to receive(:rollback)
|
33
34
|
subject
|
@@ -22,6 +22,7 @@ RSpec.describe 'An interactor with .after_perform callbacks', type: :integration
|
|
22
22
|
|
23
23
|
it { is_expected.to be_a interactor_class.context_class }
|
24
24
|
it { is_expected.to be_successful }
|
25
|
+
|
25
26
|
it 'is expected to receive #test_after_perform' do
|
26
27
|
expect_any_instance_of(interactor_class).to receive(:test_after_perform)
|
27
28
|
subject
|
@@ -25,6 +25,7 @@ RSpec.describe 'An interactor with .after_rollback callbacks', type: :integratio
|
|
25
25
|
subject { interactor_class.perform }
|
26
26
|
|
27
27
|
it { is_expected.to be_a interactor_class.context_class }
|
28
|
+
|
28
29
|
it 'is expected to receive #test_after_rollback' do
|
29
30
|
expect_any_instance_of(interactor_class).to receive(:test_after_rollback)
|
30
31
|
subject
|
@@ -39,6 +39,7 @@ RSpec.describe 'An interactor with an existing .context_class', type: :integrati
|
|
39
39
|
|
40
40
|
it { is_expected.to be_an AnInteractorContext }
|
41
41
|
it { is_expected.to be_failure }
|
42
|
+
|
42
43
|
it 'is expected to have errors on :some_field' do
|
43
44
|
expect(subject.errors[:test_field]).not_to be_nil
|
44
45
|
end
|
@@ -22,6 +22,7 @@ RSpec.describe 'An interactor with .before_perform callbacks', type: :integratio
|
|
22
22
|
|
23
23
|
it { is_expected.to be_a interactor_class.context_class }
|
24
24
|
it { is_expected.to be_successful }
|
25
|
+
|
25
26
|
it 'is expected to receive #test_before_perform' do
|
26
27
|
expect_any_instance_of(interactor_class).to receive(:test_before_perform)
|
27
28
|
subject
|
@@ -25,6 +25,7 @@ RSpec.describe 'An interactor with .before_rollback callbacks', type: :integrati
|
|
25
25
|
subject { interactor_class.perform }
|
26
26
|
|
27
27
|
it { is_expected.to be_a interactor_class.context_class }
|
28
|
+
|
28
29
|
it 'is expected to receive #test_before_rollback' do
|
29
30
|
expect_any_instance_of(interactor_class).to receive(:test_before_rollback)
|
30
31
|
subject
|
@@ -32,6 +32,7 @@ RSpec.describe 'An interactor with validations on :called', type: :integration d
|
|
32
32
|
|
33
33
|
it { is_expected.to be_an TestInteractor::Context }
|
34
34
|
it { is_expected.to be_failure }
|
35
|
+
|
35
36
|
it 'is expected to have errors on :some_field' do
|
36
37
|
expect(subject.errors[:test_field]).not_to be_nil
|
37
38
|
end
|
@@ -28,6 +28,7 @@ RSpec.describe 'An interactor with validations on :calling', type: :integration
|
|
28
28
|
|
29
29
|
it { is_expected.to be_an TestInteractor::Context }
|
30
30
|
it { is_expected.to be_failure }
|
31
|
+
|
31
32
|
it 'is expected to have errors on :some_field' do
|
32
33
|
expect(subject.errors[:test_field]).not_to be_nil
|
33
34
|
end
|
@@ -38,6 +38,7 @@ RSpec.describe 'An interactor with validations', type: :integration do
|
|
38
38
|
it { is_expected.to be_a interactor_class.context_class }
|
39
39
|
it { is_expected.to be_failure }
|
40
40
|
it { is_expected.to have_attributes(other_field: 'failed') }
|
41
|
+
|
41
42
|
it 'is expected to have errors on :test_field' do
|
42
43
|
expect(subject.errors[:test_field]).not_to be_nil
|
43
44
|
end
|
@@ -84,6 +85,7 @@ RSpec.describe 'An interactor with validations', type: :integration do
|
|
84
85
|
it { is_expected.to be_a interactor_class.context_class }
|
85
86
|
it { is_expected.to be_failure }
|
86
87
|
it { is_expected.to have_attributes(test_condition: true, other_field: 'failed') }
|
88
|
+
|
87
89
|
it 'is expected to have errors on :test_field' do
|
88
90
|
expect(subject.errors[:test_field]).not_to be_nil
|
89
91
|
end
|
@@ -25,6 +25,7 @@ RSpec.describe 'An organizer with .after_each callbacks', type: :integration do
|
|
25
25
|
subject { interactor_class.perform }
|
26
26
|
|
27
27
|
it { is_expected.to be_a interactor_class.context_class }
|
28
|
+
|
28
29
|
it 'is expected to receive #test_after_each_perform twice' do
|
29
30
|
expect_any_instance_of(interactor_class).to receive(:test_after_each_perform)
|
30
31
|
.exactly(:twice)
|
@@ -25,6 +25,7 @@ RSpec.describe 'An organizer with .before_each callbacks', type: :integration do
|
|
25
25
|
subject { interactor_class.perform }
|
26
26
|
|
27
27
|
it { is_expected.to be_a interactor_class.context_class }
|
28
|
+
|
28
29
|
it 'is expected to receive #test_before_each_perform twice' do
|
29
30
|
expect_any_instance_of(interactor_class).to receive(:test_before_each_perform)
|
30
31
|
.exactly(:twice)
|
@@ -7,7 +7,7 @@ RSpec.describe 'An organizer with conditionally organized interactors', type: :i
|
|
7
7
|
let!(:test_interactor_2) { build_interactor('TestInteractor2') }
|
8
8
|
|
9
9
|
context 'with a condition on the first interactor { :if => -> { context.test_1 } } ' \
|
10
|
-
|
10
|
+
'and a condition on the second interactor { :if => -> { context.test_2 } }' do
|
11
11
|
let(:interactor_class) do
|
12
12
|
build_organizer do
|
13
13
|
organize do
|
@@ -30,6 +30,7 @@ RSpec.describe 'An organizer with conditionally organized interactors', type: :i
|
|
30
30
|
|
31
31
|
it { is_expected.to be_a interactor_class.context_class }
|
32
32
|
it { is_expected.to be_successful }
|
33
|
+
|
33
34
|
it 'is expected to receive #perform on both interactors' do
|
34
35
|
expect_any_instance_of(test_interactor_1).to receive(:perform)
|
35
36
|
expect_any_instance_of(test_interactor_2).to receive(:perform)
|
@@ -42,6 +43,7 @@ RSpec.describe 'An organizer with conditionally organized interactors', type: :i
|
|
42
43
|
|
43
44
|
it { is_expected.to be_a interactor_class.context_class }
|
44
45
|
it { is_expected.to be_successful }
|
46
|
+
|
45
47
|
it 'is expected to receive #perform on the first interactor' do
|
46
48
|
expect_any_instance_of(test_interactor_1).to receive(:perform)
|
47
49
|
subject
|
@@ -58,6 +60,7 @@ RSpec.describe 'An organizer with conditionally organized interactors', type: :i
|
|
58
60
|
|
59
61
|
it { is_expected.to be_a interactor_class.context_class }
|
60
62
|
it { is_expected.to be_successful }
|
63
|
+
|
61
64
|
it 'is expected not to receive #perform on the first interactor' do
|
62
65
|
expect_any_instance_of(test_interactor_1).not_to receive(:perform)
|
63
66
|
subject
|
@@ -74,6 +77,7 @@ RSpec.describe 'An organizer with conditionally organized interactors', type: :i
|
|
74
77
|
|
75
78
|
it { is_expected.to be_a interactor_class.context_class }
|
76
79
|
it { is_expected.to be_successful }
|
80
|
+
|
77
81
|
it 'is expected not to receive #perform on the first interactor' do
|
78
82
|
expect_any_instance_of(test_interactor_1).not_to receive(:perform)
|
79
83
|
subject
|
@@ -88,7 +92,7 @@ RSpec.describe 'An organizer with conditionally organized interactors', type: :i
|
|
88
92
|
end
|
89
93
|
|
90
94
|
context 'with a condition on the first interactor { :unless => -> { context.test_1 } } ' \
|
91
|
-
|
95
|
+
'and a condition on the second interactor { :unless => -> { context.test_2 } }' do
|
92
96
|
let(:interactor_class) do
|
93
97
|
build_organizer do
|
94
98
|
organize do
|
@@ -111,6 +115,7 @@ RSpec.describe 'An organizer with conditionally organized interactors', type: :i
|
|
111
115
|
|
112
116
|
it { is_expected.to be_a interactor_class.context_class }
|
113
117
|
it { is_expected.to be_successful }
|
118
|
+
|
114
119
|
it 'is expected not to receive #perform on the first interactor' do
|
115
120
|
expect_any_instance_of(test_interactor_1).not_to receive(:perform)
|
116
121
|
subject
|
@@ -127,6 +132,7 @@ RSpec.describe 'An organizer with conditionally organized interactors', type: :i
|
|
127
132
|
|
128
133
|
it { is_expected.to be_a interactor_class.context_class }
|
129
134
|
it { is_expected.to be_successful }
|
135
|
+
|
130
136
|
it 'is expected not to receive #perform on the first interactor' do
|
131
137
|
expect_any_instance_of(test_interactor_1).not_to receive(:perform)
|
132
138
|
subject
|
@@ -143,6 +149,7 @@ RSpec.describe 'An organizer with conditionally organized interactors', type: :i
|
|
143
149
|
|
144
150
|
it { is_expected.to be_a interactor_class.context_class }
|
145
151
|
it { is_expected.to be_successful }
|
152
|
+
|
146
153
|
it 'is expected to receive #perform on the first interactor' do
|
147
154
|
expect_any_instance_of(test_interactor_1).to receive(:perform)
|
148
155
|
subject
|
@@ -159,6 +166,7 @@ RSpec.describe 'An organizer with conditionally organized interactors', type: :i
|
|
159
166
|
|
160
167
|
it { is_expected.to be_a interactor_class.context_class }
|
161
168
|
it { is_expected.to be_successful }
|
169
|
+
|
162
170
|
it 'is expected to receive #perform on both interactors' do
|
163
171
|
expect_any_instance_of(test_interactor_1).to receive(:perform)
|
164
172
|
expect_any_instance_of(test_interactor_2).to receive(:perform)
|
@@ -194,6 +202,7 @@ RSpec.describe 'An organizer with conditionally organized interactors', type: :i
|
|
194
202
|
|
195
203
|
it { is_expected.to be_a interactor_class.context_class }
|
196
204
|
it { is_expected.to be_successful }
|
205
|
+
|
197
206
|
it 'is expected to receive #perform on both interactors' do
|
198
207
|
expect_any_instance_of(test_interactor_1).to receive(:perform)
|
199
208
|
expect_any_instance_of(test_interactor_2).to receive(:perform)
|
@@ -228,6 +237,7 @@ RSpec.describe 'An organizer with conditionally organized interactors', type: :i
|
|
228
237
|
|
229
238
|
it { is_expected.to be_a interactor_class.context_class }
|
230
239
|
it { is_expected.to be_successful }
|
240
|
+
|
231
241
|
it 'is expected not to receive #perform on the first interactor' do
|
232
242
|
expect_any_instance_of(test_interactor_1).not_to receive(:perform)
|
233
243
|
subject
|
@@ -266,6 +276,7 @@ RSpec.describe 'An organizer with conditionally organized interactors', type: :i
|
|
266
276
|
|
267
277
|
it { is_expected.to be_a interactor_class.context_class }
|
268
278
|
it { is_expected.to be_successful }
|
279
|
+
|
269
280
|
it 'is expected not to receive #perform on the first interactor' do
|
270
281
|
expect_any_instance_of(test_interactor_1).not_to receive(:perform)
|
271
282
|
subject
|
@@ -304,6 +315,7 @@ RSpec.describe 'An organizer with conditionally organized interactors', type: :i
|
|
304
315
|
|
305
316
|
it { is_expected.to be_a interactor_class.context_class }
|
306
317
|
it { is_expected.to be_successful }
|
318
|
+
|
307
319
|
it 'is expected to receive #perform on both interactors' do
|
308
320
|
expect_any_instance_of(test_interactor_1).to receive(:perform)
|
309
321
|
expect_any_instance_of(test_interactor_2).to receive(:perform)
|
@@ -44,6 +44,7 @@ RSpec.describe 'An organizer with options callbacks', type: :integration do
|
|
44
44
|
subject { interactor_class.perform(step: 1) }
|
45
45
|
|
46
46
|
it { is_expected.to be_a interactor_class.context_class }
|
47
|
+
|
47
48
|
it 'is expected to receive #test_before_method once' do
|
48
49
|
expect_any_instance_of(interactor_class).to receive(:test_before_method)
|
49
50
|
.exactly(:once)
|
data/spec/spec_helper.rb
CHANGED
@@ -1,24 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
require 'simplecov-lcov'
|
6
|
-
|
7
|
-
SimpleCov::Formatter::LcovFormatter.config.report_with_single_file = true
|
8
|
-
|
9
|
-
SimpleCov.start do
|
10
|
-
enable_coverage :branch
|
11
|
-
add_filter '/spec/'
|
12
|
-
add_filter '/lib/rails/**/*.rb'
|
13
|
-
track_files '/lib/**/*.rb'
|
14
|
-
formatter SimpleCov::Formatter::MultiFormatter.new([
|
15
|
-
SimpleCov::Formatter::HTMLFormatter,
|
16
|
-
SimpleCov::Formatter::LcovFormatter
|
17
|
-
])
|
18
|
-
end
|
19
|
-
rescue LoadError
|
20
|
-
puts 'Skipping coverage...'
|
21
|
-
end
|
3
|
+
require_relative 'support/coverage'
|
4
|
+
ActiveInteractor::Spec::Coverage.start
|
22
5
|
|
23
6
|
require 'bundler/setup'
|
24
7
|
require 'active_interactor'
|
@@ -32,7 +15,7 @@ RSpec.configure do |config|
|
|
32
15
|
allow(ActiveInteractor.logger).to receive(:error).and_return(true)
|
33
16
|
end
|
34
17
|
|
35
|
-
config.after
|
18
|
+
config.after do
|
36
19
|
clean_factories!
|
37
20
|
end
|
38
21
|
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'simplecov'
|
4
|
+
require 'simplecov-lcov'
|
5
|
+
|
6
|
+
module ActiveInteractor
|
7
|
+
module Spec
|
8
|
+
class Coverage
|
9
|
+
DEFAULT_COVERAGE_TYPE = 'unit'
|
10
|
+
EXCLUDED_FILES_PATTERN = '/spec/'
|
11
|
+
TRACKED_FILES_PATTERN = 'lib/**/*.rb'
|
12
|
+
|
13
|
+
FORMATTERS = [
|
14
|
+
SimpleCov::Formatter::HTMLFormatter,
|
15
|
+
SimpleCov::Formatter::LcovFormatter
|
16
|
+
].freeze
|
17
|
+
|
18
|
+
class << self
|
19
|
+
def start
|
20
|
+
setup_lcov_formatter
|
21
|
+
start_simplecov
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def simplecov_formatter
|
27
|
+
@simplecov_formatter ||= SimpleCov::Formatter::MultiFormatter.new(FORMATTERS)
|
28
|
+
end
|
29
|
+
|
30
|
+
def setup_lcov_formatter
|
31
|
+
coverage_type = ENV.fetch('COVERAGE_TYPE', DEFAULT_COVERAGE_TYPE)
|
32
|
+
|
33
|
+
SimpleCov::Formatter::LcovFormatter.config do |config|
|
34
|
+
config.report_with_single_file = true
|
35
|
+
config.single_report_path = "coverage/#{coverage_type}_lcov.info"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def start_simplecov
|
40
|
+
SimpleCov.start do
|
41
|
+
add_filter EXCLUDED_FILES_PATTERN
|
42
|
+
enable_coverage :branch
|
43
|
+
track_files TRACKED_FILES_PATTERN
|
44
|
+
formatter simplecov_formatter
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -3,6 +3,7 @@
|
|
3
3
|
RSpec.shared_examples 'a class with interactor callback methods' do
|
4
4
|
describe '.after_context_validation' do
|
5
5
|
subject { interactor_class.after_context_validation(*args) }
|
6
|
+
|
6
7
|
let(:args) { :some_method }
|
7
8
|
|
8
9
|
it 'is expected to receive #set_callback with :validation, :after, :some_method, { :prepend => true }' do
|
@@ -15,6 +16,7 @@ RSpec.shared_examples 'a class with interactor callback methods' do
|
|
15
16
|
|
16
17
|
describe '.after_perform' do
|
17
18
|
subject { interactor_class.after_perform(*args) }
|
19
|
+
|
18
20
|
let(:args) { :some_method }
|
19
21
|
|
20
22
|
it 'is expected to receive #set_callback with :perform, :after, :some_method' do
|
@@ -27,6 +29,7 @@ RSpec.shared_examples 'a class with interactor callback methods' do
|
|
27
29
|
|
28
30
|
describe '.after_rollback' do
|
29
31
|
subject { interactor_class.after_rollback(*args) }
|
32
|
+
|
30
33
|
let(:args) { :some_method }
|
31
34
|
|
32
35
|
it 'is expected to receive #set_callback with :rollback, :after, :some_method' do
|
@@ -39,6 +42,7 @@ RSpec.shared_examples 'a class with interactor callback methods' do
|
|
39
42
|
|
40
43
|
describe '.around_perform' do
|
41
44
|
subject { interactor_class.around_perform(*args) }
|
45
|
+
|
42
46
|
let(:args) { :some_method }
|
43
47
|
|
44
48
|
it 'is expected to receive #set_callback with :perform, :around, :some_method' do
|
@@ -51,6 +55,7 @@ RSpec.shared_examples 'a class with interactor callback methods' do
|
|
51
55
|
|
52
56
|
describe '.around_rollback' do
|
53
57
|
subject { interactor_class.around_rollback(*args) }
|
58
|
+
|
54
59
|
let(:args) { :some_method }
|
55
60
|
|
56
61
|
it 'is expected to receive #set_callback with :rollback, :around, :some_method' do
|
@@ -63,6 +68,7 @@ RSpec.shared_examples 'a class with interactor callback methods' do
|
|
63
68
|
|
64
69
|
describe '.before_context_validation' do
|
65
70
|
subject { interactor_class.before_context_validation(*args) }
|
71
|
+
|
66
72
|
let(:args) { :some_method }
|
67
73
|
|
68
74
|
it 'is expected to receive #set_callback with :validation, :before, :some_method' do
|
@@ -75,6 +81,7 @@ RSpec.shared_examples 'a class with interactor callback methods' do
|
|
75
81
|
|
76
82
|
describe '.before_perform' do
|
77
83
|
subject { interactor_class.before_perform(*args) }
|
84
|
+
|
78
85
|
let(:args) { :some_method }
|
79
86
|
|
80
87
|
it 'is expected to receive #set_callback with :perform, :before, :some_method' do
|
@@ -87,6 +94,7 @@ RSpec.shared_examples 'a class with interactor callback methods' do
|
|
87
94
|
|
88
95
|
describe '.before_rollback' do
|
89
96
|
subject { interactor_class.before_rollback(*args) }
|
97
|
+
|
90
98
|
let(:args) { :some_method }
|
91
99
|
|
92
100
|
it 'is expected to receive #set_callback with :rollback, :before, :some_method' do
|
@@ -3,6 +3,7 @@
|
|
3
3
|
RSpec.shared_examples 'a class with interactor context methods' do
|
4
4
|
describe '.context_attributes' do
|
5
5
|
subject { interactor_class.context_attributes(attributes) }
|
6
|
+
|
6
7
|
let(:attributes) { :some_attribute }
|
7
8
|
|
8
9
|
it 'is expected to receive #attributes on .context_class with :some_attribute' do
|
@@ -45,6 +46,7 @@ RSpec.shared_examples 'a class with interactor context methods' do
|
|
45
46
|
|
46
47
|
describe '#finalize_context!' do
|
47
48
|
subject { instance.finalize_context! }
|
49
|
+
|
48
50
|
let(:instance) { interactor_class.new }
|
49
51
|
|
50
52
|
it 'is expected to receive #called! on instance of .context_class' do
|
@@ -3,6 +3,7 @@
|
|
3
3
|
RSpec.shared_examples 'a class with organizer callback methods' do
|
4
4
|
describe '.after_each_perform' do
|
5
5
|
subject { interactor_class.after_each_perform(*args) }
|
6
|
+
|
6
7
|
let(:args) { :some_method }
|
7
8
|
|
8
9
|
it 'is expected to receive #set_callback with :each_perform, :after, :some_method' do
|
@@ -15,6 +16,7 @@ RSpec.shared_examples 'a class with organizer callback methods' do
|
|
15
16
|
|
16
17
|
describe '.around_each_perform' do
|
17
18
|
subject { interactor_class.around_each_perform(*args) }
|
19
|
+
|
18
20
|
let(:args) { :some_method }
|
19
21
|
|
20
22
|
it 'is expected to receive #set_callback with :each_perform, :around, :some_method' do
|
@@ -27,6 +29,7 @@ RSpec.shared_examples 'a class with organizer callback methods' do
|
|
27
29
|
|
28
30
|
describe '.before_each_perform' do
|
29
31
|
subject { interactor_class.before_each_perform(*args) }
|
32
|
+
|
30
33
|
let(:args) { :some_method }
|
31
34
|
|
32
35
|
it 'is expected to receive #set_callback with :each_perform, :before, :some_method' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeinteractor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Allen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -17,9 +17,9 @@ dependencies:
|
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '4.2'
|
20
|
-
- - "
|
20
|
+
- - "<="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
22
|
+
version: 6.1.4.6
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -27,9 +27,9 @@ dependencies:
|
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '4.2'
|
30
|
-
- - "
|
30
|
+
- - "<="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
32
|
+
version: 6.1.4.6
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: activesupport
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -37,9 +37,9 @@ dependencies:
|
|
37
37
|
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: '4.2'
|
40
|
-
- - "
|
40
|
+
- - "<="
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
42
|
+
version: 6.1.4.6
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -47,9 +47,9 @@ dependencies:
|
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: '4.2'
|
50
|
-
- - "
|
50
|
+
- - "<="
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version:
|
52
|
+
version: 6.1.4.6
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: bundler
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -167,6 +167,7 @@ files:
|
|
167
167
|
- spec/active_interactor/organizer/base_spec.rb
|
168
168
|
- spec/active_interactor/organizer/interactor_interface_collection_spec.rb
|
169
169
|
- spec/active_interactor/organizer/interactor_interface_spec.rb
|
170
|
+
- spec/active_interactor/version_spec.rb
|
170
171
|
- spec/active_interactor_spec.rb
|
171
172
|
- spec/integration/a_basic_interactor_spec.rb
|
172
173
|
- spec/integration/a_basic_organizer_spec.rb
|
@@ -191,6 +192,7 @@ files:
|
|
191
192
|
- spec/integration/an_organizer_with_failing_nested_organizer_spec.rb
|
192
193
|
- spec/integration/an_organizer_with_options_callbacks_spec.rb
|
193
194
|
- spec/spec_helper.rb
|
195
|
+
- spec/support/coverage.rb
|
194
196
|
- spec/support/helpers/factories.rb
|
195
197
|
- spec/support/shared_examples/a_class_that_extends_active_interactor_models_example.rb
|
196
198
|
- spec/support/shared_examples/a_class_with_interactor_callback_methods_example.rb
|
@@ -203,10 +205,10 @@ licenses:
|
|
203
205
|
- MIT
|
204
206
|
metadata:
|
205
207
|
bug_tracker_uri: https://github.com/aaronmallen/activeinteractor/issues
|
206
|
-
changelog_uri: https://github.com/aaronmallen/activeinteractor/blob/v1.1.
|
207
|
-
documentation_uri: https://www.rubydoc.info/gems/activeinteractor/1.1.
|
208
|
+
changelog_uri: https://github.com/aaronmallen/activeinteractor/blob/v1.1.4/CHANGELOG.md
|
209
|
+
documentation_uri: https://www.rubydoc.info/gems/activeinteractor/1.1.4
|
208
210
|
hompage_uri: https://github.com/aaronmallen/activeinteractor
|
209
|
-
source_code_uri: https://github.com/aaronmallen/activeinteractor/tree/v1.1.
|
211
|
+
source_code_uri: https://github.com/aaronmallen/activeinteractor/tree/v1.1.4
|
210
212
|
wiki_uri: https://github.com/aaronmallen/activeinteractor/wiki
|
211
213
|
post_install_message:
|
212
214
|
rdoc_options: []
|
@@ -223,48 +225,50 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
223
225
|
- !ruby/object:Gem::Version
|
224
226
|
version: '0'
|
225
227
|
requirements: []
|
226
|
-
rubygems_version: 3.0.3
|
228
|
+
rubygems_version: 3.0.3.1
|
227
229
|
signing_key:
|
228
230
|
specification_version: 4
|
229
231
|
summary: Ruby interactors with ActiveModel::Validations
|
230
232
|
test_files:
|
233
|
+
- spec/support/coverage.rb
|
234
|
+
- spec/support/spec_helpers.rb
|
231
235
|
- spec/support/shared_examples/a_class_that_extends_active_interactor_models_example.rb
|
232
|
-
- spec/support/shared_examples/a_class_with_interactor_context_methods_example.rb
|
233
|
-
- spec/support/shared_examples/a_class_with_interactor_callback_methods_example.rb
|
234
236
|
- spec/support/shared_examples/a_class_with_interactor_methods_example.rb
|
235
237
|
- spec/support/shared_examples/a_class_with_organizer_callback_methods_example.rb
|
236
|
-
- spec/support/
|
238
|
+
- spec/support/shared_examples/a_class_with_interactor_context_methods_example.rb
|
239
|
+
- spec/support/shared_examples/a_class_with_interactor_callback_methods_example.rb
|
237
240
|
- spec/support/helpers/factories.rb
|
238
|
-
- spec/
|
239
|
-
- spec/
|
240
|
-
- spec/
|
241
|
-
- spec/active_interactor/config_spec.rb
|
242
|
-
- spec/active_interactor/interactor/perform/options_spec.rb
|
243
|
-
- spec/active_interactor/interactor/worker_spec.rb
|
244
|
-
- spec/active_interactor/error_spec.rb
|
245
|
-
- spec/active_interactor/base_spec.rb
|
246
|
-
- spec/active_interactor/context/base_spec.rb
|
247
|
-
- spec/integration/an_interactor_with_validations_spec.rb
|
241
|
+
- spec/active_interactor_spec.rb
|
242
|
+
- spec/integration/an_interactor_with_after_rollback_callbacks_spec.rb
|
243
|
+
- spec/integration/an_interactor_with_around_rollback_callbacks_spec.rb
|
248
244
|
- spec/integration/a_basic_interactor_spec.rb
|
249
|
-
- spec/integration/
|
250
|
-
- spec/integration/an_organizer_performing_in_parallel_spec.rb
|
251
|
-
- spec/integration/an_organizer_with_failing_nested_organizer_spec.rb
|
245
|
+
- spec/integration/an_interactor_with_validations_spec.rb
|
252
246
|
- spec/integration/an_interactor_with_after_context_validation_callbacks_spec.rb
|
247
|
+
- spec/integration/an_organizer_with_failing_nested_organizer_spec.rb
|
248
|
+
- spec/integration/a_basic_organizer_spec.rb
|
249
|
+
- spec/integration/an_organizer_with_options_callbacks_spec.rb
|
253
250
|
- spec/integration/an_interactor_with_an_existing_context_class_spec.rb
|
254
|
-
- spec/integration/
|
255
|
-
- spec/integration/an_organizer_with_before_each_callbacks_spec.rb
|
251
|
+
- spec/integration/active_record_integration_spec.rb
|
256
252
|
- spec/integration/an_interactor_with_validations_on_calling_spec.rb
|
257
|
-
- spec/integration/an_organizer_with_options_callbacks_spec.rb
|
258
|
-
- spec/integration/an_interactor_with_around_rollback_callbacks_spec.rb
|
259
|
-
- spec/integration/an_interactor_with_validations_on_called_spec.rb
|
260
253
|
- spec/integration/an_interactor_with_after_perform_callbacks_spec.rb
|
254
|
+
- spec/integration/an_organizer_performing_in_parallel_spec.rb
|
255
|
+
- spec/integration/an_organizer_with_after_each_callbacks_spec.rb
|
261
256
|
- spec/integration/a_failing_interactor_spec.rb
|
262
|
-
- spec/integration/
|
257
|
+
- spec/integration/an_interactor_with_before_rollback_callbacks_spec.rb
|
263
258
|
- spec/integration/an_interactor_with_around_perform_callbacks_spec.rb
|
264
|
-
- spec/integration/an_organizer_with_around_each_callbacks_spec.rb
|
265
|
-
- spec/integration/an_interactor_with_after_rollback_callbacks_spec.rb
|
266
|
-
- spec/integration/an_organizer_with_after_each_callbacks_spec.rb
|
267
259
|
- spec/integration/an_interactor_with_before_perform_callbacks_spec.rb
|
268
|
-
- spec/integration/
|
260
|
+
- spec/integration/an_organizer_with_conditionally_organized_interactors_spec.rb
|
261
|
+
- spec/integration/an_organizer_with_before_each_callbacks_spec.rb
|
262
|
+
- spec/integration/an_interactor_with_validations_on_called_spec.rb
|
263
|
+
- spec/integration/an_organizer_with_around_each_callbacks_spec.rb
|
269
264
|
- spec/spec_helper.rb
|
270
|
-
- spec/
|
265
|
+
- spec/active_interactor/error_spec.rb
|
266
|
+
- spec/active_interactor/organizer/interactor_interface_spec.rb
|
267
|
+
- spec/active_interactor/organizer/interactor_interface_collection_spec.rb
|
268
|
+
- spec/active_interactor/organizer/base_spec.rb
|
269
|
+
- spec/active_interactor/config_spec.rb
|
270
|
+
- spec/active_interactor/context/base_spec.rb
|
271
|
+
- spec/active_interactor/interactor/perform/options_spec.rb
|
272
|
+
- spec/active_interactor/interactor/worker_spec.rb
|
273
|
+
- spec/active_interactor/version_spec.rb
|
274
|
+
- spec/active_interactor/base_spec.rb
|