is_a_spec.rb 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. require 'spec_helper'
  2. if ENV['FUTURE_PARSER'] == 'yes'
  3. describe 'type_of' do
  4. pending 'teach rspec-puppet to load future-only functions under 3.7.5' do
  5. it { is_expected.not_to eq(nil) }
  6. end
  7. end
  8. end
  9. if Puppet.version.to_f >= 4.0
  10. describe 'is_a' do
  11. it { is_expected.not_to eq(nil) }
  12. it { is_expected.to run.with_params.and_raise_error(ArgumentError) }
  13. it { is_expected.to run.with_params('', '').and_raise_error(ArgumentError) }
  14. it 'succeeds when comparing a string and a string' do
  15. is_expected.to run.with_params('hello world', String).and_return(true)
  16. end
  17. it 'fails when comparing an integer and a string' do
  18. is_expected.to run.with_params(5, String).and_return(false)
  19. end
  20. it 'suceeds when comparing an UTF8 and double byte characters' do
  21. comparison_array = ['このテキスト', 'ŧћịś ŧêχŧ']
  22. comparison_array.each do |comparison_value|
  23. is_expected.to run.with_params(comparison_value, String).and_return(true)
  24. end
  25. end
  26. end
  27. end