Sha256: 4bff90f0419d9e1b24e7d8e3f7a155fd38d2dbf7fc50af27eb01a70fa34c1e7f

Contents?: true

Size: 1.35 KB

Versions: 4

Compression:

Stored size: 1.35 KB

Contents

require "spec_helper"

describe Whois::Record::Contact do

  it "inherits from SuperStruct" do
    klass.ancestors.should include(SuperStruct)
  end


  describe "#initialize" do
    it "accepts an empty value" do
      lambda do
        i = klass.new
        i.id.should be_nil
      end.should_not raise_error
    end

    it "accepts an empty hash" do
      lambda do
        i = klass.new({})
        i.id.should be_nil
      end.should_not raise_error
    end

    # it "initializes a new instance from given params" do
    #   i = klass.new(10, klass::TYPE_REGISTRANT, "John Doe", nil)

    #   i.id.should == 10
    #   i.type.should == klass::TYPE_REGISTRANT
    #   i.name.should == "John Doe"
    #   i.organization.should be_nil
    # end

    it "initializes a new instance from given hash" do
      i = klass.new(:id => 10, :name => "John Doe", :type => klass::TYPE_REGISTRANT)

      i.id.should == 10
      i.type.should == klass::TYPE_REGISTRANT
      i.name.should == "John Doe"
      i.organization.should be_nil
    end

    it "initializes a new instance from given block" do
      i = klass.new do |c|
        c.id    = 10
        c.type  = klass::TYPE_REGISTRANT
        c.name  = "John Doe"
      end

      i.id.should == 10
      i.type.should == klass::TYPE_REGISTRANT
      i.name.should == "John Doe"
      i.organization.should be_nil
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
whois-2.6.3 spec/whois/record/contact_spec.rb
whois-2.6.2 spec/whois/record/contact_spec.rb
whois-2.6.1 spec/whois/record/contact_spec.rb
whois-2.6.0 spec/whois/record/contact_spec.rb