spec/nanoc/base/services/outdatedness_rules_spec.rb in nanoc-4.7.0 vs spec/nanoc/base/services/outdatedness_rules_spec.rb in nanoc-4.7.1

- old
+ new

@@ -433,7 +433,48 @@ it_behaves_like 'a document' end # … end + + describe 'UsesAlwaysOutdatedFilter' do + let(:rule_class) { Nanoc::Int::OutdatednessRules::UsesAlwaysOutdatedFilter } + + before do + allow(action_provider).to receive(:memory_for).with(item_rep).and_return(mem) + end + + context 'unknown filter' do + let(:mem) do + Nanoc::Int::RuleMemory.new(item_rep).tap do |mem| + mem.add_snapshot(:donkey, '/foo.md') + mem.add_filter(:asdf, {}) + end + end + + it { is_expected.not_to be } + end + + context 'known filter, not always outdated' do + let(:mem) do + Nanoc::Int::RuleMemory.new(item_rep).tap do |mem| + mem.add_snapshot(:donkey, '/foo.md') + mem.add_filter(:erb, {}) + end + end + + it { is_expected.not_to be } + end + + context 'known filter, always outdated' do + let(:mem) do + Nanoc::Int::RuleMemory.new(item_rep).tap do |mem| + mem.add_snapshot(:donkey, '/foo.md') + mem.add_filter(:xsl, {}) + end + end + + it { is_expected.to be } + end + end end end