diff --git a/Gemfile b/Gemfile index fa75df1..b4e2a20 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,3 @@ -source 'https://rubygems.org' +source "https://rubygems.org" gemspec diff --git a/entity_projection.gemspec b/entity_projection.gemspec index 0815d86..498080a 100644 --- a/entity_projection.gemspec +++ b/entity_projection.gemspec @@ -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 = 'opensource@eventide-project.org' - s.homepage = 'https://github.com/eventide-project/entity-projection' - s.licenses = ['MIT'] + s.authors = ["The Eventide Project"] + s.email = "opensource@eventide-project.org" + 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 diff --git a/init.rb b/init.rb index 16cf609..80f4cad 100755 --- a/init.rb +++ b/init.rb @@ -1,3 +1,3 @@ -require_relative './load_path' +require_relative "./load_path" -require 'entity_projection' +require "entity_projection" diff --git a/lib/entity_projection.rb b/lib/entity_projection.rb index 57733e0..d6dfc4c 100755 --- a/lib/entity_projection.rb +++ b/lib/entity_projection.rb @@ -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" diff --git a/lib/entity_projection/controls.rb b/lib/entity_projection/controls.rb index c64518e..6c85a9d 100644 --- a/lib/entity_projection/controls.rb +++ b/lib/entity_projection/controls.rb @@ -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" diff --git a/lib/entity_projection/controls/projection.rb b/lib/entity_projection/controls/projection.rb index 66eae17..a6093d6 100644 --- a/lib/entity_projection/controls/projection.rb +++ b/lib/entity_projection/controls/projection.rb @@ -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 diff --git a/load_path.rb b/load_path.rb index 4f7ebf2..69ebac3 100644 --- a/load_path.rb +++ b/load_path.rb @@ -1,4 +1,4 @@ -bundler_standalone_loader = 'gems/bundler/setup' +bundler_standalone_loader = "gems/bundler/setup" begin require_relative bundler_standalone_loader @@ -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) diff --git a/test.rb b/test.rb index d92b472..7172472 100755 --- a/test.rb +++ b/test.rb @@ -1 +1 @@ -require_relative 'test/automated' +require_relative "test/automated" diff --git a/test/automated.rb b/test/automated.rb index 9a08835..94c1b1e 100644 --- a/test/automated.rb +++ b/test/automated.rb @@ -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) diff --git a/test/automated/apply/apply_method/event_data.rb b/test/automated/apply/apply_method/event_data.rb index 64f5cc3..2af415e 100644 --- a/test/automated/apply/apply_method/event_data.rb +++ b/test/automated/apply/apply_method/event_data.rb @@ -1,10 +1,10 @@ -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 @@ -12,7 +12,7 @@ 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 diff --git a/test/automated/apply/apply_method/message.rb b/test/automated/apply/apply_method/message.rb index 5eb9805..5730c87 100644 --- a/test/automated/apply/apply_method/message.rb +++ b/test/automated/apply/apply_method/message.rb @@ -1,4 +1,4 @@ -require_relative '../../automated_init' +require_relative "../../automated_init" context "Apply" do context "Apply Method" do @@ -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 diff --git a/test/automated/apply/event_data_as_message.rb b/test/automated/apply/event_data_as_message.rb index a33af09..b04991d 100644 --- a/test/automated/apply/event_data_as_message.rb +++ b/test/automated/apply/event_data_as_message.rb @@ -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 @@ -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 @@ -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 diff --git a/test/automated/apply/message.rb b/test/automated/apply/message.rb index 3512d40..6811bd4 100644 --- a/test/automated/apply/message.rb +++ b/test/automated/apply/message.rb @@ -1,4 +1,4 @@ -require_relative '../automated_init' +require_relative "../automated_init" context "Apply" do context "Message" do @@ -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 diff --git a/test/automated/automated_init.rb b/test/automated/automated_init.rb index faa8577..f9272a5 100644 --- a/test/automated/automated_init.rb +++ b/test/automated/automated_init.rb @@ -1 +1 @@ -require_relative '../test_init' +require_relative "../test_init" diff --git a/test/automated/entity_name_macro.rb b/test/automated/entity_name_macro.rb index 2b9ebd5..71e24cc 100644 --- a/test/automated/entity_name_macro.rb +++ b/test/automated/entity_name_macro.rb @@ -1,4 +1,4 @@ -require_relative 'automated_init' +require_relative "automated_init" context "Entity Name Macro" do entity = EntityProjection::Controls::Entity::New.example diff --git a/test/automated/macro/incorrect_arity.rb b/test/automated/macro/incorrect_arity.rb index 636899c..d124b06 100644 --- a/test/automated/macro/incorrect_arity.rb +++ b/test/automated/macro/incorrect_arity.rb @@ -1,4 +1,4 @@ -require_relative '../automated_init' +require_relative "../automated_init" context "Apply" do context "Macro" do diff --git a/test/automated/macro/macro.rb b/test/automated/macro/macro.rb index 9523c0f..b274c75 100644 --- a/test/automated/macro/macro.rb +++ b/test/automated/macro/macro.rb @@ -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) diff --git a/test/automated/macro/missing_block.rb b/test/automated/macro/missing_block.rb index 9887b54..bd82220 100644 --- a/test/automated/macro/missing_block.rb +++ b/test/automated/macro/missing_block.rb @@ -1,4 +1,4 @@ -require_relative '../automated_init' +require_relative "../automated_init" context "Apply" do context "Macro" do diff --git a/test/automated/register.rb b/test/automated/register.rb index 981e193..daace34 100644 --- a/test/automated/register.rb +++ b/test/automated/register.rb @@ -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) diff --git a/test/interactive.rb b/test/interactive.rb index 06883ac..af2ceae 100644 --- a/test/interactive.rb +++ b/test/interactive.rb @@ -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 diff --git a/test/interactive/interactive_init.rb b/test/interactive/interactive_init.rb index b0bf3ff..9ac570e 100644 --- a/test/interactive/interactive_init.rb +++ b/test/interactive/interactive_init.rb @@ -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" diff --git a/test/interactive/projection.rb b/test/interactive/projection.rb index 3052a84..038c673 100644 --- a/test/interactive/projection.rb +++ b/test/interactive/projection.rb @@ -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 @@ -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] diff --git a/test/test_init.rb b/test/test_init.rb index 2f8e727..f524bcf 100755 --- a/test/test_init.rb +++ b/test/test_init.rb @@ -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"