Mercurial > repos > other > Puppet
annotate modules/stdlib/spec/functions/is_float_spec.rb @ 320:99e3ca448d55
Fix Remi PHP on CentOS 8
It uses the new "modules" approach, so we need to use a new
package provider
They also use different signing keys
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 01 Mar 2020 10:58:00 +0000 |
parents | d9352a684e62 |
children |
rev | line source |
---|---|
37 | 1 require 'spec_helper' |
2 | |
272 | 3 describe 'is_float' do |
4 it { is_expected.not_to eq(nil) } | |
5 | |
6 it { is_expected.to run.with_params.and_raise_error(Puppet::ParseError, %r{wrong number of arguments}i) } | |
7 it { is_expected.to run.with_params(0.1, 0.2).and_raise_error(Puppet::ParseError, %r{wrong number of arguments}i) } | |
275
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
272
diff
changeset
|
8 it { is_expected.to run.with_params('0.1').and_return(true) } |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
272
diff
changeset
|
9 it { is_expected.to run.with_params('1.0').and_return(true) } |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
272
diff
changeset
|
10 it { is_expected.to run.with_params('1').and_return(false) } |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
272
diff
changeset
|
11 it { is_expected.to run.with_params('one').and_return(false) } |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
272
diff
changeset
|
12 it { is_expected.to run.with_params('one 1.0').and_return(false) } |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
272
diff
changeset
|
13 it { is_expected.to run.with_params('1.0 one').and_return(false) } |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
272
diff
changeset
|
14 it { is_expected.to run.with_params(0.1).and_return(true) } |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
272
diff
changeset
|
15 it { is_expected.to run.with_params(1.0).and_return(true) } |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
272
diff
changeset
|
16 it { is_expected.to run.with_params(1).and_return(false) } |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
272
diff
changeset
|
17 it { is_expected.to run.with_params({}).and_return(false) } |
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
272
diff
changeset
|
18 it { is_expected.to run.with_params([]).and_return(false) } |
37 | 19 |
272 | 20 context 'with deprecation warning' do |
21 after(:each) do | |
22 ENV.delete('STDLIB_LOG_DEPRECATIONS') | |
23 end | |
24 # Checking for deprecation warning, which should only be provoked when the env variable for it is set. | |
25 it 'displays a single deprecation' do | |
26 ENV['STDLIB_LOG_DEPRECATIONS'] = 'true' | |
275
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
272
diff
changeset
|
27 expect(scope).to receive(:warning).with(include('This method is deprecated')) |
272 | 28 is_expected.to run.with_params(2.2).and_return(true) |
29 end | |
30 it 'displays no warning for deprecation' do | |
31 ENV['STDLIB_LOG_DEPRECATIONS'] = 'false' | |
275
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
272
diff
changeset
|
32 expect(scope).to receive(:warning).with(include('This method is deprecated')).never |
272 | 33 is_expected.to run.with_params(1.0).and_return(true) |
34 end | |
37 | 35 end |
36 end |