spec/nanoc/base/services/outdatedness_checker_spec.rb in nanoc-4.7.7 vs spec/nanoc/base/services/outdatedness_checker_spec.rb in nanoc-4.7.8
- old
+ new
@@ -1,41 +1,53 @@
describe Nanoc::Int::OutdatednessChecker do
let(:outdatedness_checker) do
described_class.new(
site: site,
checksum_store: checksum_store,
+ checksums: checksums,
dependency_store: dependency_store,
action_sequence_store: action_sequence_store,
action_sequences: action_sequences,
reps: reps,
)
end
let(:checksum_store) { double(:checksum_store) }
+ let(:checksums) do
+ Nanoc::Int::Compiler::Stages::CalculateChecksums.new(
+ items: items,
+ layouts: layouts,
+ code_snippets: code_snippets,
+ config: config,
+ ).run
+ end
+
let(:dependency_store) do
Nanoc::Int::DependencyStore.new(items, layouts)
end
let(:items) { Nanoc::Int::IdentifiableCollection.new(config, [item]) }
let(:layouts) { Nanoc::Int::IdentifiableCollection.new(config) }
+ let(:code_snippets) { [] }
+
let(:site) do
Nanoc::Int::Site.new(
config: config,
- code_snippets: [],
+ code_snippets: code_snippets,
data_source: Nanoc::Int::InMemDataSource.new([], []),
)
end
let(:action_sequence_store) do
Nanoc::Int::ActionSequenceStore.new
end
let(:old_action_sequence_for_item_rep) do
- Nanoc::Int::ActionSequence.new(item_rep).tap do |seq|
- seq.add_filter(:erb, {})
+ Nanoc::Int::ActionSequence.build(item_rep) do |b|
+ b.add_filter(:erb, {})
end
end
let(:new_action_sequence_for_item_rep) { old_action_sequence_for_item_rep }
@@ -72,12 +84,12 @@
context 'with item' do
let(:obj) { item }
context 'action sequence differs' do
let(:new_action_sequence_for_item_rep) do
- Nanoc::Int::ActionSequence.new(item_rep).tap do |seq|
- seq.add_filter(:super_erb, {})
+ Nanoc::Int::ActionSequence.build(item_rep) do |b|
+ b.add_filter(:super_erb, {})
end
end
it 'is outdated due to rule differences' do
expect(subject).to eql(Nanoc::Int::OutdatednessReasons::RulesModified)
@@ -90,12 +102,12 @@
context 'with item rep' do
let(:obj) { item_rep }
context 'action sequence differs' do
let(:new_action_sequence_for_item_rep) do
- Nanoc::Int::ActionSequence.new(item_rep).tap do |seq|
- seq.add_filter(:super_erb, {})
+ Nanoc::Int::ActionSequence.build(item_rep) do |b|
+ b.add_filter(:super_erb, {})
end
end
it 'is outdated due to rule differences' do
expect(subject).to eql(Nanoc::Int::OutdatednessReasons::RulesModified)
@@ -121,12 +133,12 @@
let(:config) { Nanoc::Int::Configuration.new }
let(:items) { Nanoc::Int::IdentifiableCollection.new(config, [item, other_item]) }
let(:old_action_sequence_for_other_item_rep) do
- Nanoc::Int::ActionSequence.new(other_item_rep).tap do |seq|
- seq.add_filter(:erb, {})
+ Nanoc::Int::ActionSequence.build(other_item_rep) do |b|
+ b.add_filter(:erb, {})
end
end
let(:new_action_sequence_for_other_item_rep) { old_action_sequence_for_other_item_rep }
@@ -150,10 +162,14 @@
context 'transitive dependency' do
let(:distant_item) { Nanoc::Int::Item.new('distant stuff', {}, '/distant.md') }
let(:distant_item_rep) { Nanoc::Int::ItemRep.new(distant_item, :default) }
+ let(:items) do
+ Nanoc::Int::IdentifiableCollection.new(config, [item, other_item, distant_item])
+ end
+
let(:action_sequences) do
{
item_rep => new_action_sequence_for_item_rep,
other_item_rep => new_action_sequence_for_other_item_rep,
distant_item_rep => new_action_sequence_for_other_item_rep,
@@ -250,13 +266,13 @@
it { is_expected.to be }
end
context 'path changed' do
let(:new_action_sequence_for_other_item_rep) do
- Nanoc::Int::ActionSequence.new(other_item_rep).tap do |seq|
- seq.add_filter(:erb, {})
- seq.add_snapshot(:donkey, '/giraffe.txt')
+ Nanoc::Int::ActionSequence.build(other_item_rep) do |b|
+ b.add_filter(:erb, {})
+ b.add_snapshot(:donkey, '/giraffe.txt')
end
end
it { is_expected.not_to be }
end
@@ -294,13 +310,13 @@
it { is_expected.not_to be }
end
context 'path changed' do
let(:new_action_sequence_for_other_item_rep) do
- Nanoc::Int::ActionSequence.new(other_item_rep).tap do |seq|
- seq.add_filter(:erb, {})
- seq.add_snapshot(:donkey, '/giraffe.txt')
+ Nanoc::Int::ActionSequence.build(other_item_rep) do |b|
+ b.add_filter(:erb, {})
+ b.add_snapshot(:donkey, '/giraffe.txt')
end
end
it { is_expected.not_to be }
end
@@ -327,13 +343,13 @@
it { is_expected.to be }
end
context 'path changed' do
let(:new_action_sequence_for_other_item_rep) do
- Nanoc::Int::ActionSequence.new(other_item_rep).tap do |seq|
- seq.add_filter(:erb, {})
- seq.add_snapshot(:donkey, '/giraffe.txt')
+ Nanoc::Int::ActionSequence.build(other_item_rep) do |b|
+ b.add_filter(:erb, {})
+ b.add_snapshot(:donkey, '/giraffe.txt')
end
end
it { is_expected.not_to be }
end
@@ -354,13 +370,13 @@
it { is_expected.to be }
end
context 'path changed' do
let(:new_action_sequence_for_other_item_rep) do
- Nanoc::Int::ActionSequence.new(other_item_rep).tap do |seq|
- seq.add_filter(:erb, {})
- seq.add_snapshot(:donkey, '/giraffe.txt')
+ Nanoc::Int::ActionSequence.build(other_item_rep) do |b|
+ b.add_filter(:erb, {})
+ b.add_snapshot(:donkey, '/giraffe.txt')
end
end
it { is_expected.not_to be }
end
@@ -387,12 +403,12 @@
it { is_expected.to be }
end
context 'rules changed' do
let(:new_action_sequence_for_other_item_rep) do
- Nanoc::Int::ActionSequence.new(other_item_rep).tap do |seq|
- seq.add_filter(:erb, {})
- seq.add_filter(:donkey, {})
+ Nanoc::Int::ActionSequence.build(other_item_rep) do |b|
+ b.add_filter(:erb, {})
+ b.add_filter(:donkey, {})
end
end
it { is_expected.not_to be }
end