0a8d3caf71efbbf8d51115800128e78a996a2ea8
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / spec / functions / extname_spec.rb
1 require 'spec_helper'
2
3 describe 'stdlib::extname' do
4   it { is_expected.not_to eq(nil) }
5   it { is_expected.to run.with_params.and_raise_error(ArgumentError, %r{'stdlib::extname' expects 1 argument, got none}) }
6   it { is_expected.to run.with_params('one', 'two').and_raise_error(ArgumentError, %r{'stdlib::extname' expects 1 argument, got 2}) }
7   it { is_expected.to run.with_params([]).and_raise_error(ArgumentError, %r{'stdlib::extname' parameter 'filename' expects a String value, got Array}) }
8   it { is_expected.to run.with_params('test.rb').and_return('.rb') }
9   it { is_expected.to run.with_params('a/b/d/test.rb').and_return('.rb') }
10   it { is_expected.to run.with_params('test').and_return('') }
11   it { is_expected.to run.with_params('.profile').and_return('') }
12
13   context 'with UTF8 and double byte characters' do
14     it { is_expected.to run.with_params('file_√ạĺűē/竹.rb').and_return('.rb') }
15   end
16 end