Sha256: 2fb0ecea318b879a6ec5269219ca417defd3fb0333aca34016a845851942cdea

Contents?: true

Size: 834 Bytes

Versions: 2

Compression:

Stored size: 834 Bytes

Contents

class Nanoc::CLI::Commands::SyncTest < Nanoc::TestCase
  def test_run
    with_site do
      File.open('lib/foo_data_source.rb', 'w') do |io|
        io.write "class FooDataSource < Nanoc::DataSource\n"
        io.write "  identifier :sync_test_foo\n"
        io.write "  def sync\n"
        io.write "    File.open('foo_source_data.yaml', 'w') do |io|\n"
        io.write "      io.write 'sync: true'\n"
        io.write "    end\n"
        io.write "  end\n"
        io.write "end\n"
      end

      File.open('nanoc.yaml', 'w') do |io|
        io.write "data_sources:\n"
        io.write "  - type: sync_test_foo\n"
        io.write '    items_root: /'
      end

      Nanoc::CLI.run %w( sync )

      assert File.file?('foo_source_data.yaml')
      assert_equal File.read('foo_source_data.yaml'), 'sync: true'
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nanoc-3.8.0 test/cli/commands/test_sync.rb
nanoc-3.7.5 test/cli/commands/test_sync.rb