Skip to content

Commit

Permalink
Fix format
Browse files Browse the repository at this point in the history
Signed-off-by: Bern谩t G谩bor <bgabor8@bloomberg.net>
  • Loading branch information
gaborbernat committed Aug 8, 2023
1 parent 5d77fff commit e154807
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 17 deletions.
5 changes: 1 addition & 4 deletions Library/Homebrew/patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ def self.create(strip, src, &block)
DATAPatch.new(strip)
when String
StringPatch.new(strip, src)
when :TAP_FILE
TapFilePatch.new(strip, src)
else
ExternalPatch.new(strip, &block)
end
Expand Down Expand Up @@ -168,14 +166,13 @@ def inspect
end
end


# An abstract class representing a patch living alongside the formula.
#
# @api private
class TapFilePatch < EmbeddedPatch
def initialize(strip, tap_file)
super(strip)
@str = File.open(tap_file).read
@str = File.read(tap_file)
end

def contents
Expand Down
21 changes: 8 additions & 13 deletions Library/Homebrew/test/patch_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,6 @@
its(:strip) { is_expected.to eq(:p1) }
end

context "with a tap file patch" do
subject { described_class.create(:p0, :TAP_FILE "patch.diff") }
it { is_expected.to be_a TapFilePatch }
its(:strip) { is_expected.to eq(:p0) }
end

context "with a tap file patch without strip" do
subject { described_class.create(:p0, :TAP_FILE "patch.diff") }

it { is_expected.to be_a TapFilePatch }
its(:strip) { is_expected.to eq(:p1) }
end

it "raises an error for unknown values" do
expect do
described_class.create(Object.new)
Expand Down Expand Up @@ -96,6 +83,14 @@
end
end

describe TapFilePatch do
subject(:patch) { described_class.new(:p1) { tap_file "file:///my.patch" } }

describe "#str" do
its(:contents) { is_expected.to eq("asd") }
end
end

describe ExternalPatch do
subject(:patch) { described_class.new(:p1) { url "file:///my.patch" } }

Expand Down

0 comments on commit e154807

Please sign in to comment.