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: e260d3381714a7a7260e52ace95f3468db7670f3
4
- data.tar.gz: 150db5b50d0a77943a02678e037b0d28df22b560
3
+ metadata.gz: 9c9bf0f6f45f7f283a9cf8bf9aad6975e3b0ab44
4
+ data.tar.gz: 64b6b1689a56bd7a6f61e6c93f59b3469424ed1f
5
5
  SHA512:
6
- metadata.gz: 01a7ce6348cf94b5496142e5ba0ed1c7d817a565a4a85c5497ca98f505c9d5f560557dfff919d7791467b22b87585ff0fa331c0f5df441d6c7df86c92b17122b
7
- data.tar.gz: 7f9f2b025e83cf696a5eda50360bb70faec7e83b8d05434e3123b57d0baaffb27bde5930921b9d06476fd1c2bf1cdd335c19181d4731046ce260ea9ddffd16cd
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 Responder.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")
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
@@ -1,3 +1,3 @@
1
1
  module ResponsiveService
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  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 do |response|
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.1
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-26 00:00:00.000000000 Z
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.0.14
110
+ rubygems_version: 2.2.1
111
111
  signing_key:
112
112
  specification_version: 4
113
113
  summary: Easy to use responsive service pattern