Skip to content

Instantly share code, notes, and snippets.

@NeilHanlon
Last active October 2, 2017 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NeilHanlon/b48a7725f42fb626ff4891a48b1dacf2 to your computer and use it in GitHub Desktop.
Save NeilHanlon/b48a7725f42fb626ff4891a48b1dacf2 to your computer and use it in GitHub Desktop.
def test_create_a
expected_name = 'test.example.com'
expected_address = '10.1.1.1'
expected_type = 'A'
args = {
:name => "#{expected_name}.",
:type => expected_type,
:ttl => @ttl,
:data => expected_address,
:enabled => true,
:dns_zone_ref => @zone.ref
}
record = MmJsonClient::DNSRecord.new(args)
response = stub('a_response', :ref => '567')
@client.stubs(:get_dns_zones).returns(@zones)
@client.stubs(:match_zone).returns(@zone)
@provider.expects(:create_dns_record).with(has_entries(args)).returns(record)
@client.expects(:add_dns_record).with(has_entry(:dns_record, record)).returns(response)
assert_equal response,@provider.do_create(expected_name, expected_address, expected_type)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment