summaryrefslogtreecommitdiff
path: root/acceptance/basics/test/integration/chef-current-install/serverspec/chef_client_spec.rb
blob: f545d7212a9261a0435d87eae182994f5eae8b01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

require 'spec_helper'

gem_path = "/opt/chef/embedded/bin/gem"
white_list = %w{chef-config json rake}

describe "gem list" do
  it "should not have non-whitelisted duplicate gems" do
    gems = command("#{gem_path} list").stdout

    duplicate_gems = gems.lines().select { |l| l.include?(',') }.collect { |l| l.split(' ').first }
    puts "Duplicate gems found: #{duplicate_gems}" if duplicate_gems.length > 0

    non_whitelisted_duplicates = duplicate_gems.select { |l| !white_list.include?(l) }
    puts "Non white listed duplicates: #{non_whitelisted_duplicates}" if non_whitelisted_duplicates.length > 0

    (non_whitelisted_duplicates.length).should be == 0
  end
end