spec/noip/updater_spec.rb in noip-0.1 vs spec/noip/updater_spec.rb in noip-0.2

- old
+ new

@@ -14,19 +14,10 @@ :address => '1.2.3.4', ) end before { allow(Noip::RemoteIp).to receive(:new).and_return(remote_ip) } - let(:credentials) do - instance_double(Noip::Credentials, - :username => 'username', - :password => 'password', - :host => 'host', - ) - end - before { allow(Noip::Credentials).to receive(:new).and_return(credentials) } - let(:http) { instance_double(Net::HTTP) } before do allow(http).to receive(:request) allow(Net::HTTP).to receive(:new).and_return(http) end @@ -35,10 +26,18 @@ before do allow(request).to receive(:basic_auth) allow(Net::HTTP::Get).to receive(:new).and_return(request) end - subject(:update) { Noip::Updater.new.update } + let(:credentials) do + instance_double(Noip::Credentials, + :username => 'username', + :password => 'password', + :host => 'host', + ) + end + + subject(:update) { Noip::Updater.new(credentials).update } before { update } it 'requests the correct domain' do expect(Net::HTTP).to have_received(:new).with( 'dynupdate.no-ip.com'