Sha256: 58bfe5b08655f8badf32403a85f953dcb6f9199cc156cab3fce273f20a2981b2

Contents?: true

Size: 834 Bytes

Versions: 28

Compression:

Stored size: 834 Bytes

Contents

require "#{File.dirname(__FILE__)}/../../test_helper"

class ProcTest < Test::Unit::TestCase
  context "Proc" do
    setup do
      @this_proc = Proc.new do
        puts "hello world"
      end
    end
    should "have a proc_info" do
      assert_equal [File.expand_path(__FILE__), 6], @this_proc.proc_info
    end
    should "have the source available for the proc" do
      assert_equal open(__FILE__).read.split("\n"), @this_proc.source(__FILE__, 0)
    end
    should "be able to grab the source of the block" do
      assert_equal '        puts "hello world"', @this_proc.code
    end
    should "be able to grab the source of a block in an external file" do
      f = fixtures_dir/"resources"/"random_proc_file.rb"
      instance_eval open(f).read, f
      assert_equal "  @str = \"I have a bee\"", @b.code
    end
  end
  
end

Version data entries

28 entries across 28 versions & 3 rubygems

Version Path
auser-poolparty-1.3.0 test/lib/core/proc_test.rb
auser-poolparty-1.3.1 test/lib/core/proc_test.rb
auser-poolparty-1.3.10 test/lib/core/proc_test.rb
auser-poolparty-1.3.11 test/lib/core/proc_test.rb
auser-poolparty-1.3.12 test/lib/core/proc_test.rb
auser-poolparty-1.3.13 test/lib/core/proc_test.rb
auser-poolparty-1.3.14 test/lib/core/proc_test.rb
auser-poolparty-1.3.15 test/lib/core/proc_test.rb
auser-poolparty-1.3.16 test/lib/core/proc_test.rb
auser-poolparty-1.3.17 test/lib/core/proc_test.rb
auser-poolparty-1.3.2 test/lib/core/proc_test.rb
auser-poolparty-1.3.3 test/lib/core/proc_test.rb
auser-poolparty-1.3.4 test/lib/core/proc_test.rb
auser-poolparty-1.3.5 test/lib/core/proc_test.rb
auser-poolparty-1.3.6 test/lib/core/proc_test.rb
auser-poolparty-1.3.7 test/lib/core/proc_test.rb
auser-poolparty-1.3.8 test/lib/core/proc_test.rb
fairchild-poolparty-1.3.17 test/lib/core/proc_test.rb
fairchild-poolparty-1.3.5 test/lib/core/proc_test.rb
poolparty-1.3.15 test/lib/core/proc_test.rb