Sha256: 9c7d8b04575f27c366033c94b8e6e71e2bc36859b2de1df19c376dd612062ead

Contents?: true

Size: 875 Bytes

Versions: 2

Compression:

Stored size: 875 Bytes

Contents

class Nanoc::CLI::Commands::SyncTest < MiniTest::Unit::TestCase

  include Nanoc::TestHelpers

  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.6.1 test/cli/commands/test_sync.rb
nanoc-3.6.0 test/cli/commands/test_sync.rb