2022-03-31 16:03:11 +02:00
|
|
|
require 'rails_helper'
|
2022-04-09 12:59:36 +02:00
|
|
|
require "dns_update_job"
|
2022-03-31 16:03:11 +02:00
|
|
|
|
2022-04-09 12:59:36 +02:00
|
|
|
RSpec.describe DnsUpdateJob, type: :task do
|
2022-03-31 19:48:14 +02:00
|
|
|
|
2022-04-02 20:49:32 +02:00
|
|
|
it "update ip" do
|
|
|
|
updater = DnsUpdateJob.new
|
2022-04-09 12:59:36 +02:00
|
|
|
updater.update_ip("dnsimple_test","hubfeenix.fi")
|
|
|
|
zone = updater.find_record("dnsimple_test","hubfeenix.fi")
|
|
|
|
expect(zone.content).to eq updater.my_ip
|
2022-04-02 20:49:32 +02:00
|
|
|
end
|
|
|
|
|
2022-03-31 19:48:14 +02:00
|
|
|
it "should get ip" do
|
|
|
|
res = DnsUpdateJob.new.my_ip
|
2022-11-18 20:42:28 +01:00
|
|
|
expect(res).to start_with "84"
|
2022-03-31 19:48:14 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should init client" do
|
|
|
|
client = DnsUpdateJob.new.client
|
|
|
|
expect(client.class).to be Dnsimple::Client
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should find domain" do
|
2022-04-09 12:59:36 +02:00
|
|
|
updater = DnsUpdateJob.new
|
|
|
|
zone = updater.find_record("dnsimple_test","hubfeenix.fi")
|
2022-03-31 19:48:14 +02:00
|
|
|
expect(zone.class).to eq Dnsimple::Struct::ZoneRecord
|
2022-04-09 12:59:36 +02:00
|
|
|
expect(zone.name).to eq "dnsimple_test"
|
|
|
|
expect(zone.content).to eq updater.my_ip
|
2022-03-31 19:48:14 +02:00
|
|
|
end
|
2022-03-31 16:03:11 +02:00
|
|
|
end
|