Sha256: 69ec131574f66aacc8686013f7b4a5097bf747fc1f8d49c8a5149d46a49242f8

Contents?: true

Size: 1.35 KB

Versions: 2

Compression:

Stored size: 1.35 KB

Contents

# Polisher Errata Spec
#
# Licensed under the MIT license
# Copyright (C) 2013-2014 Red Hat, Inc.

require 'polisher/errata'

module Polisher
  describe Errata do
    describe "#versions_for" do
      before(:each) do
        @result = double(Curl::Easy.new)
        @result.should_receive(:body_str).and_return({'tag' => [['rubygem-rails-1.0.0-1']]}.to_json)
      end

      it "uses curl to retreive updates" do
        client = Curl::Easy.new
        described_class.should_receive(:client).with('http://errata.url/builds').and_return(client)
        client.should_receive(:get).and_return(@result)

        described_class.versions_for('http://errata.url', 'rails')
      end

      it "returns versions" do
        client = Curl::Easy.new
        described_class.should_receive(:client).and_return(client)
        client.should_receive(:get).and_return(@result)

        described_class.versions_for('http://errata.url', 'rails').should == ['1.0.0']
      end

      it "invokes block with versions" do
        client = Curl::Easy.new
        described_class.should_receive(:client).and_return(client)
        client.should_receive(:get).and_return(@result)

        cb = proc {}
        cb.should_receive(:call).with(:errata, 'rails', ['1.0.0'])
        described_class.versions_for('http://errata.url', 'rails', &cb)
      end
    end
  end # describe Koji
end # module Polisher

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
polisher-0.8.1 spec/errata_spec.rb
polisher-0.7.1 spec/errata_spec.rb