lacerda 2.1.1.beta5 → 2.1.1.beta6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aee1e8886987900fedffd85aa80e7404486a57c4
4
- data.tar.gz: d86b96ecfe16c57e379ad5b763211a34f5fbcfa1
3
+ metadata.gz: 890f74d8678e19e74e1acefa6b1484b9b46f8fb5
4
+ data.tar.gz: 9ed29db508e646395fefe47d2a49e894bffa2854
5
5
  SHA512:
6
- metadata.gz: 6e0e6e660736ac2f82ca6db86f851cd238ad36f7b80e5a95095b951b6199f617bc6cad3299cd3b2deabb25ab42066bb66deb2e58af8d3bcb11b0abb111dee139
7
- data.tar.gz: e24372b89d6cdedc29d834536d38b42343964be83d855e955ee7858703809c76e0388c634aa1e56833fd6ad521f4b7e1f1165e9a799628ea8f31f800ba8ccd8b
6
+ metadata.gz: 98f93e23f2135ed0de4cb92677e6d6403ac4cce83fd67f1e3f8a79f58b495a4eb6cdee9b02f3a0492df8c1eca3542fd704945aad2d1b94f7685ca55392282d27
7
+ data.tar.gz: 40985622b438b661246fbb54ce09e38ea9d832747d5d65e016e26b8be574cecb6bb4c9f0dc2f9f8b6d95c386c65344fb64f35e3a0e8a94190c68525bdfab514c
@@ -37,13 +37,14 @@ module Lacerda
37
37
  consumers.each do |consumer|
38
38
  reporter.try(:check_consumer, consumer)
39
39
  consumer.consumed_objects.each do |object|
40
- if object.publisher
41
- reporter.try(:object_publisher_existing, object.name, object.publisher.name, true)
40
+ publisher_exists = !object.publisher.nil?
41
+ is_published = publisher_exists && object.publisher.publishes?(object.name)
42
+ reporter.try(:check_consumed_object, object.name, object.publisher_name.camelize, publisher_exists, is_published)
43
+ if publisher_exists
42
44
  next
43
45
  else
44
46
  missing_publishers[object.publisher_name.camelize] ||= []
45
47
  missing_publishers[object.publisher_name.camelize] << consumer.name.camelize
46
- reporter.try(:object_publisher_existing, object.name, object.publisher_name.camelize, false)
47
48
  end
48
49
  end
49
50
  end
@@ -29,7 +29,7 @@ module Lacerda
29
29
  # Called before all consumed objects are iterated
30
30
  end
31
31
 
32
- def object_publisher_existing(consumed_object_name, publisher_name, is_published)
32
+ def check_published_object(consumed_object_name, publisher_name, publisher_exists, is_published)
33
33
  # Called after a consumed object was inspected (does a publish specification
34
34
  # for this object exist?)
35
35
  end
@@ -19,15 +19,14 @@ module Lacerda
19
19
  "- #{error[:error]} in #{error[:location]}: #{error[:message]}"
20
20
  end
21
21
  msg = "expected #{@current_publisher.description} to satisfy "\
22
- "#{consumer.name} but found these errors:\n"\
23
- " #{error_messages.join("\n")}"
22
+ "#{consumer.name} but found these errors:\n"\
23
+ " #{error_messages.join("\n")}"
24
24
  @current_publisher.it "satisfies #{consumer.name}" do
25
25
  expect(error_messages).to be_empty, msg
26
26
  end
27
27
  end
28
28
 
29
29
  def check_publishing
30
- @current_consumer.try(:run)
31
30
  @publish_group = @group.describe("publishers")
32
31
  end
33
32
 
@@ -40,13 +39,17 @@ module Lacerda
40
39
  end
41
40
 
42
41
  def check_consumer(service)
43
- @current_consumer.try(:run)
44
42
  @current_consumer = @consume_group.describe("#{service.try(:name)} consuming")
45
43
  end
46
44
 
47
- def object_publisher_existing(object_name, publisher_name, valid)
48
- @current_consumer.it "#{object_name} from #{publisher_name}" do
49
- expect(valid).to eq(true), "Publisher #{publisher_name} does not exist"
45
+ def check_consumed_object(consumed_object_name, publisher_name, publisher_exists, is_published)
46
+ error = if !publisher_exists
47
+ "Publisher #{publisher_name} does not exist"
48
+ elsif !is_published
49
+ "#{publisher_name} does not publish #{consumed_object_name}"
50
+ end
51
+ @current_consumer.it "#{consumed_object_name} from #{publisher_name}" do
52
+ expect(publisher_exists && is_published).to eq(true), error
50
53
  end
51
54
  end
52
55
 
@@ -43,9 +43,22 @@ module Lacerda
43
43
  @io.print "\nObjects consumed by #{consuming_service.name.camelize}: "
44
44
  end
45
45
 
46
- def object_publisher_existing(consumed_object_name, publisher_name, is_published)
46
+
47
+ def check_consumed_object(object)
48
+ error = if object.publisher.nil?
49
+ "Publisher #{object.publisher_name} does not exist"
50
+ elsif !object.publisher.publishes?(object.name)
51
+ "#{object.publisher.name} does not publish #{object.name}"
52
+ else
53
+ nil
54
+ end
55
+ @current_consumer.it "#{object.name} from #{object.publisher_name}" do
56
+ expect(error).to(be_nil, error)
57
+ end
58
+ end
59
+ def check_consumed_object(consumed_object_name, publisher_name, publisher_exists, is_published)
47
60
  return unless @verbose
48
- if is_published
61
+ if publisher_exists && is_published
49
62
  @io.print ".".green
50
63
  else
51
64
  @io.print "x".red
@@ -1,3 +1,3 @@
1
1
  module Lacerda
2
- VERSION = '2.1.1.beta5'
2
+ VERSION = '2.1.1.beta6'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lacerda
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1.beta5
4
+ version: 2.1.1.beta6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jannis Hermanns