<commit_before>require "#{File.dirname(File.dirname(File.dirname(__FILE__)))}/libraries/helpers"

describe 'PushJobsHelper' do
  it 'package_file method should return a valid package filename' do
    package_url = 'http://foo.bar.com/opscode-push-jobs-client_amd64.deb?key=value'
    expect(PushJobsHelper.package_file(package_url)).to match 'opscode-push-jobs-client_amd64.deb'
  end

  it 'config_dir method should return a valid pathname' do
    expect(PushJobsHelper.config_dir).to match '/etc/chef'
  end

  it 'config_path method should return a valid filename' do
    expect(PushJobsHelper.config_path).to match '/etc/chef/push-jobs-client.rb'
  end

  it 'parse_version method should return empty string' do
    url = 'http://foo-1-2.bar.com/jobs-client-renamed.msi'
    expect(PushJobsHelper.parse_version(url)).to match ''
  end

  it 'parse_version method should return correct version for stable version' do
    url = 'http://foo-3.bar.com/opscode-push-jobs-client-windows-1.1.5-1.windows.msi?key=value'
    expect(PushJobsHelper.parse_version(url)).to match '1.1.5'
  end

  it 'parse_version method should return correct version for non-GA version' do
    url = 'https://foo-4.bar.com/push-jobs-client-2.0.0-alpha.1-1.msi'
    expect(PushJobsHelper.parse_version(url)).to match '2.0.0'
  end
end<commit_msg>Fixup specs for changed api<commit_after>require "#{File.dirname(File.dirname(File.dirname(__FILE__)))}/libraries/helpers"

describe 'PushJobsHelper' do
  it 'package_file method should return a valid package filename' do
    package_url = 'http://foo.bar.com/opscode-push-jobs-client_amd64.deb?key=value'
    expect(PushJobsHelper.package_file(package_url)).to match 'opscode-push-jobs-client_amd64.deb'
  end

  it 'config_dir method should return a valid pathname' do
    expect(PushJobsHelper.config_dir).to match '/etc/chef'
  end

  it 'config_path method should return a valid filename' do
    expect(PushJobsHelper.config_path).to match '/etc/chef/push-jobs-client.rb'
  end

  it 'parse_version method should return empty string' do
    node = {'push_jobs' => { }}
    url = 'http://foo-1-2.bar.com/jobs-client-renamed.msi'
    expect(PushJobsHelper.parse_version(node, url)).to match ''
  end

  it 'parse_version method should return correct version for stable version' do
    node = {'push_jobs' => { }}
    url = 'http://foo-3.bar.com/opscode-push-jobs-client-windows-1.1.5-1.windows.msi?key=value'
    expect(PushJobsHelper.parse_version(node, url)).to match '1.1.5'
  end

  it 'parse_version method should return correct version for non-GA version' do
    node = {'push_jobs' => { }}
    url = 'https://foo-4.bar.com/push-jobs-client-2.0.0-alpha.1-1.msi'
    expect(PushJobsHelper.parse_version(node, url)).to match '2.0.0'
  end

  it 'parse_version method should let node["push_jobs"]["version"]' do
    node = {'push_jobs' => { 'version' => '1.2.3' }}
    url = 'https://foo-4.bar.com/push-jobs-client-2.0.0-alpha.1-1.msi'
    expect(PushJobsHelper.parse_version(node, url)).to match '1.2.3'
  end
end
{'fraction_non_alphanumeric': 0.13646826701742848, 'fraction_numerical': 0.01907267346267675, 'mean_word_length': 4.01980198019802, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2101232', 'n_tokens_mistral': 1100, 'n_tokens_neox': 1063, 'n_words': 220}