Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
source 'https://rubygems.org'
source "https://rubygems.org"

gemspec
28 changes: 14 additions & 14 deletions entity_projection.gemspec
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'evt-entity_projection'
s.version = '2.0.1.4'
s.summary = 'Projects event data into an entity'
s.description = ' '
s.name = "evt-entity_projection"
s.version = "2.0.1.4"
s.summary = "Projects event data into an entity"
s.description = " "

s.authors = ['The Eventide Project']
s.email = '[email protected]'
s.homepage = 'https://github.com/eventide-project/entity-projection'
s.licenses = ['MIT']
s.authors = ["The Eventide Project"]
s.email = "[email protected]"
s.homepage = "https://github.com/eventide-project/entity-projection"
s.licenses = ["MIT"]

s.require_paths = ['lib']
s.files = Dir.glob('{lib}/**/*')
s.require_paths = ["lib"]
s.files = Dir.glob("{lib}/**/*")
s.platform = Gem::Platform::RUBY
s.required_ruby_version = '>= 2.3.3'
s.required_ruby_version = ">= 2.3.3"

s.add_runtime_dependency 'evt-messaging'
s.add_runtime_dependency "evt-messaging"

s.add_development_dependency 'test_bench'
s.add_development_dependency 'evt-message_store-postgres'
s.add_development_dependency "test_bench"
s.add_development_dependency "evt-message_store-postgres"
end
4 changes: 2 additions & 2 deletions init.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
require_relative './load_path'
require_relative "./load_path"

require 'entity_projection'
require "entity_projection"
6 changes: 3 additions & 3 deletions lib/entity_projection.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'messaging'
require "messaging"

require 'entity_projection/log'
require 'entity_projection/entity_projection'
require "entity_projection/log"
require "entity_projection/entity_projection"
10 changes: 5 additions & 5 deletions lib/entity_projection/controls.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'messaging/controls'
require "messaging/controls"

require 'entity_projection/controls/event_data'
require 'entity_projection/controls/message'
require 'entity_projection/controls/entity'
require 'entity_projection/controls/projection'
require "entity_projection/controls/event_data"
require "entity_projection/controls/message"
require "entity_projection/controls/entity"
require "entity_projection/controls/projection"
4 changes: 2 additions & 2 deletions lib/entity_projection/controls/projection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ class Example
include Controls::Message

apply SomeMessage do |some_message|
entity.some_attribute = 'some attribute value set by apply block'
entity.some_attribute = "some attribute value set by apply block"
end

def apply(event_data)
event_data.data = 'some data value set by apply method'
event_data.data = "some data value set by apply method"
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions load_path.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
bundler_standalone_loader = 'gems/bundler/setup'
bundler_standalone_loader = "gems/bundler/setup"

begin
require_relative bundler_standalone_loader
Expand All @@ -8,10 +8,10 @@
Bundler.require
end

lib_dir = File.expand_path('lib', __dir__)
lib_dir = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)

libraries_dir = ENV['LIBRARIES_HOME']
libraries_dir = ENV["LIBRARIES_HOME"]
unless libraries_dir.nil?
libraries_dir = File.expand_path(libraries_dir)
$LOAD_PATH.unshift libraries_dir unless $LOAD_PATH.include?(libraries_dir)
Expand Down
2 changes: 1 addition & 1 deletion test.rb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
require_relative 'test/automated'
require_relative "test/automated"
6 changes: 3 additions & 3 deletions test/automated.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require_relative './test_init'
require_relative "./test_init"

TestBench::Run.(
'test/automated',
exclude: '{_*,*sketch*,*_init,*_tests}.rb'
"test/automated",
exclude: "{_*,*sketch*,*_init,*_tests}.rb"
) or exit(false)
6 changes: 3 additions & 3 deletions test/automated/apply/apply_method/event_data.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
require_relative '../../automated_init'
require_relative "../../automated_init"

context "Apply" do
context "Apply Method" do
context "EventData" do
event_data = EntityProjection::Controls::EventData::Read.example
event_data.data[:attribute] = 'some value'
event_data.data[:attribute] = "some value"

context "Projection Implements Apply" do
entity = EntityProjection::Controls::Entity::New.example

EntityProjection::Controls::Projection::ApplyMethod::EventData::Example.(entity, event_data)

test "Event data is projected" do
assert(entity.some_attribute == 'some value')
assert(entity.some_attribute == "some value")
end
end

Expand Down
4 changes: 2 additions & 2 deletions test/automated/apply/apply_method/message.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require_relative '../../automated_init'
require_relative "../../automated_init"

context "Apply" do
context "Apply Method" do
Expand All @@ -11,7 +11,7 @@
EntityProjection::Controls::Projection::ApplyMethod::Message::Example.(entity, message)

test "Event data is projected" do
assert(entity.some_attribute == 'some value')
assert(entity.some_attribute == "some value")
end
end

Expand Down
8 changes: 4 additions & 4 deletions test/automated/apply/event_data_as_message.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
require_relative '../automated_init'
require_relative "../automated_init"

context "Apply" do
context "EventData" do
context "Projection Implements Message Handler for EventData's Type" do
event_data = EntityProjection::Controls::EventData::Read.example(type: 'SomeMessage')
event_data = EntityProjection::Controls::EventData::Read.example(type: "SomeMessage")

context "Message Handler" do
entity = EntityProjection::Controls::Entity::New.example
Expand All @@ -12,7 +12,7 @@

test "EventData is projected as Message" do
assert(message.is_a? Messaging::Message)
assert(entity.some_attribute == 'some attribute value set by apply block')
assert(entity.some_attribute == "some attribute value set by apply block")
end
end

Expand All @@ -22,7 +22,7 @@
message = EntityProjection::Controls::Projection::BlockAndApplyMethod::Example.(entity, event_data)

test "EventData is not handled as EventData" do
refute(entity.some_attribute == 'some data value set by apply method')
refute(entity.some_attribute == "some data value set by apply method")
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions test/automated/apply/message.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require_relative '../automated_init'
require_relative "../automated_init"

context "Apply" do
context "Message" do
Expand All @@ -10,7 +10,7 @@
EntityProjection::Controls::Projection::Example.(entity, message)

test "Message is handled" do
assert(entity.some_attribute == 'some value')
assert(entity.some_attribute == "some value")
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/automated/automated_init.rb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
require_relative '../test_init'
require_relative "../test_init"
2 changes: 1 addition & 1 deletion test/automated/entity_name_macro.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require_relative 'automated_init'
require_relative "automated_init"

context "Entity Name Macro" do
entity = EntityProjection::Controls::Entity::New.example
Expand Down
2 changes: 1 addition & 1 deletion test/automated/macro/incorrect_arity.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require_relative '../automated_init'
require_relative "../automated_init"

context "Apply" do
context "Macro" do
Expand Down
4 changes: 2 additions & 2 deletions test/automated/macro/macro.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
require_relative '../automated_init'
require_relative "../automated_init"

context "Handle" do
context "Macro" do
projection = EntityProjection::Controls::Projection::Example.new('some_entity')
projection = EntityProjection::Controls::Projection::Example.new("some_entity")

test "Defines apply methods" do
assert(projection.respond_to? :apply_some_message)
Expand Down
2 changes: 1 addition & 1 deletion test/automated/macro/missing_block.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require_relative '../automated_init'
require_relative "../automated_init"

context "Apply" do
context "Macro" do
Expand Down
4 changes: 2 additions & 2 deletions test/automated/register.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require_relative 'automated_init'
require_relative "automated_init"

context "Register" do
projection = EntityProjection::Controls::Projection::RegisterMessageClass::Example.new('some_entity')
projection = EntityProjection::Controls::Projection::RegisterMessageClass::Example.new("some_entity")

test "Registers event classes" do
assert(projection.class.event_registry.registered? EntityProjection::Controls::Message::SomeMessage)
Expand Down
4 changes: 2 additions & 2 deletions test/interactive.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require_relative 'test_init'
require_relative "test_init"

TestBench::Runner.(
'interactive/**/*.rb',
"interactive/**/*.rb",
exclude_pattern: %r{\/_|sketch|(_init\.rb|_tests\.rb)\z}
) or exit 1
8 changes: 4 additions & 4 deletions test/interactive/interactive_init.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require_relative '../test_init'
require_relative "../test_init"

require 'message_store/postgres'
require "message_store/postgres"

ENV['LOG_LEVEL'] = '_max'
ENV['LOG_TAGS'] = 'test'
ENV["LOG_LEVEL"] = "_max"
ENV["LOG_TAGS"] = "test"
8 changes: 4 additions & 4 deletions test/interactive/projection.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require_relative 'interactive_init'
require 'messaging/postgres'
require_relative "interactive_init"
require "messaging/postgres"

logger = Log.get('Projection Test')
logger = Log.get("Projection Test")

logger.info "Starting", tag: :test

Expand Down Expand Up @@ -91,7 +91,7 @@ class Projection

account_id = Identifier::UUID::Random.get

stream_name = Messaging::StreamName.stream_name(account_id, 'account')
stream_name = Messaging::StreamName.stream_name(account_id, "account")

batch = [opened, deposited, withdrawn]

Expand Down
12 changes: 6 additions & 6 deletions test/test_init.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
ENV['CONSOLE_DEVICE'] ||= 'stdout'
ENV['LOG_LEVEL'] ||= '_min'
ENV["CONSOLE_DEVICE"] ||= "stdout"
ENV["LOG_LEVEL"] ||= "_min"

puts RUBY_DESCRIPTION

require_relative '../init.rb'
require_relative "../init.rb"

require 'test_bench'; TestBench.activate
require "test_bench"; TestBench.activate

require 'securerandom'
require "securerandom"

require 'entity_projection/controls'
require "entity_projection/controls"