Sha256: 5aadeb193da4c6427335c4bf319215cdd1606137d94179a922328cef88e53c2e

Contents?: true

Size: 825 Bytes

Versions: 1

Compression:

Stored size: 825 Bytes

Contents

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

describe "Zerigo::DNS::Host.update_or_create" do
  
  it 'should create host' do
    Zerigo::DNS::Host.stub!(:find).and_return([])
    Zerigo::DNS::Host.stub!(:create).and_return(:success => true)
    
    Zerigo::DNS::Host.update_or_create(1, 'www', 'A', '10.10.10.10')[:success].should be_true
  end

  it 'should update host' do
    jackhq = mock('Zerigo::DNS::Host')
    jackhq.stub!(:hostname).and_return('www')
    jackhq.stub!(:host_type=)
    jackhq.stub!(:data=)
    jackhq.stub!(:ttl=)
    jackhq.stub!(:save).and_return(true)
    
    Zerigo::DNS::Host.stub!(:find).and_return([jackhq])
    Zerigo::DNS::Host.stub!(:create).and_return(:success => false)
    
    Zerigo::DNS::Host.update_or_create(1, 'www', 'A', '10.10.10.10').hostname == 'www'
  end
  
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zerigo_dns-1.1.1 spec/lib/host_spec.rb