From f7f434cc652da5a92b73879346465580368115f1 Mon Sep 17 00:00:00 2001 From: Morgan Hallgren Date: Wed, 26 Mar 2014 14:36:45 +0100 Subject: [PATCH 1/2] Bump to 0.0.2 --- lib/sandthorn/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sandthorn/version.rb b/lib/sandthorn/version.rb index eeafccf..1d02a9f 100644 --- a/lib/sandthorn/version.rb +++ b/lib/sandthorn/version.rb @@ -1,3 +1,3 @@ module Sandthorn - VERSION = "0.0.1" + VERSION = "0.0.2" end From 5127a786d76a9c1752bc6b91e498b64a87e68e0a Mon Sep 17 00:00:00 2001 From: Morgan Hallgren Date: Wed, 26 Mar 2014 15:24:49 +0100 Subject: [PATCH 2/2] new generated wrong method name. --- Gemfile.lock | 2 +- lib/sandthorn/aggregate_root_base.rb | 6 +++--- spec/event_inspector_spec.rb | 4 ++++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index bb0d009..fc78c4e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - sandthorn (0.0.1) + sandthorn (0.0.2) dirty_hashy GEM diff --git a/lib/sandthorn/aggregate_root_base.rb b/lib/sandthorn/aggregate_root_base.rb index 7b28f05..ae550a1 100644 --- a/lib/sandthorn/aggregate_root_base.rb +++ b/lib/sandthorn/aggregate_root_base.rb @@ -30,9 +30,9 @@ def save self end - def commit *args + def commit *args, method_name: nil increase_current_aggregate_version! - method_name = caller[0][/\`.*\'/][1..-2] + method_name = caller_locations(1,1)[0].label unless method_name aggregate_attribute_deltas = get_delta unless aggregate_attribute_deltas.empty? @@ -82,7 +82,7 @@ def new *args aggregate.aggregate_trace @@aggregate_trace_information do |aggr| aggr.aggregate_initialize aggr.send :set_aggregate_id, Sandthorn.generate_aggregate_id - aggr.send :commit, *args + aggr.send :commit, *args, method_name: "new" return aggr end end diff --git a/spec/event_inspector_spec.rb b/spec/event_inspector_spec.rb index 38902d9..658bfed 100644 --- a/spec/event_inspector_spec.rb +++ b/spec/event_inspector_spec.rb @@ -52,6 +52,10 @@ module Sandthorn context "with no tracing information" do let(:subject) { aggregate.this_is_an_event;aggregate } + it "should have the new event" do + subject.has_event?(:new).should be_true + end + it "should report true on has_unsaved_event? :this_is_an_event" do subject.has_unsaved_event?(:this_is_an_event).should be_true end