# frozen_string_literal: true describe Nanoc::CLI::Commands::Shell, site: true, stdio: true do describe '#run' do before do # Prevent double-loading expect(Nanoc::CLI).to receive(:setup) File.write('content/hello.md', 'Hello!') File.write('Rules', <<~EOS) preprocess do @items['/hello.*'].raw_content = 'Better hello!' end compile '/**/*' do end EOS end it 'can be invoked' do expect_any_instance_of(Nanoc::Int::Context).to receive(:pry) do |ctx| expect(ctx.items.size).to eq(1) expect(ctx.items.to_a[0].unwrap.content.string).to eq('Hello!') end Nanoc::CLI.run(['shell']) end it 'will preprocess if requested' do expect_any_instance_of(Nanoc::Int::Context).to receive(:pry) do |ctx| expect(ctx.items.size).to eq(1) expect(ctx.items.to_a[0].unwrap.content.string).to eq('Better hello!') end Nanoc::CLI.run(['shell', '--preprocess']) end end describe '#env_for_site' do subject { described_class.env_for_site(site) } before do File.write('content/hello.md', 'Hello!') File.write('layouts/default.erb', '