Class: Lacerda::Reporters::RSpec

Inherits:
Lacerda::Reporter show all
Defined in:
lib/lacerda/reporters/rspec.rb

Instance Method Summary collapse

Methods inherited from Lacerda::Reporter

#object_publish_specification_valid

Constructor Details

#initialize(group = RSpec.describe("Lacerda infrastructure contract validation")) ⇒ RSpec

Returns a new instance of RSpec.



6
7
8
# File 'lib/lacerda/reporters/rspec.rb', line 6

def initialize(group = RSpec.describe("Lacerda infrastructure contract validation"))
  @group = group
end

Instance Method Details

#check_consumer(service) ⇒ Object



30
31
32
33
# File 'lib/lacerda/reporters/rspec.rb', line 30

def check_consumer(service)
  @current_consumer.try(:run)
  @current_consumer = @consume_group.describe("#{service.name} consuming")
end

#check_consumingObject



25
26
27
28
# File 'lib/lacerda/reporters/rspec.rb', line 25

def check_consuming
  @current_publisher.try(:run)
  @consume_group = @group.describe("consumers")
end

#check_publisher(service) ⇒ Object



14
15
16
17
# File 'lib/lacerda/reporters/rspec.rb', line 14

def check_publisher(service)
  @current_publisher.try(:run)
  @current_publisher = @publish_group.describe(service.name)
end

#check_publishingObject



10
11
12
# File 'lib/lacerda/reporters/rspec.rb', line 10

def check_publishing
  @publish_group = @group.describe("publishers")
end

#object_publish_specificaiton_valid(object, valid) ⇒ Object



19
20
21
22
23
# File 'lib/lacerda/reporters/rspec.rb', line 19

def object_publish_specificaiton_valid(object, valid)
  @current_publisher.it "-> #{object.consumer.name}" do
    expect(valid).to be true
  end
end

#object_publisher_existing(object, valid) ⇒ Object



35
36
37
38
39
# File 'lib/lacerda/reporters/rspec.rb', line 35

def object_publisher_existing(object, valid)
  @current_consumer.it "#{object.name} from #{object.publisher.name}" do
    expect(valid).to be true
  end
end

#result(errors) ⇒ Object



41
42
43
44
# File 'lib/lacerda/reporters/rspec.rb', line 41

def result(errors)
  @current_consumer.try(:run)
  @group.run
end