neuromancer-indexer 0.1.0 → 0.2.0

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: 516f0524a5df3de1d2f9100852e154c8f05f9a07
4
- data.tar.gz: eae5ec3dc3dd58e0a28aa9f4bc8e0309a47c0e2d
3
+ metadata.gz: 3bf1df12d4386c3ef0da0ef28114803dbe0623d1
4
+ data.tar.gz: 8af4ec37e2cf7b14796926d3e403b48b20866027
5
5
  SHA512:
6
- metadata.gz: f8172335f1065e6ed7de8695e23fd2258b261ebdb12ed9e4261fa9188769f99f62b087644b87a23a7f47f3ca948c4b613f0d149ec62e5f733ad0165ea89f40e6
7
- data.tar.gz: 92683bb07be166097c36520a0c2c8b07b617663e29ad72c7d3ea75a44cda0d142e68631edd543ecf56f7f9900c1d2c3fe9ee4298dadbef3c4b29f15690f2fc6c
6
+ metadata.gz: 027b8f9c4a3fc6bab3c0487f223952d41aace4a8693ca226cd8563fdc0736311f538c36f3a80264a5009d74e231b75fc84b2fdec894632aad498123fb275d3c9
7
+ data.tar.gz: b01cfdc29a4451a771b2d3a2d3c18c1d02802dd3fada8298c7be542f5b0cd4d3200e58f6c0440aa3e685dbce342c8e3276975a8c3eeb5e8c942ea2d5ccef49c4
data/CHANGELOG.md CHANGED
@@ -1,4 +1,7 @@
1
1
  ## Changelog
2
2
 
3
+ #### 0.2.0
4
+ - add `NeuromancerSpec.stub` to support unit tests
5
+
3
6
  #### 0.1.0
4
7
  - initial version
data/Gemfile.lock CHANGED
@@ -1,15 +1,15 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- neuromancer-indexer (0.1.0)
4
+ neuromancer-indexer (0.2.0)
5
5
  aws-sdk-sqs
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
10
  aws-eventstream (1.0.3)
11
- aws-partitions (1.224.0)
12
- aws-sdk-core (3.68.1)
11
+ aws-partitions (1.226.0)
12
+ aws-sdk-core (3.69.1)
13
13
  aws-eventstream (~> 1.0, >= 1.0.2)
14
14
  aws-partitions (~> 1.0)
15
15
  aws-sigv4 (~> 1.1)
@@ -40,7 +40,7 @@ PLATFORMS
40
40
  ruby
41
41
 
42
42
  DEPENDENCIES
43
- bundler (~> 2.0)
43
+ bundler (~> 1.17.3)
44
44
  neuromancer-indexer!
45
45
  rake (~> 10.0)
46
46
  rspec (~> 3.0)
data/README.md CHANGED
@@ -23,6 +23,16 @@ Neuromancer::Indexer.index({
23
23
  })
24
24
  ```
25
25
 
26
+ Stubbing in specs
27
+
28
+ ```
29
+ RSpec.configure do |config|
30
+ config.before :each do
31
+ NeuromancerSpec.stub
32
+ end
33
+ end
34
+ ```
35
+
26
36
 
27
37
  ### Installation
28
38
 
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NeuromancerSpec
4
+ def self.stub
5
+ sqs = Aws::SQS::Client.new(
6
+ region: 'eu-central-1',
7
+ stub_responses: true
8
+ )
9
+ client = Neuromancer::Indexer::Client.new(sqs)
10
+ Neuromancer::Indexer.instance_variable_set('@client', client)
11
+ end
12
+
13
+ def self.unstub
14
+ client = Neuromancer::Indexer::Client.new
15
+ Neuromancer::Indexer.instance_variable_set('@client', client)
16
+ end
17
+ end
@@ -15,9 +15,7 @@ module Neuromancer
15
15
 
16
16
  def self.configure
17
17
  yield config
18
-
19
18
  config.validate!
20
- @client = Client.new
21
19
 
22
20
  config
23
21
  end
@@ -6,10 +6,11 @@ require 'aws-sdk-sqs'
6
6
  module Neuromancer
7
7
  module Indexer
8
8
  class Client
9
- attr_reader :config
9
+ attr_reader :config, :sqs
10
10
 
11
- def initialize
11
+ def initialize(sqs)
12
12
  @config = Neuromancer::Indexer.config
13
+ @sqs = sqs || Aws::SQS::Client.new(region: config.region)
13
14
  end
14
15
 
15
16
  def index(obj)
@@ -24,9 +25,6 @@ module Neuromancer
24
25
  end
25
26
 
26
27
  private
27
- def sqs
28
- @sqs ||= Aws::SQS::Client.new(region: config.region)
29
- end
30
28
 
31
29
  def validate_message!(message)
32
30
  hash = JSON.parse(message)
@@ -1,5 +1,5 @@
1
1
  module Neuromancer
2
2
  module Indexer
3
- VERSION = '0.1.0'.freeze
3
+ VERSION = '0.2.0'.freeze
4
4
  end
5
5
  end
@@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
36
36
 
37
37
  spec.add_dependency 'aws-sdk-sqs'
38
38
 
39
- spec.add_development_dependency 'bundler', '~> 2.0'
39
+ spec.add_development_dependency 'bundler', '~> 1.17.3'
40
40
  spec.add_development_dependency 'rspec', '~> 3.0'
41
41
  spec.add_development_dependency 'rake', '~> 10.0'
42
42
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neuromancer-indexer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joergen Dahlke
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-18 00:00:00.000000000 Z
11
+ date: 2019-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-sqs
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.0'
33
+ version: 1.17.3
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '2.0'
40
+ version: 1.17.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -84,6 +84,7 @@ files:
84
84
  - Rakefile
85
85
  - bin/console
86
86
  - bin/setup
87
+ - lib/neuromancer-indexer/rspec.rb
87
88
  - lib/neuromancer/indexer.rb
88
89
  - lib/neuromancer/indexer/client.rb
89
90
  - lib/neuromancer/indexer/configuration.rb