spec/nanoc/base/services/compiler/phases/abstract_spec.rb in nanoc-4.7.0 vs spec/nanoc/base/services/compiler/phases/abstract_spec.rb in nanoc-4.7.1
- old
+ new
@@ -1,8 +1,8 @@
describe Nanoc::Int::Compiler::Phases::Abstract do
subject(:phase) do
- described_class.new(wrapped: wrapped, name: 'my_phase')
+ described_class.new(wrapped: wrapped)
end
let(:item) { Nanoc::Int::Item.new('foo', {}, '/stuff.md') }
let(:rep) { Nanoc::Int::ItemRep.new(item, :default) }
@@ -17,32 +17,44 @@
end
describe '#call' do
subject { phase.call(rep, is_outdated: false) }
- let(:phase) do
+ let(:phase_class) do
Class.new(described_class) do
+ def self.to_s
+ 'AbstractSpec::MyTestingPhaseClass'
+ end
+
def run(_rep, is_outdated:) # rubocop:disable Lint/UnusedMethodArgument
yield
end
- end.new(wrapped: wrapped, name: 'my_phase')
+ end
end
- let(:wrapped) do
+ let(:phase) { phase_class.new(wrapped: wrapped) }
+
+ let(:wrapped_class) do
Class.new(described_class) do
+ def self.to_s
+ 'AbstractSpec::MyTestingWrappedPhaseClass'
+ end
+
def run(_rep, is_outdated:); end
- end.new(wrapped: nil, name: 'wrapped_phase')
+ end
end
+ let(:wrapped) { wrapped_class.new(wrapped: nil) }
+
it 'sends the proper notifications' do
- expect(Nanoc::Int::NotificationCenter).to receive(:post).with(:phase_started, 'my_phase', rep).ordered
- expect(Nanoc::Int::NotificationCenter).to receive(:post).with(:phase_yielded, 'my_phase', rep).ordered
+ expect(Nanoc::Int::NotificationCenter).to receive(:post).with(:phase_started, 'MyTestingPhaseClass', rep).ordered
+ expect(Nanoc::Int::NotificationCenter).to receive(:post).with(:phase_yielded, 'MyTestingPhaseClass', rep).ordered
- expect(Nanoc::Int::NotificationCenter).to receive(:post).with(:phase_started, 'wrapped_phase', rep).ordered
- expect(Nanoc::Int::NotificationCenter).to receive(:post).with(:phase_ended, 'wrapped_phase', rep).ordered
+ expect(Nanoc::Int::NotificationCenter).to receive(:post).with(:phase_started, 'MyTestingWrappedPhaseClass', rep).ordered
+ expect(Nanoc::Int::NotificationCenter).to receive(:post).with(:phase_ended, 'MyTestingWrappedPhaseClass', rep).ordered
- expect(Nanoc::Int::NotificationCenter).to receive(:post).with(:phase_resumed, 'my_phase', rep).ordered
- expect(Nanoc::Int::NotificationCenter).to receive(:post).with(:phase_ended, 'my_phase', rep).ordered
+ expect(Nanoc::Int::NotificationCenter).to receive(:post).with(:phase_resumed, 'MyTestingPhaseClass', rep).ordered
+ expect(Nanoc::Int::NotificationCenter).to receive(:post).with(:phase_ended, 'MyTestingPhaseClass', rep).ordered
subject
end
end
end