substation 0.0.10.beta2 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +7 -3
- data/Changelog.md +99 -24
- data/Gemfile +8 -1
- data/Gemfile.devtools +37 -21
- data/Guardfile +1 -1
- data/README.md +118 -46
- data/TODO.md +1 -0
- data/config/flay.yml +2 -2
- data/config/flog.yml +1 -1
- data/config/reek.yml +41 -16
- data/config/rubocop.yml +44 -0
- data/config/yardstick.yml +1 -1
- data/lib/substation.rb +41 -5
- data/lib/substation/chain.rb +73 -84
- data/lib/substation/chain/definition.rb +147 -0
- data/lib/substation/chain/dsl.rb +150 -112
- data/lib/substation/chain/dsl/config.rb +55 -0
- data/lib/substation/chain/dsl/module_builder.rb +84 -0
- data/lib/substation/dispatcher.rb +20 -229
- data/lib/substation/dsl/guard.rb +96 -0
- data/lib/substation/dsl/registry.rb +181 -0
- data/lib/substation/environment.rb +126 -23
- data/lib/substation/environment/dsl.rb +31 -12
- data/lib/substation/processor.rb +238 -7
- data/lib/substation/processor/builder.rb +26 -0
- data/lib/substation/processor/config.rb +24 -0
- data/lib/substation/processor/evaluator.rb +66 -42
- data/lib/substation/processor/evaluator/handler.rb +54 -0
- data/lib/substation/processor/evaluator/result.rb +24 -0
- data/lib/substation/processor/executor.rb +46 -0
- data/lib/substation/processor/nest.rb +40 -0
- data/lib/substation/processor/transformer.rb +46 -0
- data/lib/substation/processor/wrapper.rb +16 -5
- data/lib/substation/request.rb +29 -27
- data/lib/substation/response.rb +19 -34
- data/lib/substation/response/api.rb +37 -0
- data/lib/substation/response/exception.rb +20 -0
- data/lib/substation/response/exception/output.rb +59 -0
- data/lib/substation/response/failure.rb +11 -0
- data/lib/substation/response/success.rb +11 -0
- data/lib/substation/version.rb +3 -1
- data/spec/demo/core.rb +64 -0
- data/spec/demo/core/action.rb +49 -0
- data/spec/demo/core/action/create_person.rb +28 -0
- data/spec/demo/core/errors.rb +16 -0
- data/spec/demo/core/facade.rb +38 -0
- data/spec/demo/core/handler.rb +21 -0
- data/spec/demo/core/handler/acceptor.rb +47 -0
- data/spec/demo/core/handler/authenticator.rb +36 -0
- data/spec/demo/core/handler/authorizer.rb +38 -0
- data/spec/demo/core/input.rb +15 -0
- data/spec/demo/core/observers.rb +10 -0
- data/spec/demo/core/validator.rb +21 -0
- data/spec/demo/domain/actor.rb +29 -0
- data/spec/demo/domain/dto/person.rb +18 -0
- data/spec/demo/domain/environment.rb +55 -0
- data/spec/demo/domain/storage.rb +49 -0
- data/spec/demo/web.rb +26 -0
- data/spec/demo/web/errors.rb +9 -0
- data/spec/demo/web/facade.rb +60 -0
- data/spec/demo/web/handler/deserializer.rb +36 -0
- data/spec/demo/web/presenter.rb +38 -0
- data/spec/demo/web/presenter/person.rb +19 -0
- data/spec/demo/web/renderer.rb +45 -0
- data/spec/demo/web/sanitizer.rb +35 -0
- data/spec/demo/web/sanitizer/person.rb +20 -0
- data/spec/demo/web/views.rb +28 -0
- data/spec/integration/demo/core_spec.rb +97 -0
- data/spec/integration/demo/web_spec.rb +114 -0
- data/spec/shared/context/integration/demo.rb +33 -0
- data/spec/shared/context/unit/chain.rb +13 -0
- data/spec/shared/context/unit/processor.rb +58 -0
- data/spec/shared/context/unit/request.rb +8 -0
- data/spec/shared/examples/integration/demo.rb +35 -0
- data/spec/shared/examples/unit/processor.rb +72 -0
- data/spec/spec_helper.rb +52 -23
- data/spec/unit/substation/chain/definition_spec.rb +141 -0
- data/spec/unit/substation/chain/dsl/config/dsl_module_spec.rb +13 -0
- data/spec/unit/substation/chain/dsl/config/registry_spec.rb +13 -0
- data/spec/unit/substation/chain/dsl/config_spec.rb +18 -0
- data/spec/unit/substation/chain/dsl/module_builder_spec.rb +77 -0
- data/spec/unit/substation/chain/dsl_spec.rb +175 -0
- data/spec/unit/substation/chain_spec.rb +303 -0
- data/spec/unit/substation/dispatcher_spec.rb +68 -0
- data/spec/unit/substation/dsl/guard_spec.rb +72 -0
- data/spec/unit/substation/dsl/registry_spec.rb +181 -0
- data/spec/unit/substation/environment/dsl_spec.rb +156 -0
- data/spec/unit/substation/environment_spec.rb +259 -0
- data/spec/unit/substation/processor/builder_spec.rb +21 -0
- data/spec/unit/substation/processor/config_spec.rb +40 -0
- data/spec/unit/substation/processor/evaluator/handler_spec.rb +20 -0
- data/spec/unit/substation/processor/evaluator/pivot_spec.rb +42 -0
- data/spec/unit/substation/processor/evaluator/request_spec.rb +11 -0
- data/spec/unit/substation/processor/evaluator/result/failure_spec.rb +14 -0
- data/spec/unit/substation/processor/evaluator/result/success_spec.rb +14 -0
- data/spec/unit/substation/processor/evaluator/result_spec.rb +13 -0
- data/spec/unit/substation/processor/evaluator_spec.rb +18 -0
- data/spec/unit/substation/processor/executor/null_spec.rb +25 -0
- data/spec/unit/substation/processor/executor_spec.rb +32 -0
- data/spec/unit/substation/processor/fallible_spec.rb +24 -0
- data/spec/unit/substation/processor/incoming_spec.rb +17 -0
- data/spec/unit/substation/processor/nest/incoming_spec.rb +56 -0
- data/spec/unit/substation/processor/nest_spec.rb +6 -0
- data/spec/unit/substation/processor/outgoing_spec.rb +47 -0
- data/spec/unit/substation/processor/transformer/incoming_spec.rb +17 -0
- data/spec/unit/substation/processor/transformer/outgoing_spec.rb +17 -0
- data/spec/unit/substation/processor/wrapper/incoming_spec.rb +15 -0
- data/spec/unit/substation/processor/wrapper/outgoing_spec.rb +15 -0
- data/spec/unit/substation/processor/wrapper_spec.rb +24 -0
- data/spec/unit/substation/processor_spec.rb +68 -0
- data/spec/unit/substation/request_spec.rb +70 -0
- data/spec/unit/substation/response/api_spec.rb +22 -0
- data/spec/unit/substation/response/exception/output_spec.rb +46 -0
- data/spec/unit/substation/response/exception_spec.rb +25 -0
- data/spec/unit/substation/response/failure_spec.rb +25 -0
- data/spec/unit/substation/response/success_spec.rb +24 -0
- data/spec/unit/substation/response_spec.rb +73 -0
- data/substation.gemspec +7 -6
- metadata +157 -67
- checksums.yaml +0 -7
- data/TODO +0 -0
- data/lib/substation/observer.rb +0 -66
- data/lib/substation/processor/pivot.rb +0 -25
- data/lib/substation/utils.rb +0 -68
- data/spec/integration/substation/dispatcher/call_spec.rb +0 -260
- data/spec/unit/substation/chain/call_spec.rb +0 -63
- data/spec/unit/substation/chain/dsl/builder/class_methods/call_spec.rb +0 -19
- data/spec/unit/substation/chain/dsl/builder/dsl_spec.rb +0 -21
- data/spec/unit/substation/chain/dsl/builder/failure_chain_spec.rb +0 -30
- data/spec/unit/substation/chain/dsl/chain_spec.rb +0 -15
- data/spec/unit/substation/chain/dsl/class_methods/processors_spec.rb +0 -24
- data/spec/unit/substation/chain/dsl/initialize_spec.rb +0 -19
- data/spec/unit/substation/chain/dsl/processors_spec.rb +0 -42
- data/spec/unit/substation/chain/dsl/use_spec.rb +0 -14
- data/spec/unit/substation/chain/each_spec.rb +0 -46
- data/spec/unit/substation/chain/incoming/result_spec.rb +0 -21
- data/spec/unit/substation/chain/outgoing/call_spec.rb +0 -25
- data/spec/unit/substation/chain/outgoing/result_spec.rb +0 -21
- data/spec/unit/substation/dispatcher/action/call_spec.rb +0 -23
- data/spec/unit/substation/dispatcher/action/class_methods/coerce_spec.rb +0 -61
- data/spec/unit/substation/dispatcher/action_names_spec.rb +0 -14
- data/spec/unit/substation/dispatcher/call_spec.rb +0 -47
- data/spec/unit/substation/dispatcher/class_methods/coerce_spec.rb +0 -20
- data/spec/unit/substation/environment/chain_spec.rb +0 -50
- data/spec/unit/substation/environment/class_methods/build_spec.rb +0 -11
- data/spec/unit/substation/environment/dsl/class_methods/registry_spec.rb +0 -18
- data/spec/unit/substation/environment/dsl/register_spec.rb +0 -14
- data/spec/unit/substation/environment/dsl/registry_spec.rb +0 -19
- data/spec/unit/substation/observer/chain/call_spec.rb +0 -26
- data/spec/unit/substation/observer/class_methods/coerce_spec.rb +0 -33
- data/spec/unit/substation/observer/null/call_spec.rb +0 -12
- data/spec/unit/substation/processor/evaluator/call_spec.rb +0 -49
- data/spec/unit/substation/processor/pivot/call_spec.rb +0 -17
- data/spec/unit/substation/processor/wrapper/call_spec.rb +0 -20
- data/spec/unit/substation/request/env_spec.rb +0 -14
- data/spec/unit/substation/request/error_spec.rb +0 -15
- data/spec/unit/substation/request/input_spec.rb +0 -14
- data/spec/unit/substation/request/success_spec.rb +0 -15
- data/spec/unit/substation/response/env_spec.rb +0 -16
- data/spec/unit/substation/response/failure/success_predicate_spec.rb +0 -15
- data/spec/unit/substation/response/input_spec.rb +0 -16
- data/spec/unit/substation/response/output_spec.rb +0 -16
- data/spec/unit/substation/response/request_spec.rb +0 -16
- data/spec/unit/substation/response/success/success_predicate_spec.rb +0 -15
- data/spec/unit/substation/utils/class_methods/coerce_callable_spec.rb +0 -46
- data/spec/unit/substation/utils/class_methods/const_get_spec.rb +0 -46
- data/spec/unit/substation/utils/class_methods/symbolize_keys_spec.rb +0 -20
@@ -1,20 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Dispatcher, '.coerce' do
|
6
|
-
|
7
|
-
subject { described_class.coerce(config, env) }
|
8
|
-
|
9
|
-
let(:config) {{
|
10
|
-
'test' => { 'action' => 'Spec::Action::Success' }
|
11
|
-
}}
|
12
|
-
|
13
|
-
let(:env) { double }
|
14
|
-
|
15
|
-
let(:coerced) {{
|
16
|
-
:test => described_class::Action.coerce(:action => 'Spec::Action::Success')
|
17
|
-
}}
|
18
|
-
|
19
|
-
it { should eql(described_class.new(coerced, env)) }
|
20
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Substation::Environment, '#chain' do
|
4
|
-
|
5
|
-
let(:object) { described_class.build(&block) }
|
6
|
-
|
7
|
-
let(:other) { Chain::EMPTY }
|
8
|
-
let(:chain) { lambda { |_| test Spec::FAKE_HANDLER } }
|
9
|
-
let(:dsl) { Chain::DSL::Builder.call(registry) }
|
10
|
-
let(:registry) { described_class::DSL.registry(&block) }
|
11
|
-
let(:block) { lambda { |_| register(:test, Spec::Processor) } }
|
12
|
-
|
13
|
-
let(:expected) { Chain.new(processors) }
|
14
|
-
|
15
|
-
context "when other is not given" do
|
16
|
-
context "and a block is given" do
|
17
|
-
subject { object.chain(&chain) }
|
18
|
-
|
19
|
-
let(:processors) { dsl.processors(object, other, &chain) }
|
20
|
-
|
21
|
-
it { should eql(expected) }
|
22
|
-
end
|
23
|
-
|
24
|
-
context "and no block is given" do
|
25
|
-
subject { object.chain }
|
26
|
-
|
27
|
-
let(:processors) { dsl.processors(object, other) }
|
28
|
-
|
29
|
-
it { should eql(expected) }
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
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) }
|
46
|
-
|
47
|
-
it { should eql(expected) }
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Substation::Environment, '.build' do
|
4
|
-
subject { described_class.build(&block) }
|
5
|
-
|
6
|
-
let(:block) { lambda { |_| register(:test, Substation) } }
|
7
|
-
let(:expected) { described_class.new(registry) }
|
8
|
-
let(:registry) { described_class::DSL.registry(&block) }
|
9
|
-
|
10
|
-
it { should eql(expected) }
|
11
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Substation::Environment::DSL, '.registry' do
|
4
|
-
context "when a block is given" do
|
5
|
-
subject { described_class.registry(&block) }
|
6
|
-
|
7
|
-
let(:block) { lambda { |_| register :test, Spec::Processor } }
|
8
|
-
let(:expected) { { :test => Spec::Processor } }
|
9
|
-
|
10
|
-
it { should eql(expected) }
|
11
|
-
end
|
12
|
-
|
13
|
-
context "when no block is given" do
|
14
|
-
subject { described_class.registry }
|
15
|
-
|
16
|
-
it { should eql({}) }
|
17
|
-
end
|
18
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Substation::Environment::DSL, '#register' do
|
4
|
-
subject { object.register(name, processor) }
|
5
|
-
|
6
|
-
let(:object) { described_class.new }
|
7
|
-
let(:name) { :test }
|
8
|
-
let(:processor) { Spec::Processor }
|
9
|
-
|
10
|
-
let(:expected) { { :test => Spec::Processor } }
|
11
|
-
let(:block) { lambda { |_| register :test, Spec::Processor } }
|
12
|
-
|
13
|
-
its(:registry) { should eql(expected) }
|
14
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Substation::Environment::DSL, '#registry' do
|
4
|
-
subject { object.registry }
|
5
|
-
|
6
|
-
context "when a block is given" do
|
7
|
-
let(:object) { described_class.new(&block) }
|
8
|
-
let(:block) { lambda { |_| register :test, Spec::Processor } }
|
9
|
-
let(:expected) { { :test => Spec::Processor } }
|
10
|
-
|
11
|
-
it { should eql(expected) }
|
12
|
-
end
|
13
|
-
|
14
|
-
context "when no block is given" do
|
15
|
-
let(:object) { described_class.new }
|
16
|
-
|
17
|
-
it { should eql({}) }
|
18
|
-
end
|
19
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Observer::Chain, '#call' do
|
4
|
-
subject { object.call(response) }
|
5
|
-
|
6
|
-
let(:object) { Observer::Chain.new(observers) }
|
7
|
-
|
8
|
-
let(:response) { double('Response') }
|
9
|
-
let(:observer_a) { double('Observer A') }
|
10
|
-
let(:observer_b) { double('Observer B') }
|
11
|
-
|
12
|
-
let(:observers) { [observer_a, observer_b] }
|
13
|
-
|
14
|
-
it_should_behave_like 'a command method'
|
15
|
-
|
16
|
-
before do
|
17
|
-
observer_a.stub(:call)
|
18
|
-
observer_b.stub(:call)
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'should call observers' do
|
22
|
-
observer_a.should_receive(:call).with(response)
|
23
|
-
observer_b.should_receive(:call).with(response)
|
24
|
-
subject
|
25
|
-
end
|
26
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Observer, '.coerce' do
|
4
|
-
|
5
|
-
subject { object.coerce(input) }
|
6
|
-
|
7
|
-
let(:object) { described_class }
|
8
|
-
|
9
|
-
context 'with nil input' do
|
10
|
-
let(:input) { nil }
|
11
|
-
|
12
|
-
it { should be(described_class::NULL) }
|
13
|
-
end
|
14
|
-
|
15
|
-
context 'with array input' do
|
16
|
-
let(:input) { ['Spec::Observer', nil] }
|
17
|
-
|
18
|
-
let(:observers) { [Spec::Observer, described_class::NULL] }
|
19
|
-
|
20
|
-
it { should eql(described_class::Chain.new(observers)) }
|
21
|
-
end
|
22
|
-
|
23
|
-
context 'with other input' do
|
24
|
-
let(:input) { double }
|
25
|
-
let(:coerced) { double }
|
26
|
-
|
27
|
-
before do
|
28
|
-
Utils.should_receive(:coerce_callable).with(input).and_return(coerced)
|
29
|
-
end
|
30
|
-
|
31
|
-
it { should eql(coerced) }
|
32
|
-
end
|
33
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Processor::Evaluator, '#call' do
|
6
|
-
subject { object.call(request) }
|
7
|
-
|
8
|
-
let(:request) { Request.new(double('env'), input) }
|
9
|
-
|
10
|
-
context "when no failure chain is registered" do
|
11
|
-
|
12
|
-
let(:object) { described_class.new(Spec::FAKE_ENV, Spec::Handler::Evaluator.new) }
|
13
|
-
|
14
|
-
context "when evaluation is successful" do
|
15
|
-
let(:input) { :success }
|
16
|
-
let(:response) { Response::Success.new(request, input) }
|
17
|
-
|
18
|
-
it { should eql(response) }
|
19
|
-
end
|
20
|
-
|
21
|
-
context "when evaluation is not successful" do
|
22
|
-
let(:input) { :invalid }
|
23
|
-
let(:response) { Response::Failure.new(request, :failure) }
|
24
|
-
|
25
|
-
it { should eql(response) }
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
context "when a failure chain is registered" do
|
30
|
-
|
31
|
-
let(:object) { described_class.new(env, Spec::Handler::Evaluator.new, &block) }
|
32
|
-
let(:env) { Environment.new({}) }
|
33
|
-
let(:block) { lambda { |_| use(Processor::Wrapper.new(env, Spec::Presenter)) } }
|
34
|
-
|
35
|
-
context "when evaluation is successful" do
|
36
|
-
let(:input) { :success }
|
37
|
-
let(:response) { Response::Success.new(request, input) }
|
38
|
-
|
39
|
-
it { should eql(response) }
|
40
|
-
end
|
41
|
-
|
42
|
-
context "when evaluation is not successful" do
|
43
|
-
let(:input) { :invalid }
|
44
|
-
let(:response) { Response::Failure.new(request, Spec::Presenter.new(:failure)) }
|
45
|
-
|
46
|
-
it { should eql(response) }
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Processor::Pivot, '#call' do
|
6
|
-
subject { object.call(request) }
|
7
|
-
|
8
|
-
let(:object) { described_class.new(s_env, Spec::Handler::Pivot.new) }
|
9
|
-
let(:s_env) { double }
|
10
|
-
let(:request) { Request.new(env, input) }
|
11
|
-
let(:env) { double }
|
12
|
-
let(:input) { double }
|
13
|
-
|
14
|
-
let(:response) { Response::Success.new(request, request.input) }
|
15
|
-
|
16
|
-
it { should eql(response) }
|
17
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Processor::Wrapper, '#call' do
|
6
|
-
subject { object.call(response) }
|
7
|
-
|
8
|
-
let(:object) { described_class.new(s_env, Spec::Presenter) }
|
9
|
-
let(:s_env) { double }
|
10
|
-
let(:response) { Response::Success.new(request, output) }
|
11
|
-
let(:request) { Request.new(env, input) }
|
12
|
-
let(:env) { double }
|
13
|
-
let(:input) { double }
|
14
|
-
let(:output) { double }
|
15
|
-
|
16
|
-
let(:wrapped) { Response::Success.new(request, data) }
|
17
|
-
let(:data) { Spec::Presenter.new(output) }
|
18
|
-
|
19
|
-
it { should eql(wrapped) }
|
20
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Request, '#error' do
|
6
|
-
|
7
|
-
subject { object.error(output) }
|
8
|
-
|
9
|
-
let(:object) { described_class.new(env, input) }
|
10
|
-
let(:env) { double }
|
11
|
-
let(:input) { double }
|
12
|
-
let(:output) { double }
|
13
|
-
|
14
|
-
it { should eql(Response::Failure.new(object, output)) }
|
15
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Request, '#success' do
|
6
|
-
|
7
|
-
subject { object.success(output) }
|
8
|
-
|
9
|
-
let(:object) { described_class.new(env, input) }
|
10
|
-
let(:env) { double }
|
11
|
-
let(:input) { double }
|
12
|
-
let(:output) { double }
|
13
|
-
|
14
|
-
it { should eql(Response::Success.new(object, output)) }
|
15
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Response, '#env' do
|
6
|
-
|
7
|
-
subject { object.env }
|
8
|
-
|
9
|
-
let(:object) { Class.new(described_class).new(request, output) }
|
10
|
-
let(:request) { Request.new(env, input) }
|
11
|
-
let(:env) { double }
|
12
|
-
let(:input) { double }
|
13
|
-
let(:output) { double }
|
14
|
-
|
15
|
-
it { should equal(env) }
|
16
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Response::Failure, '#success?' do
|
6
|
-
subject { object.success? }
|
7
|
-
|
8
|
-
let(:object) { described_class.new(request, output) }
|
9
|
-
let(:request) { Request.new(env, input) }
|
10
|
-
let(:env) { double }
|
11
|
-
let(:input) { double }
|
12
|
-
let(:output) { double }
|
13
|
-
|
14
|
-
it { should be(false) }
|
15
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Response, '#input' do
|
6
|
-
|
7
|
-
subject { object.input }
|
8
|
-
|
9
|
-
let(:object) { Class.new(described_class).new(request, output) }
|
10
|
-
let(:request) { Request.new(env, input) }
|
11
|
-
let(:env) { double }
|
12
|
-
let(:input) { double }
|
13
|
-
let(:output) { double }
|
14
|
-
|
15
|
-
it { should equal(input) }
|
16
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Response, '#output' do
|
6
|
-
|
7
|
-
subject { object.output }
|
8
|
-
|
9
|
-
let(:object) { Class.new(described_class).new(request, output) }
|
10
|
-
let(:request) { Request.new(env, input) }
|
11
|
-
let(:env) { double }
|
12
|
-
let(:input) { double }
|
13
|
-
let(:output) { double }
|
14
|
-
|
15
|
-
it { should equal(output) }
|
16
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Response, '#request' do
|
6
|
-
|
7
|
-
subject { object.request }
|
8
|
-
|
9
|
-
let(:object) { Class.new(described_class).new(request, output) }
|
10
|
-
let(:request) { Request.new(env, input) }
|
11
|
-
let(:env) { double }
|
12
|
-
let(:input) { double }
|
13
|
-
let(:output) { double }
|
14
|
-
|
15
|
-
it { should equal(request) }
|
16
|
-
end
|