Sha256: 86ec24d23c5e1a40a4eb3852b80655942166cc3ceaf3fa2e89061171fa67f972

Contents?: true

Size: 637 Bytes

Versions: 15

Compression:

Stored size: 637 Bytes

Contents

# encoding: utf-8

class Nanoc::CodeSnippetTest < Nanoc::TestCase

  def test_load
    # Initialize
    $complete_insane_parrot = 'meow'

    # Create code and load it
    code_snippet = Nanoc::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::CodeSnippet.new("@foo = 'woof'", 'dog.rb')
    code_snippet.load

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

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
nanoc-3.7.4 test/base/test_code_snippet.rb
nanoc-3.7.3 test/base/test_code_snippet.rb
nanoc-3.7.2 test/base/test_code_snippet.rb
nanoc-3.7.1 test/base/test_code_snippet.rb
nanoc-3.7.0 test/base/test_code_snippet.rb
nanoc-3.6.11 test/base/test_code_snippet.rb
nanoc-3.6.10 test/base/test_code_snippet.rb
nanoc-3.6.9 test/base/test_code_snippet.rb
nanoc-3.6.8 test/base/test_code_snippet.rb
nanoc-3.6.7 test/base/test_code_snippet.rb
nanoc-3.6.6 test/base/test_code_snippet.rb
nanoc-3.6.5 test/base/test_code_snippet.rb
nanoc-3.6.4 test/base/test_code_snippet.rb
nanoc-3.6.3 test/base/test_code_snippet.rb
nanoc-3.6.2 test/base/test_code_snippet.rb