Sha256: 68be89104a086e36e0995017fd48263bb39109fe6fe74af6c2e06b94d00d6e43

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

require File.dirname(__FILE__) + "/../bacon_helper"

describe "Event handling" do



  describe "for precompiled CLR classes" do

    before do
      @warrior = ClrModels::ExposingWarrior.new
    end

    it "should subscribe to an event" do
      ClrModels::ExposedChangedSubscriber.new(@warrior)
      @warrior.has_event_subscriptions.should.be.true?
    end

    it "should not raise an error when subcribing to an event" do
      lambda { ClrModels::ExposedChangedSubscriber.new(@warrior) }.should.not.raise
    end

    it "should handle an event when raised" do
      subscriber = ClrModels::ExposedChangedSubscriber.new(@warrior)
      @warrior.change_is_exposed
      subscriber.counter.should.equal 1
    end

  end

  describe "for an IR generated interface proxy" do

    before do
      @proxy = Caricature::ClrIsolator.new ClrModels::IExposingWarrior
    end

    # apparently events don't work yet in IronRuby.. keeping this spec here to find out when it does
#    it "should not raise an error when subcribing to an event" do
#      lambda { ClrModels::ExposedChangedSubscriber.new(@proxy.subject) }.should.not.raise
#    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
caricature-0.7.1 spec/unit/interop_spec.rb
caricature-0.7.0 spec/unit/interop_spec.rb
caricature-0.6.3 spec/unit/interop_spec.rb