Sha256: 2660cf5279367ffc4b46155cd14f233f9e3593c0c6426f6baf8b46f704a76e58

Contents?: true

Size: 1.46 KB

Versions: 7

Compression:

Stored size: 1.46 KB

Contents

require File.dirname(__FILE__)+'/../../spec_helper'

describe Gom::Remote::Subscription do

  describe "when created with default options" do
    before :each do
      @sub = (Gom::Remote::Subscription.new '/dmx/node/values')
    end
    it "should have a object id as name" do
      @sub.name.should == "0x#{@sub.object_id}"
    end
    it "should have operations whitelist" do
      @sub.operations.should == "update"
    end
    it "should have nil condition_script" do
      @sub.condition_script.should == nil
    end
    it "should have a nil uri_regexp" do
      @sub.uri_regexp.should == nil
    end
    it "should have a nil callback" do
      @sub.callback.should == nil
    end
  end

  it "should overwrite callback from options" do
    callback  = lambda {}
    s = (Gom::Remote::Subscription.new '/node/values', :callback => callback )
    s.callback.should == callback
  end

  it "should overwrite name from options value" do
    name = "test-#{Time.now.to_i}"
    s = (Gom::Remote::Subscription.new '/node/values', :name => name)
    s.name.should == name
  end

  describe "observer uri" do
    it "should construct a proper gom observer uri" do
      s = (Gom::Remote::Subscription.new '/dmx/node/values')
      s.uri.should == "/gom/observer/dmx/node/values/.#{s.name}"
    end
    it "should interpret attribute paths" do
      s = (Gom::Remote::Subscription.new '/dmx/node:attribute')
      s.uri.should == "/gom/observer/dmx/node/attribute/.#{s.name}"
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
gom-script-0.2.2 spec/gom/remote/subscription_spec.rb
gom-script-0.2.0 spec/gom/remote/subscription_spec.rb
gom-script-0.1.6 spec/gom/remote/subscription_spec.rb
gom-script-0.1.5 spec/gom/remote/subscription_spec.rb
gom-script-0.1.4 spec/gom/remote/subscription_spec.rb
gom-script-0.1.3 spec/gom/remote/subscription_spec.rb
gom-script-0.1.2 spec/gom/remote/subscription_spec.rb