Sha256: cc5824f89148b1c24f02f56a94d387b6455cbf37d9207b1da8ecf99ad2c27396

Contents?: true

Size: 631 Bytes

Versions: 40

Compression:

Stored size: 631 Bytes

Contents

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

40 entries across 40 versions & 1 rubygems

Version Path
nanoc-4.4.5 test/base/test_code_snippet.rb
nanoc-4.4.4 test/base/test_code_snippet.rb
nanoc-4.4.3 test/base/test_code_snippet.rb
nanoc-4.4.2 test/base/test_code_snippet.rb
nanoc-4.4.1 test/base/test_code_snippet.rb
nanoc-4.4.0 test/base/test_code_snippet.rb
nanoc-4.3.8 test/base/test_code_snippet.rb
nanoc-4.3.7 test/base/test_code_snippet.rb
nanoc-4.3.6 test/base/test_code_snippet.rb
nanoc-4.3.5 test/base/test_code_snippet.rb
nanoc-4.3.4 test/base/test_code_snippet.rb
nanoc-4.3.3 test/base/test_code_snippet.rb
nanoc-4.3.2 test/base/test_code_snippet.rb
nanoc-4.3.1 test/base/test_code_snippet.rb
nanoc-4.3.0 test/base/test_code_snippet.rb
nanoc-4.2.4 test/base/test_code_snippet.rb
nanoc-4.2.3 test/base/test_code_snippet.rb
nanoc-4.2.2 test/base/test_code_snippet.rb
nanoc-4.2.1 test/base/test_code_snippet.rb
nanoc-4.2.0 test/base/test_code_snippet.rb