substation 0.0.9 → 0.0.10.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +0 -1
- data/Changelog.md +24 -82
- data/Gemfile.devtools +17 -24
- data/README.md +46 -116
- data/config/flay.yml +2 -2
- data/config/flog.yml +1 -1
- data/config/mutant.yml +0 -1
- data/config/reek.yml +5 -10
- data/lib/substation.rb +3 -8
- data/lib/substation/chain.rb +64 -108
- data/lib/substation/chain/dsl.rb +30 -57
- data/lib/substation/dispatcher.rb +1 -3
- data/lib/substation/environment.rb +23 -9
- data/lib/substation/environment/dsl.rb +3 -4
- data/lib/substation/observer.rb +2 -4
- data/lib/substation/processor.rb +7 -106
- data/lib/substation/processor/evaluator.rb +42 -83
- data/lib/substation/processor/pivot.rb +25 -0
- data/lib/substation/processor/wrapper.rb +2 -4
- data/lib/substation/request.rb +1 -10
- data/lib/substation/response.rb +0 -11
- data/lib/substation/utils.rb +1 -3
- data/lib/substation/version.rb +1 -3
- data/spec/integration/substation/dispatcher/call_spec.rb +12 -12
- data/spec/spec_helper.rb +21 -30
- data/spec/unit/substation/chain/call_spec.rb +32 -202
- data/spec/unit/substation/chain/dsl/builder/class_methods/call_spec.rb +2 -2
- data/spec/unit/substation/chain/dsl/builder/dsl_spec.rb +6 -8
- data/spec/unit/substation/chain/dsl/builder/failure_chain_spec.rb +30 -0
- data/spec/unit/substation/chain/dsl/chain_spec.rb +2 -1
- data/spec/unit/substation/chain/dsl/class_methods/processors_spec.rb +24 -0
- data/spec/unit/substation/chain/dsl/initialize_spec.rb +19 -0
- data/spec/unit/substation/chain/dsl/processors_spec.rb +21 -9
- data/spec/unit/substation/chain/dsl/use_spec.rb +3 -2
- data/spec/unit/substation/chain/each_spec.rb +9 -5
- data/spec/unit/substation/chain/incoming/result_spec.rb +21 -0
- data/spec/unit/substation/chain/outgoing/call_spec.rb +25 -0
- data/spec/unit/substation/{processor → chain/outgoing}/result_spec.rb +5 -6
- data/spec/unit/substation/dispatcher/action/call_spec.rb +6 -7
- data/spec/unit/substation/dispatcher/action/class_methods/coerce_spec.rb +5 -7
- data/spec/unit/substation/dispatcher/action_names_spec.rb +1 -1
- data/spec/unit/substation/dispatcher/call_spec.rb +3 -3
- data/spec/unit/substation/dispatcher/class_methods/coerce_spec.rb +7 -7
- data/spec/unit/substation/environment/chain_spec.rb +32 -22
- data/spec/unit/substation/environment/class_methods/build_spec.rb +4 -11
- data/spec/unit/substation/environment/dsl/class_methods/registry_spec.rb +3 -5
- data/spec/unit/substation/environment/dsl/register_spec.rb +3 -8
- data/spec/unit/substation/environment/dsl/registry_spec.rb +3 -5
- data/spec/unit/substation/observer/chain/call_spec.rb +3 -5
- data/spec/unit/substation/observer/class_methods/coerce_spec.rb +2 -4
- data/spec/unit/substation/observer/null/call_spec.rb +1 -3
- data/spec/unit/substation/processor/evaluator/call_spec.rb +35 -21
- data/spec/unit/substation/processor/pivot/call_spec.rb +17 -0
- data/spec/unit/substation/processor/wrapper/call_spec.rb +7 -8
- data/spec/unit/substation/request/env_spec.rb +4 -5
- data/spec/unit/substation/request/error_spec.rb +4 -5
- data/spec/unit/substation/request/input_spec.rb +4 -5
- data/spec/unit/substation/request/success_spec.rb +4 -5
- data/spec/unit/substation/response/env_spec.rb +5 -6
- data/spec/unit/substation/response/failure/success_predicate_spec.rb +4 -5
- data/spec/unit/substation/response/input_spec.rb +5 -6
- data/spec/unit/substation/response/output_spec.rb +4 -5
- data/spec/unit/substation/response/request_spec.rb +5 -6
- data/spec/unit/substation/response/success/success_predicate_spec.rb +4 -5
- data/spec/unit/substation/utils/class_methods/coerce_callable_spec.rb +13 -15
- data/spec/unit/substation/utils/class_methods/const_get_spec.rb +6 -6
- data/spec/unit/substation/utils/class_methods/symbolize_keys_spec.rb +4 -4
- data/substation.gemspec +1 -1
- metadata +18 -45
- data/config/rubocop.yml +0 -35
- data/lib/substation/processor/transformer.rb +0 -26
- data/spec/unit/substation/chain/class_methods/failure_response_spec.rb +0 -16
- data/spec/unit/substation/chain/dsl/class_methods/build_spec.rb +0 -24
- data/spec/unit/substation/chain/dsl/failure_chain_spec.rb +0 -35
- data/spec/unit/substation/chain/failure_data/equalizer_spec.rb +0 -46
- data/spec/unit/substation/chain/failure_data/hash_spec.rb +0 -13
- data/spec/unit/substation/environment/equalizer_spec.rb +0 -25
- data/spec/unit/substation/processor/evaluator/class_methods/new_spec.rb +0 -9
- data/spec/unit/substation/processor/evaluator/data/call_spec.rb +0 -34
- data/spec/unit/substation/processor/evaluator/pivot/call_spec.rb +0 -34
- data/spec/unit/substation/processor/evaluator/request/call_spec.rb +0 -34
- data/spec/unit/substation/processor/fallible/name_spec.rb +0 -15
- data/spec/unit/substation/processor/fallible/with_failure_chain_spec.rb +0 -18
- data/spec/unit/substation/processor/incoming/result_spec.rb +0 -25
- data/spec/unit/substation/processor/outgoing/call_spec.rb +0 -28
- data/spec/unit/substation/processor/outgoing/name_spec.rb +0 -14
- data/spec/unit/substation/processor/outgoing/success_predicate_spec.rb +0 -15
- data/spec/unit/substation/processor/success_predicate_spec.rb +0 -22
- data/spec/unit/substation/processor/transformer/call_spec.rb +0 -21
- data/spec/unit/substation/request/name_spec.rb +0 -15
- data/spec/unit/substation/response/to_request_spec.rb +0 -19
@@ -7,8 +7,8 @@ describe Chain::DSL::Builder, '.call' do
|
|
7
7
|
|
8
8
|
let(:registry) { { :test => Spec::Processor } }
|
9
9
|
|
10
|
-
let(:builder) {
|
11
|
-
let(:dsl) {
|
10
|
+
let(:builder) { double(:dsl => dsl) }
|
11
|
+
let(:dsl) { double }
|
12
12
|
|
13
13
|
before do
|
14
14
|
described_class.should_receive(:new).with(registry).and_return(builder)
|
@@ -3,21 +3,19 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
describe Chain::DSL::Builder, '#dsl' do
|
6
|
-
subject { dsl.new(processors, &block) }
|
6
|
+
subject { dsl.new(env, processors, &block) }
|
7
7
|
|
8
|
+
let(:env) { Spec::FAKE_ENV }
|
8
9
|
let(:dsl) { builder.dsl }
|
9
10
|
let(:builder) { described_class.new(registry) }
|
10
11
|
let(:registry) { { :test => Spec::Processor } }
|
11
12
|
let(:processors) { [] }
|
12
|
-
let(:block) {
|
13
|
-
|
13
|
+
let(:block) { lambda { |_| test(Spec::FAKE_HANDLER) } }
|
14
14
|
let(:processor) { Spec::FAKE_PROCESSOR }
|
15
15
|
|
16
|
-
|
17
|
-
expect(subject.processors).to include(processor)
|
18
|
-
end
|
16
|
+
its(:processors) { should include(processor) }
|
19
17
|
|
20
|
-
it
|
21
|
-
|
18
|
+
it "should create a subclass of Chain::DSL" do
|
19
|
+
subject.class.should be < Chain::DSL
|
22
20
|
end
|
23
21
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe "Initializing a processor's failure chain" do
|
6
|
+
subject { chain.call(request) }
|
7
|
+
|
8
|
+
let(:env) {
|
9
|
+
Environment.build {
|
10
|
+
register :evaluate, Processor::Evaluator
|
11
|
+
register :wrap, Processor::Wrapper
|
12
|
+
}
|
13
|
+
}
|
14
|
+
|
15
|
+
let(:chain) {
|
16
|
+
env.chain {
|
17
|
+
evaluate(Spec::Handler::Evaluator) {
|
18
|
+
wrap Spec::Presenter
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
let(:request) { Request.new(app_env, input) }
|
24
|
+
let(:app_env) { double }
|
25
|
+
let(:input) { :invalid }
|
26
|
+
|
27
|
+
let(:response) { Response::Failure.new(request, Spec::Presenter.new(:failure)) }
|
28
|
+
|
29
|
+
it { should eql(response) }
|
30
|
+
end
|
@@ -5,7 +5,8 @@ require 'spec_helper'
|
|
5
5
|
describe Chain::DSL, '#chain' do
|
6
6
|
subject { object.chain(other) }
|
7
7
|
|
8
|
-
let(:object) { described_class.new(chain) }
|
8
|
+
let(:object) { described_class.new(env, chain) }
|
9
|
+
let(:env) { Spec::FAKE_ENV }
|
9
10
|
let(:chain) { Chain::EMPTY }
|
10
11
|
let(:other) { [ processor ] }
|
11
12
|
let(:processor) { Spec::FAKE_PROCESSOR }
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Chain::DSL, '.processors' do
|
6
|
+
|
7
|
+
let(:env) { Spec::FAKE_ENV }
|
8
|
+
let(:chain) { Chain::EMPTY }
|
9
|
+
|
10
|
+
context "and a block is given" do
|
11
|
+
subject { described_class.processors(env, chain, &block) }
|
12
|
+
|
13
|
+
let(:block) { lambda { |_| use(Spec::FAKE_PROCESSOR) } }
|
14
|
+
let(:processor) { Spec::FAKE_PROCESSOR }
|
15
|
+
|
16
|
+
it { should include(processor) }
|
17
|
+
end
|
18
|
+
|
19
|
+
context "and no block is given" do
|
20
|
+
subject { described_class.processors(env, chain) }
|
21
|
+
|
22
|
+
it { should be_empty }
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
# Test wether env is correctly passed down
|
6
|
+
describe Chain::DSL, '#initialize' do
|
7
|
+
subject { dsl.new(env, processors, &block) }
|
8
|
+
|
9
|
+
let(:env) { Spec::FAKE_ENV }
|
10
|
+
let(:dsl) { builder.dsl }
|
11
|
+
let(:builder) { described_class::Builder.new(registry) }
|
12
|
+
let(:registry) { { :test => Spec::Processor } }
|
13
|
+
let(:processors) { [] }
|
14
|
+
let(:block) { lambda { |_| test(Spec::FAKE_HANDLER) } }
|
15
|
+
|
16
|
+
let(:processor) { Spec::FAKE_PROCESSOR }
|
17
|
+
|
18
|
+
its(:processors) { should include(processor) }
|
19
|
+
end
|
@@ -5,26 +5,38 @@ require 'spec_helper'
|
|
5
5
|
describe Chain::DSL, '#processors' do
|
6
6
|
subject { object.processors }
|
7
7
|
|
8
|
+
let(:env) { Spec::FAKE_ENV }
|
8
9
|
let(:processor) { Spec::FAKE_PROCESSOR }
|
9
|
-
let(:name) { mock }
|
10
10
|
|
11
|
-
context
|
12
|
-
let(:object) { described_class.new(chain, &block) }
|
13
|
-
let(:chain) {
|
14
|
-
let(:block) {
|
11
|
+
context "and a block is given" do
|
12
|
+
let(:object) { described_class.new(env, chain, &block) }
|
13
|
+
let(:chain) { Chain::EMPTY }
|
14
|
+
let(:block) { lambda { |_| use(Spec::FAKE_PROCESSOR) } }
|
15
15
|
|
16
16
|
it { should include(processor) }
|
17
17
|
|
18
18
|
its(:length) { should == 1 }
|
19
19
|
end
|
20
20
|
|
21
|
-
context
|
22
|
-
let(:object) { described_class.new(chain) }
|
23
|
-
let(:chain) { Chain.new([ processor ]
|
24
|
-
let(:failure_chain) { mock }
|
21
|
+
context "and no block is given" do
|
22
|
+
let(:object) { described_class.new(env, chain) }
|
23
|
+
let(:chain) { Chain.new([ processor ]) }
|
25
24
|
|
26
25
|
it { should include(processor) }
|
27
26
|
|
28
27
|
its(:length) { should == 1 }
|
29
28
|
end
|
29
|
+
|
30
|
+
# TODO move this elsewhere once mutant supports it
|
31
|
+
context "test DSL#initialize" do
|
32
|
+
let(:object) { described_class.new(env, chain, &block) }
|
33
|
+
let(:chain) { Chain::EMPTY }
|
34
|
+
let(:block) { lambda { |_| use(Spec::FAKE_PROCESSOR) } }
|
35
|
+
|
36
|
+
it { should include(processor) }
|
37
|
+
|
38
|
+
it "passes down the env to registered processors" do
|
39
|
+
subject.first.env.should be(env)
|
40
|
+
end
|
41
|
+
end
|
30
42
|
end
|
@@ -5,8 +5,9 @@ require 'spec_helper'
|
|
5
5
|
describe Chain::DSL, '#use' do
|
6
6
|
subject { object.use(processor) }
|
7
7
|
|
8
|
-
let(:object) { described_class.new(chain) }
|
9
|
-
let(:
|
8
|
+
let(:object) { described_class.new(env, chain) }
|
9
|
+
let(:env) { Spec::FAKE_ENV }
|
10
|
+
let(:chain) { Chain::EMPTY }
|
10
11
|
let(:processor) { Spec::FAKE_PROCESSOR }
|
11
12
|
|
12
13
|
its(:processors) { should include(processor) }
|
@@ -5,7 +5,7 @@ require 'spec_helper'
|
|
5
5
|
describe Chain, '#each' do
|
6
6
|
subject { object.each { |tuple| yields << processor } }
|
7
7
|
|
8
|
-
let(:object) { described_class.new(processors
|
8
|
+
let(:object) { described_class.new(processors) }
|
9
9
|
let(:processors) { [ processor ] }
|
10
10
|
let(:processor) { Spec::FAKE_PROCESSOR }
|
11
11
|
let(:yields) { [] }
|
@@ -22,14 +22,14 @@ describe Chain, '#each' do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'yields only processors with the expected handler' do
|
25
|
-
expect { subject }.to change { yields.dup }
|
26
|
-
|
27
|
-
|
25
|
+
expect { subject }.to change { yields.dup }.
|
26
|
+
from([]).
|
27
|
+
to([ processor ])
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
31
|
describe Chain do
|
32
|
-
subject { described_class.new(processors
|
32
|
+
subject { described_class.new(processors) }
|
33
33
|
|
34
34
|
let(:processors) { [ processor ] }
|
35
35
|
let(:processor) { Spec::FAKE_PROCESSOR }
|
@@ -39,4 +39,8 @@ describe Chain do
|
|
39
39
|
end
|
40
40
|
|
41
41
|
it { should be_kind_of(Enumerable) }
|
42
|
+
|
43
|
+
it 'case matches Enumerable' do
|
44
|
+
(Enumerable === subject).should be(true)
|
45
|
+
end
|
42
46
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Chain::Incoming, '#result' do
|
6
|
+
|
7
|
+
subject { object.result(response) }
|
8
|
+
|
9
|
+
let(:object) {
|
10
|
+
Class.new {
|
11
|
+
include Substation::Chain::Incoming
|
12
|
+
}.new
|
13
|
+
}
|
14
|
+
|
15
|
+
let(:response) { Response::Success.new(request, input) }
|
16
|
+
let(:request) { Request.new(env, input) }
|
17
|
+
let(:env) { double }
|
18
|
+
let(:input) { double }
|
19
|
+
|
20
|
+
it { should eql(request) }
|
21
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Chain::Outgoing, '#call' do
|
6
|
+
|
7
|
+
subject { object.call(request) }
|
8
|
+
|
9
|
+
let(:object) {
|
10
|
+
Class.new {
|
11
|
+
include Substation::Chain::Outgoing
|
12
|
+
def call(request)
|
13
|
+
response = request.success(request.input)
|
14
|
+
respond_with(response, :altered)
|
15
|
+
end
|
16
|
+
}.new
|
17
|
+
}
|
18
|
+
|
19
|
+
let(:response) { Response::Success.new(request, :altered) }
|
20
|
+
let(:request) { Request.new(env, input) }
|
21
|
+
let(:env) { double }
|
22
|
+
let(:input) { double }
|
23
|
+
|
24
|
+
it { should eql(response) }
|
25
|
+
end
|
@@ -2,21 +2,20 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
describe
|
5
|
+
describe Chain::Outgoing, '#result' do
|
6
6
|
|
7
7
|
subject { object.result(response) }
|
8
8
|
|
9
9
|
let(:object) {
|
10
10
|
Class.new {
|
11
|
-
include Substation::
|
11
|
+
include Substation::Chain::Outgoing
|
12
12
|
}.new
|
13
13
|
}
|
14
14
|
|
15
15
|
let(:response) { Response::Success.new(request, input) }
|
16
|
-
let(:request) { Request.new(
|
17
|
-
let(:
|
18
|
-
let(:
|
19
|
-
let(:input) { mock }
|
16
|
+
let(:request) { Request.new(env, input) }
|
17
|
+
let(:env) { double }
|
18
|
+
let(:input) { double }
|
20
19
|
|
21
20
|
it { should be(response) }
|
22
21
|
end
|
@@ -7,13 +7,12 @@ describe Dispatcher::Action, '#call' do
|
|
7
7
|
subject { object.call(request) }
|
8
8
|
|
9
9
|
let(:object) { described_class.new(klass, observer) }
|
10
|
-
let(:klass) {
|
11
|
-
let(:observer) {
|
12
|
-
let(:request) { Request.new(
|
13
|
-
let(:
|
14
|
-
let(:
|
15
|
-
let(:
|
16
|
-
let(:response) { mock }
|
10
|
+
let(:klass) { double }
|
11
|
+
let(:observer) { double }
|
12
|
+
let(:request) { Request.new(env, input) }
|
13
|
+
let(:env) { double }
|
14
|
+
let(:input) { double }
|
15
|
+
let(:response) { double }
|
17
16
|
|
18
17
|
before do
|
19
18
|
klass.should_receive(:call).with(request).and_return(response)
|
@@ -9,15 +9,13 @@ describe Dispatcher::Action, '.coerce' do
|
|
9
9
|
let(:action) { Spec::Action::Success }
|
10
10
|
let(:coerced) { Dispatcher::Action.new(action, observer) }
|
11
11
|
|
12
|
-
context
|
13
|
-
context
|
12
|
+
context "when config is a hash" do
|
13
|
+
context "and coercion is possible" do
|
14
14
|
|
15
|
-
let(:config) {
|
16
|
-
{
|
15
|
+
let(:config) {{
|
17
16
|
:action => action,
|
18
17
|
:observer => observer_value
|
19
|
-
|
20
|
-
}
|
18
|
+
}}
|
21
19
|
|
22
20
|
before do
|
23
21
|
Observer.should_receive(:coerce).with(observer_value).and_return(observer)
|
@@ -48,7 +46,7 @@ describe Dispatcher::Action, '.coerce' do
|
|
48
46
|
end
|
49
47
|
end
|
50
48
|
|
51
|
-
context
|
49
|
+
context "when config is no hash" do
|
52
50
|
let(:config) { action }
|
53
51
|
let(:observer_value) { nil }
|
54
52
|
let(:observer) { Observer::NULL }
|
@@ -8,9 +8,9 @@ describe Dispatcher, '#call' do
|
|
8
8
|
|
9
9
|
let(:object) { described_class.coerce(config, env) }
|
10
10
|
let(:config) { { 'test' => { 'action' => 'Spec::Action::Success' } } }
|
11
|
-
let(:request) { Request.new(
|
12
|
-
let(:
|
13
|
-
let(:
|
11
|
+
let(:request) { Request.new(env, input) }
|
12
|
+
let(:input) { double }
|
13
|
+
let(:env) { double }
|
14
14
|
|
15
15
|
let(:expected_response) do
|
16
16
|
Spec::Action::Success.call(request)
|
@@ -6,15 +6,15 @@ describe Dispatcher, '.coerce' do
|
|
6
6
|
|
7
7
|
subject { described_class.coerce(config, env) }
|
8
8
|
|
9
|
-
let(:config) {
|
10
|
-
|
11
|
-
}
|
9
|
+
let(:config) {{
|
10
|
+
'test' => { 'action' => 'Spec::Action::Success' }
|
11
|
+
}}
|
12
12
|
|
13
|
-
let(:env) {
|
13
|
+
let(:env) { double }
|
14
14
|
|
15
|
-
let(:coerced) {
|
16
|
-
|
17
|
-
}
|
15
|
+
let(:coerced) {{
|
16
|
+
:test => described_class::Action.coerce(:action => 'Spec::Action::Success')
|
17
|
+
}}
|
18
18
|
|
19
19
|
it { should eql(described_class.new(coerced, env)) }
|
20
20
|
end
|
@@ -1,40 +1,50 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
require 'spec_helper'
|
4
2
|
|
5
3
|
describe Substation::Environment, '#chain' do
|
6
4
|
|
7
|
-
let(:object) { described_class.
|
5
|
+
let(:object) { described_class.build(&block) }
|
8
6
|
|
7
|
+
let(:other) { Chain::EMPTY }
|
8
|
+
let(:chain) { lambda { |_| test Spec::FAKE_HANDLER } }
|
9
9
|
let(:dsl) { Chain::DSL::Builder.call(registry) }
|
10
|
-
let(:registry) { described_class::DSL.registry(&
|
11
|
-
let(:
|
10
|
+
let(:registry) { described_class::DSL.registry(&block) }
|
11
|
+
let(:block) { lambda { |_| register(:test, Spec::Processor) } }
|
12
12
|
|
13
|
-
let(:
|
14
|
-
let(:failure_chain) { mock('failure_chain') }
|
15
|
-
let(:block) { ->(_) { test Spec::FAKE_HANDLER, Chain::EMPTY } }
|
13
|
+
let(:expected) { Chain.new(processors) }
|
16
14
|
|
17
|
-
context
|
18
|
-
|
15
|
+
context "when other is not given" do
|
16
|
+
context "and a block is given" do
|
17
|
+
subject { object.chain(&chain) }
|
19
18
|
|
20
|
-
|
21
|
-
end
|
19
|
+
let(:processors) { dsl.processors(object, other, &chain) }
|
22
20
|
|
23
|
-
|
24
|
-
|
21
|
+
it { should eql(expected) }
|
22
|
+
end
|
25
23
|
|
26
|
-
|
27
|
-
|
24
|
+
context "and no block is given" do
|
25
|
+
subject { object.chain }
|
28
26
|
|
29
|
-
|
30
|
-
subject { object.chain(other) }
|
27
|
+
let(:processors) { dsl.processors(object, other) }
|
31
28
|
|
32
|
-
|
29
|
+
it { should eql(expected) }
|
30
|
+
end
|
33
31
|
end
|
34
32
|
|
35
|
-
context
|
36
|
-
|
33
|
+
context "when other is given" do
|
34
|
+
context "and a block is given" do
|
35
|
+
subject { object.chain(other, &chain) }
|
36
|
+
|
37
|
+
let(:processors) { dsl.processors(object, other, &chain) }
|
38
|
+
|
39
|
+
it { should eql(expected) }
|
40
|
+
end
|
41
|
+
|
42
|
+
context "and no block is given" do
|
43
|
+
subject { object.chain(other) }
|
44
|
+
|
45
|
+
let(:processors) { dsl.processors(object, other) }
|
37
46
|
|
38
|
-
|
47
|
+
it { should eql(expected) }
|
48
|
+
end
|
39
49
|
end
|
40
50
|
end
|