Skip to content

Commit 7e61f81

Browse files
authored
Merge pull request #70 from OpenVoxProject/test_fixes
Test fixes
2 parents eb85d4a + abcdd49 commit 7e61f81

File tree

14 files changed

+19
-17
lines changed

14 files changed

+19
-17
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ group(:test) do
5959
gem 'rubocop-i18n', '~> 3.0', require: false, platforms: [:ruby]
6060
gem 'rubocop-performance', '~> 1.0', require: false, platforms: [:ruby]
6161
gem 'rubocop-rake', '~> 0.6', require: false, platforms: [:ruby]
62-
gem 'rubocop-rspec', '~> 2.0', require: false, platforms: [:ruby]
62+
gem 'rubocop-rspec', '~> 3.0', require: false, platforms: [:ruby]
6363
end
6464

6565
group(:development, optional: true) do

Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ end
9999

100100
task :spec do
101101
ENV["LOG_SPEC_ORDER"] = "true"
102-
sh %{rspec #{ENV['TEST'] || ENV['TESTS'] || 'spec'}}
102+
sh %{rspec #{ENV['TEST'] || ENV['TESTS'] || ENV['SPEC'] || 'spec'}}
103103
end
104104

105105
begin

spec/unit/file_serving/configuration_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
end
1717

1818
it "should make :new a private method" do
19-
expect { Puppet::FileServing::Configuration.new }.to raise_error(NoMethodError, /private method 'new' called for class Puppet::FileServing::Configuration/)
19+
# Ruby 3.3 includes "class" in the error, 3.2 does not.
20+
expect { Puppet::FileServing::Configuration.new }.to raise_error(NoMethodError, /private method `new' called for( class)? Puppet::FileServing::Configuration/)
2021
end
2122

2223
it "should return the same configuration each time 'configuration' is called" do

spec/unit/functions/join_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
end
2525

2626
it 'does not flatten arrays nested in hashes' do
27-
expect(compile_to_catalog("notify { join([1,2,{a => [3,4]}]): }")).to have_resource('Notify[12{"a" => [3, 4]}]')
27+
expect(compile_to_catalog("notify { join([1,2,{a => [3,4]}]): }")).to have_resource('Notify[12{"a"=>[3, 4]}]')
2828
end
2929

3030
it 'formats nil/undef as empty string' do

spec/unit/graph/sequential_prioritizer_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@
2727
it "fails to prioritize a key contained in an unknown container" do
2828
expect do
2929
priorities.generate_priority_contained_in("unknown", "child 1")
30-
end.to raise_error(NoMethodError, /undefined method 'down' for nil/)
30+
end.to raise_error(NoMethodError, /undefined method `down' for nil/)
3131
end
3232
end

spec/unit/network/formats_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ def self.from_binary(data)
461461
[] => "",
462462
[1, 2] => "1\n2\n",
463463
["one"] => "one\n",
464-
[{1 => 1}] => "{1 => 1}\n",
464+
[{1 => 1}] => "{1=>1}\n",
465465
[[1, 2], [3, 4]] => "[1, 2]\n[3, 4]\n"
466466
}.each_pair do |input, output|
467467
it "should render #{input.inspect} as one item per line" do
@@ -476,7 +476,7 @@ def self.from_binary(data)
476476
{1 => 2} => "1 2\n",
477477
{"one" => "two"} => "one \"two\"\n", # odd that two is quoted but one isn't
478478
{[1,2] => 3, [2,3] => 5, [3,4] => 7} => "{\n \"[1, 2]\": 3,\n \"[2, 3]\": 5,\n \"[3, 4]\": 7\n}",
479-
{{1 => 2} => {3 => 4}} => "{\n \"{1 => 2}\": {\n \"3\": 4\n }\n}"
479+
{{1 => 2} => {3 => 4}} => "{\n \"{1=>2}\": {\n \"3\": 4\n }\n}"
480480
}.each_pair do |input, output|
481481
it "should render #{input.inspect}" do
482482
expect(console.render(input)).to eq(output)

spec/unit/parser/functions/generate_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ def with_executor
9090
echo $PWD
9191
END
9292
Puppet::FileSystem.chmod(0755, command)
93-
expect(scope.function_generate([command]).chomp).to eq(cwd)
93+
# Using a matcher to avoid /var vs. /private/var shenanigans on MacOS
94+
expect(scope.function_generate([command]).chomp).to match(/#{cwd}/)
9495
end
9596
end
9697
end

spec/unit/parser/functions/sprintf_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757

5858
it 'a hash with string keys that is output formats as strings' do
5959
result = @scope.function_sprintf(["%s", {'foo' => 1, 'bar' => 2}])
60-
expect(result).to eq("{\"foo\" => 1, \"bar\" => 2}")
60+
expect(result).to eq("{\"foo\"=>1, \"bar\"=>2}")
6161
end
6262

6363
it 'named arguments hash with non string keys are tolerated' do

spec/unit/parser/functions/template_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@
3232
it "raises an error when accessing an undefined variable" do
3333
expect {
3434
eval_template("template <%= deprecated %>")
35-
}.to raise_error(Puppet::ParseError, /undefined local variable or method 'deprecated'/)
35+
}.to raise_error(Puppet::ParseError, /undefined local variable or method `deprecated'/)
3636
end
3737

3838
it "looks up the value from the scope" do
3939
scope["deprecated"] = "deprecated value"
40-
expect { eval_template("template <%= deprecated %>")}.to raise_error(/undefined local variable or method 'deprecated'/)
40+
expect { eval_template("template <%= deprecated %>")}.to raise_error(/undefined local variable or method `deprecated'/)
4141
end
4242

4343
it "still has access to Kernel methods" do
@@ -74,7 +74,7 @@
7474
it "does not have direct access to Scope#lookupvar" do
7575
expect {
7676
eval_template("<%= lookupvar('myvar') %>")
77-
}.to raise_error(Puppet::ParseError, /undefined method 'lookupvar'/)
77+
}.to raise_error(Puppet::ParseError, /undefined method `lookupvar'/)
7878
end
7979

8080
it 'is not available when --tasks is on' do

spec/unit/parser/templatewrapper_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474

7575
it "raises error on access to removed in-scope variables via method calls" do
7676
scope["in_scope_variable"] = "is good"
77-
expect { tw.result("<%= in_scope_variable %>") }.to raise_error(/undefined local variable or method 'in_scope_variable'/ )
77+
expect { tw.result("<%= in_scope_variable %>") }.to raise_error(/undefined local variable or method `in_scope_variable'/ )
7878
end
7979

8080
it "reports that variable is available when it is in scope" do

0 commit comments

Comments
 (0)