Prepare inline patch specs
This commit is contained in:
parent
176c85d42c
commit
644ae115f5
@ -163,6 +163,40 @@ describe RuboCop::Cop::FormulaAudit::Patches do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "When auditing inline patches" do
|
||||||
|
it "reports no offenses for valid inline patches" do
|
||||||
|
expect_no_offenses(<<~RUBY)
|
||||||
|
class Foo < Formula
|
||||||
|
url 'https://brew.sh/foo-1.0.tgz'
|
||||||
|
patch :DATA
|
||||||
|
end
|
||||||
|
__END__
|
||||||
|
patch content here
|
||||||
|
RUBY
|
||||||
|
end
|
||||||
|
|
||||||
|
it "reports an offense when DATA is found with no __END__" do
|
||||||
|
expect_offense(<<~RUBY)
|
||||||
|
class Foo < Formula
|
||||||
|
url 'https://brew.sh/foo-1.0.tgz'
|
||||||
|
patch :DATA
|
||||||
|
^^^^^^^^^^^ patch is missing '__END__'
|
||||||
|
end
|
||||||
|
RUBY
|
||||||
|
end
|
||||||
|
|
||||||
|
it "reports an offense when __END__ is found with no DATA" do
|
||||||
|
expect_offense(<<~RUBY)
|
||||||
|
class Foo < Formula
|
||||||
|
url 'https://brew.sh/foo-1.0.tgz'
|
||||||
|
end
|
||||||
|
__END__
|
||||||
|
^^^^^^^ patch is missing 'DATA'
|
||||||
|
patch content here
|
||||||
|
RUBY
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context "When auditing external patches" do
|
context "When auditing external patches" do
|
||||||
it "Patch URLs" do
|
it "Patch URLs" do
|
||||||
patch_urls = [
|
patch_urls = [
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user