Sha256: e2f57b28ee984965fa529849f15c86f03570008aec9af65588158baef9b54cea

Contents?: true

Size: 909 Bytes

Versions: 2

Compression:

Stored size: 909 Bytes

Contents

class Nanoc::Extra::Checking::DSLTest < Nanoc::TestCase
  def test_from_file
    with_site do |_site|
      File.open('Checks', 'w') { |io| io.write("check :foo do\n\nend\ndeploy_check :bar\n") }
      dsl = Nanoc::Extra::Checking::DSL.from_file('Checks')

      # One new check
      refute Nanoc::Extra::Checking::Check.named(:foo).nil?

      # One check marked for deployment
      assert_equal [:bar], dsl.deploy_checks
    end
  end

  def test_has_base_path
    with_site do |_site|
      File.write('stuff.rb', '$greeting = "hello"')
      File.write('Checks', 'require "./stuff"')
      Nanoc::Extra::Checking::DSL.from_file('Checks')
      assert_equal 'hello', $greeting
    end
  end

  def test_has_absolute_path
    with_site do |_site|
      File.write('Checks', '$stuff = __FILE__')
      Nanoc::Extra::Checking::DSL.from_file('Checks')
      assert($stuff.start_with?('/'))
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nanoc-4.3.7 test/extra/checking/test_dsl.rb
nanoc-4.3.6 test/extra/checking/test_dsl.rb