Sha256: 7d4721427ddb84e1b5c6e73ac2c9d2b5bd62b33df9273e36bdfb53464ca00e0d

Contents?: true

Size: 650 Bytes

Versions: 4

Compression:

Stored size: 650 Bytes

Contents

# encoding: utf-8

class Nanoc::Int::CodeSnippetTest < Nanoc::TestCase
  def test_load
    # Initialize
    $complete_insane_parrot = 'meow'

    # Create code and load it
    code_snippet = Nanoc::Int::CodeSnippet.new("$complete_insane_parrot = 'woof'", 'parrot.rb')
    code_snippet.load

    # Ensure code is loaded
    assert_equal('woof', $complete_insane_parrot)
  end

  def test_load_with_toplevel_binding
    # Initialize
    @foo = 'meow'

    # Create code and load it
    code_snippet = Nanoc::Int::CodeSnippet.new("@foo = 'woof'", 'dog.rb')
    code_snippet.load

    # Ensure binding is correct
    assert_equal('meow', @foo)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
nanoc-4.0.0b2 test/base/test_code_snippet.rb
nanoc-4.0.0b1 test/base/test_code_snippet.rb
nanoc-4.0.0a2 test/base/test_code_snippet.rb
nanoc-4.0.0a1 test/base/test_code_snippet.rb