<commit_before>require "spec_helper"

describe Chromedriver::Helper::GoogleCodeParser do
  let!(:open_uri_provider) do
    double("open_uri_provider").tap do |oup|
      allow(oup).to receive(:open_uri) { File.read(File.join(File.dirname(__FILE__), "assets/google-code-bucket.xml")) }
    end
  end
  let!(:parser) { Chromedriver::Helper::GoogleCodeParser.new('mac', open_uri_provider) }

  describe "#downloads" do
    it "returns an array of URLs for the platform" do
      expect(parser.downloads).to eq [
        "http://chromedriver.storage.googleapis.com/2.0/chromedriver_mac32.zip",
        "http://chromedriver.storage.googleapis.com/2.1/chromedriver_mac32.zip",
        "http://chromedriver.storage.googleapis.com/2.2/chromedriver_mac32.zip",
        "http://chromedriver.storage.googleapis.com/2.3/chromedriver_mac32.zip",
        "http://chromedriver.storage.googleapis.com/2.4/chromedriver_mac32.zip"]
    end
  end

  describe "#newest_download_version" do
    it "returns the last URL for the platform" do
      expect(parser.newest_download_version).to eq Gem::Version.new("2.4")
    end

    context "out-of-order versions" do
      before do
        allow(parser).to receive(:downloads).and_return([
          "http://chromedriver.storage.googleapis.com/2.3/chromedriver_mac32.zip",
          "http://chromedriver.storage.googleapis.com/2.4/chromedriver_mac32.zip",
          "http://chromedriver.storage.googleapis.com/2.14/chromedriver_mac32.zip",
          "http://chromedriver.storage.googleapis.com/2.2/chromedriver_mac32.zip",
        ])
      end

      it "returns the newest version" do
        expect(parser.newest_download_version).to eq(Gem::Version.new("2.14"))
      end
    end
  end

  describe '#version_download_url' do
    it 'returns the version asked for' do
      expect(parser.version_download_url(2.0)).to eq "http://chromedriver.storage.googleapis.com/2.0/chromedriver_mac32.zip"
    end
  end
end<commit_msg>fix tests to expect https too<commit_after>require "spec_helper"

describe Chromedriver::Helper::GoogleCodeParser do
  let!(:open_uri_provider) do
    double("open_uri_provider").tap do |oup|
      allow(oup).to receive(:open_uri) { File.read(File.join(File.dirname(__FILE__), "assets/google-code-bucket.xml")) }
    end
  end
  let!(:parser) { Chromedriver::Helper::GoogleCodeParser.new('mac', open_uri_provider) }

  describe "#downloads" do
    it "returns an array of URLs for the platform" do
      expect(parser.downloads).to eq [
        "https://chromedriver.storage.googleapis.com/2.0/chromedriver_mac32.zip",
        "https://chromedriver.storage.googleapis.com/2.1/chromedriver_mac32.zip",
        "https://chromedriver.storage.googleapis.com/2.2/chromedriver_mac32.zip",
        "https://chromedriver.storage.googleapis.com/2.3/chromedriver_mac32.zip",
        "https://chromedriver.storage.googleapis.com/2.4/chromedriver_mac32.zip"]
    end
  end

  describe "#newest_download_version" do
    it "returns the last URL for the platform" do
      expect(parser.newest_download_version).to eq Gem::Version.new("2.4")
    end

    context "out-of-order versions" do
      before do
        allow(parser).to receive(:downloads).and_return([
          "https://chromedriver.storage.googleapis.com/2.3/chromedriver_mac32.zip",
          "https://chromedriver.storage.googleapis.com/2.4/chromedriver_mac32.zip",
          "https://chromedriver.storage.googleapis.com/2.14/chromedriver_mac32.zip",
          "https://chromedriver.storage.googleapis.com/2.2/chromedriver_mac32.zip",
        ])
      end

      it "returns the newest version" do
        expect(parser.newest_download_version).to eq(Gem::Version.new("2.14"))
      end
    end
  end

  describe '#version_download_url' do
    it 'returns the version asked for' do
      expect(parser.version_download_url(2.0)).to eq "https://chromedriver.storage.googleapis.com/2.0/chromedriver_mac32.zip"
    end
  end
end
{'fraction_non_alphanumeric': 0.1318737270875764, 'fraction_numerical': 0.024439918533604887, 'mean_word_length': 3.4851598173515983, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '645083', 'n_tokens_mistral': 1376, 'n_tokens_neox': 1271, 'n_words': 198}