Livecheck: Expand test coverage

This brings line coverage for the `Livecheck` DSL back to 100%, as we
had evidently overlooked part of the `#strategy` method.
This commit is contained in:
Sam Ford 2025-02-04 18:48:00 -05:00
parent a16f5666a8
commit 8997cccddf
No known key found for this signature in database
GPG Key ID: 7AF5CBEE1DD6F76D

View File

@ -99,13 +99,23 @@ RSpec.describe Livecheck do
end
describe "#strategy" do
block = proc { |page, regex| page.scan(regex).map { |match| match[0].tr("_", ".") } }
it "returns nil if not set" do
expect(livecheck_f.strategy).to be_nil
expect(livecheck_f.strategy_block).to be_nil
end
it "returns the Symbol if set" do
livecheck_f.strategy(:page_match)
expect(livecheck_f.strategy).to eq(:page_match)
expect(livecheck_f.strategy_block).to be_nil
end
it "sets `strategy_block` when provided" do
livecheck_f.strategy(:page_match, &block)
expect(livecheck_f.strategy).to eq(:page_match)
expect(livecheck_f.strategy_block).to eq(block)
end
end