Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update shards and ameba suggestions #83

Merged
merged 1 commit into from
Sep 15, 2023
Merged
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
4 changes: 2 additions & 2 deletions shard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
28 changes: 14 additions & 14 deletions spec/callbacks_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@ 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
end
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
end
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
Expand All @@ -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
Expand All @@ -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

Expand All @@ -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
2 changes: 1 addition & 1 deletion spec/support/cleanup_helper.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down