Sha256: b1b48b0eba82f71c70eeac809b73040cefdaeabb4872f341a4790bf101f84d07

Contents?: true

Size: 892 Bytes

Versions: 22

Compression:

Stored size: 892 Bytes

Contents

require 'helper'

class Nanoc::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::Checking::DSL.from_file('Checks')

      # One new check
      refute Nanoc::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::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::Checking::DSL.from_file('Checks')
      assert($stuff.start_with?('/'))
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
nanoc-4.7.9 test/checking/test_dsl.rb
nanoc-4.7.8 test/checking/test_dsl.rb
nanoc-4.7.7 test/checking/test_dsl.rb
nanoc-4.7.6 test/checking/test_dsl.rb
nanoc-4.7.5 test/checking/test_dsl.rb
nanoc-4.7.4 test/checking/test_dsl.rb
nanoc-4.7.3 test/checking/test_dsl.rb
nanoc-4.7.2 test/checking/test_dsl.rb
nanoc-4.7.1 test/checking/test_dsl.rb
nanoc-4.7.0 test/checking/test_dsl.rb
nanoc-4.6.4 test/checking/test_dsl.rb
nanoc-4.6.3 test/checking/test_dsl.rb
nanoc-4.6.2 test/checking/test_dsl.rb
nanoc-4.6.1 test/checking/test_dsl.rb
nanoc-4.6.0 test/checking/test_dsl.rb
nanoc-4.5.4 test/checking/test_dsl.rb
nanoc-4.5.3 test/checking/test_dsl.rb
nanoc-4.5.2 test/checking/test_dsl.rb
nanoc-4.5.1 test/checking/test_dsl.rb
nanoc-4.5.0 test/checking/test_dsl.rb