Sha256: e55fb7f148ffdb6fb86743d3cf9f45a57cf3bf191cee11151d797c6ac58b571e

Contents?: true

Size: 608 Bytes

Versions: 20

Compression:

Stored size: 608 Bytes

Contents

require 'spec/spec_helper'

describe "Object" do
  before :all do
    @orig_version = VERSION
    Object.send :remove_const, :VERSION
    Object.const_set :VERSION, "1.8.6"
    load 'lib/extensions/object.rb'
  end

  after :all do
    Object.send :remove_const, :VERSION
    Object.const_set :VERSION, @orig_version
  end

  it "should execute blocks with args in instance context" do
    str = "string"

    class << str
      def my_singleton_method(arg)
        arg
      end
    end

    block = Proc.new { |arg| my_singleton_method(arg) }

    str.instance_exec("foo",&block).should == "foo"
  end
end

Version data entries

20 entries across 20 versions & 4 rubygems

Version Path
bret-watircraft-0.4.0 spec/object_spec.rb
bret-watircraft-0.4.1 spec/object_spec.rb
bret-watircraft-0.4.2 spec/object_spec.rb
bret-watircraft-0.4.3 spec/object_spec.rb
bret-watircraft-0.4.4 spec/object_spec.rb
bret-watircraft-0.4.5 spec/object_spec.rb
bret-watircraft-0.5.0 spec/object_spec.rb
makevoid-taza-0.8.6 spec/object_spec.rb
scudco-taza-0.8.1 spec/object_spec.rb
scudco-taza-0.8.3 spec/object_spec.rb
scudco-taza-0.8.4 spec/object_spec.rb
scudco-taza-0.8.5 spec/object_spec.rb
scudco-taza-0.8.6 spec/object_spec.rb
scudco-taza-0.8.7 spec/object_spec.rb
taza-0.8.4 spec/object_spec.rb
taza-0.8.3 spec/object_spec.rb
taza-0.8.2 spec/object_spec.rb
taza-0.8.5 spec/object_spec.rb
taza-0.8.6 spec/object_spec.rb
taza-0.8.7 spec/object_spec.rb