Sha256: edc58bc472a49bd724ac0c2973b31cfd28f37f0b7e7c6c864609d4a1cdd9eff8

Contents?: true

Size: 1.11 KB

Versions: 3

Compression:

Stored size: 1.11 KB

Contents

describe Nanoc::CLI::Commands::CompileListeners::DiffGenerator do
  describe '.enable_for?' do
    subject { described_class.enable_for?(command_runner) }

    let(:options) { {} }
    let(:config_hash) { {} }

    let(:arguments) { double(:arguments) }
    let(:command) { double(:command) }

    let(:site) do
      Nanoc::Int::Site.new(
        config: config,
        code_snippets: code_snippets,
        data_source: Nanoc::Int::InMemDataSource.new(items, layouts),
      )
    end

    let(:config) { Nanoc::Int::Configuration.new(hash: config_hash).with_defaults }
    let(:items) { [] }
    let(:layouts) { [] }
    let(:code_snippets) { [] }

    let(:command_runner) do
      Nanoc::CLI::Commands::Compile.new(options, arguments, command).tap do |cr|
        cr.site = site
      end
    end

    context 'default' do
      it { is_expected.not_to be }
    end

    context 'enabled in config' do
      let(:config_hash) { { enable_output_diff: true } }
      it { is_expected.to be }
    end

    context 'enabled on command line' do
      let(:options) { { diff: true } }
      it { is_expected.to be }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nanoc-4.7.9 spec/nanoc/cli/commands/compile/diff_generator_spec.rb
nanoc-4.7.8 spec/nanoc/cli/commands/compile/diff_generator_spec.rb
nanoc-4.7.7 spec/nanoc/cli/commands/compile/diff_generator_spec.rb