responsive_service 0.0.1 → 0.0.2
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c9bf0f6f45f7f283a9cf8bf9aad6975e3b0ab44
|
4
|
+
data.tar.gz: 64b6b1689a56bd7a6f61e6c93f59b3469424ed1f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb89596f1426c5b9ded9b6fa0b90f0e456bbbcc20d383a8ee1e5d3312525aa6d5446f49521c8e73f8e47a6d97da1ee390f7f198e1d1d854ffad6e9e0bf81671b
|
7
|
+
data.tar.gz: 01c204105261a78f5a268e5c5d9c0fb138a729309abe7dfd30c3eef23c97f5ae0d04b46c8e2c06ffd849540c36d59c2b8cb73b4c551da1ab65722a6f291ad3d4
|
@@ -1,7 +1,13 @@
|
|
1
1
|
module ResponsiveService
|
2
2
|
class ResponsiveService
|
3
|
+
attr_reader :responder_factory
|
4
|
+
|
5
|
+
def initialize(responder_factory=ResponsiveService::Responder)
|
6
|
+
@responder_factory = responder_factory
|
7
|
+
end
|
8
|
+
|
3
9
|
def call(&block)
|
4
|
-
yield
|
10
|
+
yield responder_factory.new(:unimplemented, "A ResponsiveService should implement the call method.\nThe call method should perform the relevant work of the service and yield a ResponsiveService::Responder object.\n")
|
5
11
|
end
|
6
12
|
end
|
7
13
|
end
|
@@ -2,14 +2,14 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module ResponsiveService
|
4
4
|
describe ResponsiveService do
|
5
|
-
subject(:service) { ResponsiveService.new }
|
5
|
+
subject(:service) { ResponsiveService.new(responder_factory) }
|
6
|
+
let(:responder_factory) { double :responder_factory, new: nil }
|
7
|
+
let(:responder) { double :responder }
|
6
8
|
|
7
9
|
describe '#call' do
|
10
|
+
before { responder_factory.stub(:new).with(:unimplemented, "A ResponsiveService should implement the call method.\nThe call method should perform the relevant work of the service and yield a ResponsiveService::Responder object.\n").and_return(responder) }
|
8
11
|
it 'yields with a responder indicating instructions' do
|
9
|
-
service.call
|
10
|
-
expect(response.type).to eq :unimplemented
|
11
|
-
expect(response.message).to eq "A ResponsiveService should implement the call method.\nThe call method should perform the relevant work of the service and yield a ResponsiveService::Responder object.\n"
|
12
|
-
end
|
12
|
+
expect { |b| service.call(&b) }.to yield_with_args(responder)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: responsive_service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- alexpeachey
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
107
|
version: '0'
|
108
108
|
requirements: []
|
109
109
|
rubyforge_project:
|
110
|
-
rubygems_version: 2.
|
110
|
+
rubygems_version: 2.2.1
|
111
111
|
signing_key:
|
112
112
|
specification_version: 4
|
113
113
|
summary: Easy to use responsive service pattern
|