Files
ubicloud/spec/model/usage_alert_spec.rb
Jeremy Evans 4a41370c24 Remove all skip_if_frozen{_models} calls in the specs
There is no need for these calls now that all specs are run when
frozen.
2024-10-30 12:08:24 -07:00

16 lines
749 B
Ruby

# frozen_string_literal: true
require_relative "spec_helper"
RSpec.describe UsageAlert do
it "trigger sends email and updates last_triggered_at" do
alert = described_class.new
expect(alert).to receive(:user).and_return(instance_double(Account, name: "dummy-name", email: "dummy-email")).at_least(:once)
expect(alert).to receive(:project).and_return(instance_double(Project, name: "dummy-name", ubid: "dummy-ubid", path: "dummy-path", current_invoice: instance_double(Invoice, content: {"cost" => "dummy-cost"}))).at_least(:once)
expect(Util).to receive(:send_email)
expect(Time).to receive(:now).and_return("dummy-time")
expect(alert).to receive(:update).with(last_triggered_at: "dummy-time")
alert.trigger
end
end