gateway/spec/jobs/dns_update_job_spec.rb

31 lines
763 B
Ruby
Raw Normal View History

2022-03-31 16:03:11 +02:00
require 'rails_helper'
RSpec.describe DnsUpdateJob, type: :job do
2022-03-31 19:48:14 +02:00
ActiveJob::Base.queue_adapter = :test
let(:my_ip){"85.76.133.88"}
2022-04-02 20:49:32 +02:00
it "update ip" do
updater = DnsUpdateJob.new
updater.update_ip
zone = updater.find_record("gateway","hubfeenix.fi")
expect(zone.content).to eq my_ip
end
2022-03-31 19:48:14 +02:00
it "should get ip" do
res = DnsUpdateJob.new.my_ip
expect(res).to eq my_ip
end
it "should init client" do
client = DnsUpdateJob.new.client
expect(client.class).to be Dnsimple::Client
end
it "should find domain" do
zone = DnsUpdateJob.new.find_record("gateway","hubfeenix.fi")
expect(zone.class).to eq Dnsimple::Struct::ZoneRecord
expect(zone.name).to eq "gateway"
expect(zone.content).to eq my_ip
end
2022-03-31 16:03:11 +02:00
end