Sha256: 0ed43ff3f54d377a8bea7748221a69a84f526f71f628eb163b2ae48b4dcf74c5

Contents?: true

Size: 1.16 KB

Versions: 10

Compression:

Stored size: 1.16 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

10 entries across 10 versions & 2 rubygems

Version Path
casualjim-caricature-0.3.0 spec/interop_spec.rb
casualjim-caricature-0.3.1 spec/interop_spec.rb
casualjim-caricature-0.5.0 spec/interop_spec.rb
casualjim-caricature-0.6.0 spec/interop_spec.rb
casualjim-caricature-0.6.1 spec/interop_spec.rb
caricature-0.6.0 spec/interop_spec.rb
caricature-0.3.1 spec/interop_spec.rb
caricature-0.3.0 spec/interop_spec.rb
caricature-0.6.1 spec/interop_spec.rb
caricature-0.5.0 spec/interop_spec.rb