Sha256: 948285fb06a864994541189c1a3e94c7fde6e7d0f9b63d908d5b84d07ad5dac0

Contents?: true

Size: 1.69 KB

Versions: 7

Compression:

Stored size: 1.69 KB

Contents

require 'spec_helper'

# For testing the DSL methods
module Another
  class TagService < Protobuf::Rpc::Service
  end
end

describe ActiveRemote::DSL do
  before { reset_dsl_variables(Tag) }
  after { Tag.service_class Generic::Remote::TagService }

  describe ".attr_publishable" do
    after { reset_publishable_attributes(Tag) }

    it "appends given attributes to @publishable_attributes" do
      Tag.attr_publishable :guid
      Tag.attr_publishable :name

      Tag.publishable_attributes.should =~ [ :guid, :name ]
    end
  end

  describe ".auto_paging_size" do
    context "when given a value" do
      it "sets @auto_paging_size to the value" do
        Tag.auto_paging_size 100
        Tag.auto_paging_size.should eq 100
      end
    end
  end

  describe ".namespace" do
    context "when given a value" do
      it "sets @namespace to the value" do
        Tag.namespace :foo
        Tag.namespace.should eq :foo
      end
    end
  end

  describe ".service_class" do
    context "when nil" do
      it "determines the service class" do
        Tag.namespace :another

        Tag.service_class.should eq Another::TagService
      end
    end

    context "when given a value" do
      it "sets @service_class to the value" do
        Tag.service_class Generic::Remote::TagService
        Tag.service_class.should eq Generic::Remote::TagService
      end
    end
  end

  describe ".service_name" do
    context "when nil" do
      it "determines the service name" do
        Tag.service_name.should eq :tag_service
      end
    end

    context "when given a value" do
      it "sets @service_name to the value" do
        Tag.service_name :foo
        Tag.service_name.should eq :foo
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
active_remote-1.4.1 spec/lib/active_remote/dsl_spec.rb
active_remote-1.4.0 spec/lib/active_remote/dsl_spec.rb
active_remote-1.3.3 spec/lib/active_remote/dsl_spec.rb
active_remote-1.3.2 spec/lib/active_remote/dsl_spec.rb
active_remote-1.3.1 spec/lib/active_remote/dsl_spec.rb
active_remote-1.3.0 spec/lib/active_remote/dsl_spec.rb
active_remote-1.2.1 spec/lib/active_remote/dsl_spec.rb