basename_spec.rb 1.1 KB

12345678910111213141516171819
  1. require 'spec_helper'
  2. describe 'basename' do
  3. it { is_expected.not_to eq(nil) }
  4. it { is_expected.to run.with_params.and_raise_error(Puppet::ParseError) }
  5. it { is_expected.to run.with_params('one', 'two', 'three').and_raise_error(Puppet::ParseError) }
  6. it { is_expected.to run.with_params([]).and_raise_error(Puppet::ParseError) }
  7. it { is_expected.to run.with_params('/path/to/a/file.ext', []).and_raise_error(Puppet::ParseError) }
  8. it { is_expected.to run.with_params('/path/to/a/file.ext').and_return('file.ext') }
  9. it { is_expected.to run.with_params('relative_path/to/a/file.ext').and_return('file.ext') }
  10. it { is_expected.to run.with_params('/path/to/a/file.ext', '.ext').and_return('file') }
  11. it { is_expected.to run.with_params('relative_path/to/a/file.ext', '.ext').and_return('file') }
  12. it { is_expected.to run.with_params('scheme:///path/to/a/file.ext').and_return('file.ext') }
  13. context 'with UTF8 and double byte characters' do
  14. it { is_expected.to run.with_params('scheme:///√ạĺűē/竹.ext').and_return('竹.ext') }
  15. it { is_expected.to run.with_params('ҝẽγ:/√ạĺűē/竹.ㄘ', '.ㄘ').and_return('竹') }
  16. end
  17. end