summaryrefslogtreecommitdiff
path: root/code/environments/production/modules/stdlib/spec/functions/count_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'code/environments/production/modules/stdlib/spec/functions/count_spec.rb')
-rw-r--r--code/environments/production/modules/stdlib/spec/functions/count_spec.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/code/environments/production/modules/stdlib/spec/functions/count_spec.rb b/code/environments/production/modules/stdlib/spec/functions/count_spec.rb
new file mode 100644
index 0000000..9f5d544
--- /dev/null
+++ b/code/environments/production/modules/stdlib/spec/functions/count_spec.rb
@@ -0,0 +1,23 @@
+require 'spec_helper'
+
+describe 'count' do
+ it { is_expected.not_to eq(nil) }
+ it { is_expected.to run.with_params.and_raise_error(ArgumentError) }
+ it { is_expected.to run.with_params('one').and_raise_error(ArgumentError) }
+ it { is_expected.to run.with_params('one', 'two').and_return(1) }
+ it {
+ pending('should actually be like this, and not like above')
+ is_expected.to run.with_params('one', 'two').and_raise_error(ArgumentError)
+ }
+ it { is_expected.to run.with_params('one', 'two', 'three').and_raise_error(ArgumentError) }
+ it { is_expected.to run.with_params(%w[one two three]).and_return(3) }
+ it { is_expected.to run.with_params(%w[one two two], 'two').and_return(2) }
+ it { is_expected.to run.with_params(['one', nil, 'two']).and_return(2) }
+ it { is_expected.to run.with_params(['one', '', 'two']).and_return(2) }
+ it { is_expected.to run.with_params(['one', :undef, 'two']).and_return(2) }
+
+ it { is_expected.to run.with_params(['ổņ℮', 'ŧщộ', 'three']).and_return(3) }
+ it { is_expected.to run.with_params(['ổņ℮', 'ŧщộ', 'ŧщộ'], 'ŧщộ').and_return(2) }
+ it { is_expected.to run.with_params(['ổņ℮', nil, 'ŧщộ']).and_return(2) }
+ it { is_expected.to run.with_params(['ổņ℮', :undef, 'ŧщộ']).and_return(2) }
+end