Skip to content

Commit 05d46e2

Browse files
committed
Diffy test
1 parent 3e2add6 commit 05d46e2

3 files changed

Lines changed: 29 additions & 1 deletion

File tree

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ source 'https://rubygems.org'
55
ruby '>= 3.2', '< 3.5'
66

77
group :test, :development do
8+
gem 'diffy', '~> 3.4'
89
gem 'heroku_hatchet'
910
gem 'java-properties'
1011
# Work around https://github.com/excon/excon/issues/860

Gemfile.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ GEM
44
ast (2.4.3)
55
base64 (0.3.0)
66
diff-lcs (1.6.2)
7+
diffy (3.4.4)
78
erubis (2.7.0)
89
excon (1.2.7)
910
logger
@@ -82,6 +83,7 @@ PLATFORMS
8283
ruby
8384

8485
DEPENDENCIES
86+
diffy (~> 3.4)
8587
heroku_hatchet
8688
java-properties
8789
logger

test/spec/versions_spec.rb

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# frozen_string_literal: true
22

33
require_relative 'spec_helper'
4+
require 'diffy'
45

56
RSpec.describe 'Maven buildpack' do
67
it 'runs Maven wrapper instead of installing Maven when possible' do
@@ -35,13 +36,25 @@
3536
end
3637

3738
app.deploy do
38-
expect(clean_output(app.output)).to include(<<~OUTPUT)
39+
a = <<~OUTPUT
3940
remote: -----> Installing Maven #{UNKNOWN_MAVEN_VERSION}...
4041
remote:
4142
remote: ! ERROR: You have defined an unsupported Maven version in the system.properties file.
4243
remote: !
4344
remote: ! The default supported version is #{DEFAULT_MAVEN_VERSION}
45+
remote:
46+
remote: ! Push rejected, failed to compile Java app.
47+
OUTPUT
48+
49+
expect(Diffy::Diff.new(clean_output(app.output), a).to_s(:html)).to include('nothing')
50+
51+
expect(clean_output(app.output)).to include(<<~OUTPUT)
52+
remote: -----> Installing Maven #{UNKNOWN_MAVEN_VERSION}...
4453
remote:
54+
remote: ! ERROR: You have defined an unsupported Maven version in the system.properties file.
55+
remote: !
56+
remote: ! The default supported version is #{DEFAULT_MAVEN_VERSION}
57+
remote:
4558
remote: ! Push rejected, failed to compile Java app.
4659
OUTPUT
4760
end
@@ -70,6 +83,18 @@
7083
end
7184

7285
app.deploy do
86+
a = <<~OUTPUT
87+
remote: -----> Installing Maven #{UNKNOWN_MAVEN_VERSION}...
88+
remote:
89+
remote: ! ERROR: You have defined an unsupported Maven version in the system.properties file.
90+
remote: !
91+
remote: ! The default supported version is #{DEFAULT_MAVEN_VERSION}
92+
remote:
93+
remote: ! Push rejected, failed to compile Java app.
94+
OUTPUT
95+
96+
expect(Diffy::Diff.new(clean_output(app.output), a).to_s(:html)).to include('nothing')
97+
7398
expect(clean_output(app.output)).to include(<<~OUTPUT)
7499
remote: -----> Installing Maven #{UNKNOWN_MAVEN_VERSION}...
75100
remote: ! ERROR: You have defined an unsupported Maven version in the system.properties file.

0 commit comments

Comments
 (0)