Skip to content

Commit 657f978

Browse files
authored
Fix spec approvals for different ruby output variations (#73)
1 parent 0ed9392 commit 657f978

File tree

7 files changed

+12
-11
lines changed

7 files changed

+12
-11
lines changed

spec/approvals/bin/action-error

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
 ZeroDivisionError  in runfile:2:in '/'
1+
 ZeroDivisionError  in runfile:2:in 'Integer#/'
22
divided by 0
33

44
Prefix with DEBUG=1 for full backtrace

spec/approvals/bin/syntax-error

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
 NameError  in runfile:1:in 'eval_code'
2-
undefined local variable or method `nicely' for #<Runfile::Userfile name=nil, path="runfile">
1+
 NameError  in runfile:1:in 'Runfile::Userfile#eval_code'
2+
undefined local variable or method 'nicely' for an instance of Runfile::Userfile
33

44
Prefix with DEBUG=1 for full backtrace
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
spec action
2-
{:anything=>"Context Values"}
3-
{"spec"=>true, "--continue"=>false, "--failed"=>false, "--help"=>false}
2+
{anything: "Context Values"}
3+
{"spec" => true, "--continue" => false, "--failed" => false, "--help" => false}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
spec action
2-
{:anything=>"Context Values"}
3-
{"spec"=>true, "--continue"=>true, "--failed"=>true, "--help"=>false}
2+
{anything: "Context Values"}
3+
{"spec" => true, "--continue" => true, "--failed" => true, "--help" => false}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Context:
2-
{:image=>"my-rails-app", :allow_deploy=>true, :env=>"development"}
2+
{image: "my-rails-app", allow_deploy: true, env: "development"}
33
Args:
4-
{"server"=>true, "deploy"=>false, "--help"=>false}
4+
{"server" => true, "deploy" => false, "--help" => false}

spec/behaviors/runfile.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
shared_examples 'a runfile' do |workspace, approvals_base|
44
command_file = 'commands.txt'
55
workspace_name = File.basename workspace
6+
leeway = RUBY_VERSION < '3.4.0' ? 20 : 0
67
approvals_base ||= 'integration'
78

89
it 'runs as expected' do
@@ -28,7 +29,7 @@
2829
if mode == :exception
2930
expect { entrypoint.run }.to raise_approval(fixture_name).diff(4)
3031
else
31-
expect { entrypoint.run }.to output_approval fixture_name
32+
expect { entrypoint.run }.to output_approval(fixture_name).diff(leeway)
3233
end
3334
rescue Runfile::ExitWithUsage => e
3435
result = e.message

spec/runfile/bin_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
describe 'bin/run' do
22
let(:bin) { File.expand_path('bin/run', '../../../') }
3-
let(:leeway) { RUBY_VERSION < '3.2.0' ? 0 : 33 }
3+
let(:leeway) { RUBY_VERSION < '3.4.0' ? 52 : 0 }
44

55
context 'when the file contains a syntax error' do
66
it 'errors gracefully' do

0 commit comments

Comments
 (0)