Sha256: 8b9a1fbb7e93357f202117cb7ba06373f9b8d15245d36fa0269312ab35f78c14

Contents?: true

Size: 855 Bytes

Versions: 1

Compression:

Stored size: 855 Bytes

Contents

require 'spec_helper'
require 'nvd/json_feeds/gz_feed_uri'

require 'fileutils'

describe NVD::JSONFeeds::GzFeedURI do
  let(:fixtures_dir) { File.expand_path('../fixtures',__FILE__) }

  let(:name) { :recent }
  let(:ext)  { '.json.gz' }
  
  subject { described_class.new(name,ext) }

  describe "#download", :integration do
    let(:download_dir) { File.join(fixtures_dir,'download') }
    let(:dest) { File.join(download_dir,subject.filename) }

    before do
      FileUtils.mkdir_p(download_dir)
      FileUtils.rm_f(dest)
    end

    it "must return a GzFeedFile object for the newly downloaded file" do
      feed_file = subject.download(dest)

      expect(feed_file).to be_kind_of(GzFeedFile)
      expect(feed_file.path).to eq(dest)
      expect(File.file?(dest)).to be(true)
    end

    after do
      FileUtils.rm_f(dest)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nvd-json_feeds-0.1.0 spec/gz_feed_uri_spec.rb