Skip to content

Commit 9a8f097

Browse files
Merge pull request #1162 from sanfrancrisko/IAC-1228/main/fix_up_r27_spec_failures
(IAC-1228) Fix multiple spec test issues in Ruby 2.7
2 parents 57b339a + d466e7f commit 9a8f097

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

spec/functions/load_module_metadata_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
describe 'when calling with valid arguments' do
99
before :each do
10+
# In Puppet 7, there are two prior calls to File.read prior to the responses we want to mock
11+
allow(File).to receive(:read).with(anything, anything).and_call_original
1012
allow(File).to receive(:read).with(%r{\/(stdlib|test)\/metadata.json}, :encoding => 'utf-8').and_return('{"name": "puppetlabs-stdlib"}')
1113
allow(File).to receive(:read).with(%r{\/(stdlib|test)\/metadata.json}).and_return('{"name": "puppetlabs-stdlib"}')
1214
# Additional modules used by litmus which are identified while running these dues to being in fixtures

spec/functions/loadjson_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
describe 'when calling with valid arguments' do
88
before :each do
9+
# In Puppet 7, there are two prior calls to File.read prior to the responses we want to mock
10+
allow(File).to receive(:read).with(anything, anything).and_call_original
911
allow(File).to receive(:read).with(%r{\/(stdlib|test)\/metadata.json}, :encoding => 'utf-8').and_return('{"name": "puppetlabs-stdlib"}')
1012
allow(File).to receive(:read).with(%r{\/(stdlib|test)\/metadata.json}).and_return('{"name": "puppetlabs-stdlib"}')
1113
# Additional modules used by litmus which are identified while running these dues to being in fixtures

spec/functions/shell_escape_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
it { is_expected.to run.with_params('foo').and_return('foo') }
1818
it { is_expected.to run.with_params('foo bar').and_return('foo\ bar') }
1919
it {
20-
is_expected.to run.with_params('~`!@#$%^&*()_+-=[]\{}|;\':",./<>?')
21-
.and_return('\~\`\!@\#\$\%\^\&\*\(\)_\+-\=\[\]\\\\\{\}\|\;\\\':\",./\<\>\?')
20+
is_expected.to run.with_params('~`!@#$%^&*()_-=[]\{}|;\':",./<>?')
21+
.and_return('\~\`\!@\#\$\%\^\&\*\(\)_-\=\[\]\\\\\{\}\|\;\\\':\",./\<\>\?')
2222
}
2323
end
2424

spec/functions/shell_join_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
it { is_expected.to run.with_params(['foo', 'bar']).and_return('foo bar') }
1515
it { is_expected.to run.with_params(['foo', 'bar baz']).and_return('foo bar\ baz') }
1616
it {
17-
is_expected.to run.with_params(['~`!@#$', '%^&*()_+-=', '[]\{}|;\':"', ',./<>?'])
18-
.and_return('\~\`\!@\#\$ \%\^\&\*\(\)_\+-\= \[\]\\\\\{\}\|\;\\\':\" ,./\<\>\?')
17+
is_expected.to run.with_params(['~`!@#$', '%^&*()_-=', '[]\{}|;\':"', ',./<>?'])
18+
.and_return('\~\`\!@\#\$ \%\^\&\*\(\)_-\= \[\]\\\\\{\}\|\;\\\':\" ,./\<\>\?')
1919
}
2020

2121
context 'with UTF8 and double byte characters' do

0 commit comments

Comments
 (0)