diff --git a/shard.yml b/shard.yml index 704d2ff..0c6fc93 100644 --- a/shard.yml +++ b/shard.yml @@ -18,7 +18,7 @@ dependencies: version: ~> 0.4.7 lucky_task: github: luckyframework/lucky_task - version: ~> 0.1.1 + version: ~> 0.2.0 lucky_template: github: luckyframework/lucky_template version: ~> 0.1.0 @@ -32,7 +32,7 @@ development_dependencies: version: ~> 0.1.4 ameba: github: crystal-ameba/ameba - version: ~> 1.1.0 + version: ~> 1.5.0 scripts: postinstall: BUILD_WITHOUT_DEVELOPMENT=true script/precompile_tasks diff --git a/spec/callbacks_spec.cr b/spec/callbacks_spec.cr index b02bbf1..7cc516e 100644 --- a/spec/callbacks_spec.cr +++ b/spec/callbacks_spec.cr @@ -11,7 +11,7 @@ BaseTestEmail.configure do |setting| end private class EmailWithBeforeCallbacks < BaseTestEmail - property ran_before_callback : Bool = false + property? ran_before_callback : Bool = false before_send do self.ran_before_callback = true @@ -19,7 +19,7 @@ private class EmailWithBeforeCallbacks < BaseTestEmail end private class EmailWithAfterCallbacks < BaseTestEmail - property ran_after_callback : Bool = false + property? ran_after_callback : Bool = false after_send do |_response| self.ran_after_callback = true @@ -27,8 +27,8 @@ private class EmailWithAfterCallbacks < BaseTestEmail end private class EmailWithBothBeforeAndAfterCallbacks < BaseTestEmail - property ran_before_callback : Bool = false - property ran_after_callback : Bool = false + property? ran_before_callback : Bool = false + property? ran_after_callback : Bool = false before_send :mark_before_send after_send :mark_after_send @@ -46,7 +46,7 @@ private class EmailUsingBeforeToStopSending < BaseTestEmail before_send :dont_actually_send after_send :never_actually_ran - property ran_after_callback : Bool = false + property? ran_after_callback : Bool = false private def dont_actually_send @deliverable = false @@ -61,35 +61,35 @@ describe "before/after callbacks" do context "before an email is sent" do it "runs the before_send callback" do email = EmailWithBeforeCallbacks.new - email.ran_before_callback.should eq(false) + email.ran_before_callback?.should eq(false) email.deliver Carbon.should have_delivered_emails - email.ran_before_callback.should eq(true) + email.ran_before_callback?.should eq(true) end end context "after an email is sent" do it "runs the after_send callback" do email = EmailWithAfterCallbacks.new - email.ran_after_callback.should eq(false) + email.ran_after_callback?.should eq(false) email.deliver Carbon.should have_delivered_emails - email.ran_after_callback.should eq(true) + email.ran_after_callback?.should eq(true) end end context "running both callbacks" do it "runs both callbacks" do email = EmailWithBothBeforeAndAfterCallbacks.new - email.ran_before_callback.should eq(false) - email.ran_after_callback.should eq(false) + email.ran_before_callback?.should eq(false) + email.ran_after_callback?.should eq(false) email.deliver Carbon.should have_delivered_emails - email.ran_before_callback.should eq(true) - email.ran_after_callback.should eq(true) + email.ran_before_callback?.should eq(true) + email.ran_after_callback?.should eq(true) end end @@ -99,7 +99,7 @@ describe "before/after callbacks" do email.deliver Carbon.should_not have_delivered_emails email.deliverable?.should eq(false) - email.ran_after_callback.should eq(false) + email.ran_after_callback?.should eq(false) end end end diff --git a/spec/support/cleanup_helper.cr b/spec/support/cleanup_helper.cr index 0d00849..898ac67 100644 --- a/spec/support/cleanup_helper.cr +++ b/spec/support/cleanup_helper.cr @@ -3,7 +3,7 @@ module CleanupHelper FileUtils.rm_rf("./tmp") end - private def with_cleanup + private def with_cleanup(&) Dir.mkdir_p("./tmp") Dir.cd("./tmp") yield