Sha256: 9b4453fc2448f3167f019394816d84cff02e48c4029414a74ecca9f96bea1b50

Contents?: true

Size: 1.32 KB

Versions: 14

Compression:

Stored size: 1.32 KB

Contents

require "spec_helper"

describe Whois::Record::Registrar 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, "John Doe", nil, "http://example.com")

      i.id.should == 10
      i.name.should == "John Doe"
      i.organization.should be_nil
      i.url.should == "http://example.com"
    end

    it "initializes a new instance from given hash" do
      i = klass.new(:id => 10, :name => "John Doe", :url => "http://example.com")

      i.id.should == 10
      i.name.should == "John Doe"
      i.organization.should be_nil
      i.url.should == "http://example.com"
    end

    it "initializes a new instance from given block" do
      i = klass.new do |c|
        c.id    = 10
        c.name  = "John Doe"
        c.url   = "http://example.com"
      end

      i.id.should == 10
      i.name.should == "John Doe"
      i.organization.should be_nil
      i.url.should == "http://example.com"
    end
  end

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
whois-2.5.1 spec/whois/record/registrar_spec.rb
whois-2.5.0 spec/whois/record/registrar_spec.rb
whois-2.4.0 spec/whois/record/registrar_spec.rb
whois-2.3.0 spec/whois/record/registrar_spec.rb
whois-2.2.0 spec/whois/record/registrar_spec.rb
whois-2.1.0 spec/whois/record/registrar_spec.rb
whois-2.0.7 spec/whois/record/registrar_spec.rb
whois-2.0.6 spec/whois/record/registrar_spec.rb
whois-2.0.5 spec/whois/record/registrar_spec.rb
whois-2.0.4 spec/whois/record/registrar_spec.rb
whois-2.0.3 spec/whois/record/registrar_spec.rb
whois-2.0.2 spec/whois/record/registrar_spec.rb
whois-2.0.1 spec/whois/record/registrar_spec.rb
whois-2.0.0 spec/whois/record/registrar_spec.rb