Sha256: 2e9c6dd718d145d6b8dc9b9873a3e7aa61621629b24dab219d0d9deb275ab543

Contents?: true

Size: 875 Bytes

Versions: 1

Compression:

Stored size: 875 Bytes

Contents

require 'spec_helper'

describe Noip do
  describe '.update' do
    let(:credentials) { instance_double(Noip::Credentials) }
    before { allow(Noip::Credentials).to receive(:new).and_return(credentials) }

    let(:updater) { instance_double(Noip::Updater) }
    before do
      allow(updater).to receive(:update)
      allow(Noip::Updater).to receive(:new).and_return(updater)
    end

    subject(:update) { Noip.update('username', 'password', 'host') }
    before { update }

    it 'properly constructs the credentials' do
      expect(Noip::Credentials).to have_received(:new).with('username', 'password', 'host')
    end

    it 'provides the updater with the correct credentials' do
      expect(Noip::Updater).to have_received(:new).with(credentials)
    end

    it 'pushes a new update to noip' do
      expect(updater).to have_received(:update)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
noip-0.2 spec/noip_spec.rb