Files
ubicloud/spec/prog/page_nexus_spec.rb
Burak Yucesoy 452ef85bef Delete pages on resolution
We delete(actually destroy) almost all resources when we are done with them. At
some point we considered soft-deleting. As a result of that we didn't deleted
pages on resolution and instead marked them as resolved. However, since then we
also introduced the DeletedRecords concept for historical bookkeeping. I think
keeping the pages around is not worth much anymore. We can always look at the
DeletedRecords if we need to know what was resolved. We also have old pages in
Pagerduty and Slack for easy search. Hence, I'm changing page resolution logic
to delete the page instead of just marking it as resolved.
2024-05-03 17:59:23 +02:00

34 lines
728 B
Ruby

# frozen_string_literal: true
require_relative "../model/spec_helper"
RSpec.describe Prog::PageNexus do
subject(:pn) {
described_class.new(Strand.new).tap {
_1.instance_variable_set(:@page, pg)
}
}
let(:pg) { Page.new }
describe "#start" do
it "triggers page and hops" do
expect(pg).to receive(:trigger)
expect { pn.start }.to hop("wait")
end
end
describe "#wait" do
it "exits when resolved" do
expect(pn).to receive(:when_resolve_set?).and_yield
expect(pg).to receive(:resolve)
expect(pg).to receive(:destroy)
expect { pn.wait }.to exit({"msg" => "page is resolved"})
end
it "naps" do
expect { pn.wait }.to nap(30)
end
end
end