spec/spec_helper.rb in knife-windows-1.9.0 vs spec/spec_helper.rb in knife-windows-1.9.1

- old
+ new

@@ -53,42 +53,51 @@ end is_win2k12 end -def chef_gte_12? - Chef::VERSION.split('.').first.to_i >= 12 +def chef_lt_12_5? + Gem::Version.new(Chef::VERSION) < Gem::Version.new('12.5') end def chef_gte_12_5? - Chef::VERSION.split('.')[0..1].join('.').to_f >= 12.5 + Gem::Version.new(Chef::VERSION) >= Gem::Version.new('12.5') end -def chef_gte_12_6? - Chef::VERSION.split('.')[0..1].join('.').to_f >= 12.6 +def chef_gte_12_7? + Gem::Version.new(Chef::VERSION) >= Gem::Version.new('12.7') end -def chef_lt_12? - Chef::VERSION.split('.').first.to_i < 12 +def chef_gte_13? + Gem::Version.new(Chef::VERSION) >= Gem::Version.new('13') end -def chef_eq_11? - Chef::VERSION.split('.').first.to_i == 11 +def chef_lt_13? + Gem::Version.new(Chef::VERSION) < Gem::Version.new('13') end +def chef_lt_14? + Gem::Version.new(Chef::VERSION) < Gem::Version.new('14') +end + +def chef_gte_14? + Gem::Version.new(Chef::VERSION) >= Gem::Version.new('14') +end + def sample_data(file_name) file = File.expand_path(File.dirname("spec/assets/*"))+"/#{file_name}" File.read(file) end RSpec.configure do |config| config.run_all_when_everything_filtered = true config.filter_run :focus => true config.filter_run_excluding :windows_only => true unless windows? config.filter_run_excluding :windows_2012_only => true unless windows2012? - config.filter_run_excluding :chef_gte_12_only => true unless chef_gte_12? config.filter_run_excluding :chef_gte_12_5_only => true unless chef_gte_12_5? - config.filter_run_excluding :chef_gte_12_6_only => true unless chef_gte_12_6? - config.filter_run_excluding :chef_lt_12_5_only => true if chef_gte_12_5? - config.filter_run_excluding :chef_lt_12_only => true unless chef_lt_12? - config.filter_run_excluding :if_chef_11 => true if chef_eq_11? + config.filter_run_excluding :chef_gte_12_7_only => true unless chef_gte_12_7? + config.filter_run_excluding :chef_gte_13_only => true unless chef_gte_13? + config.filter_run_excluding :chef_lt_12_5_only => true unless chef_lt_12_5? + config.filter_run_excluding :chef_lt_13_only => true unless chef_lt_13? + config.filter_run_excluding :chef_lt_14_only => true unless chef_lt_14? + config.filter_run_excluding :chef_gte_14_only => true unless chef_gte_14? end