diff --git a/lib/flickwerk/patch_finder.rb b/lib/flickwerk/patch_finder.rb index ec18090..86fd047 100644 --- a/lib/flickwerk/patch_finder.rb +++ b/lib/flickwerk/patch_finder.rb @@ -2,7 +2,7 @@ module Flickwerk class PatchFinder - DECORATED_CLASS_PATTERN = /(?:::)?(?[\w.:]+?)(?:\.singleton_class)?\.prepend[\s(]/ + DECORATED_CLASS_PATTERN = /(?:::)?(?[A-Z][\w.:]+?)(?:\.singleton_class)?\.prepend[\s(]/ attr_reader :path, :autoloader diff --git a/test/dummy_app/app/patches/models/page_patch.rb b/test/dummy_app/app/patches/models/page_patch.rb index 57270f1..00edc00 100644 --- a/test/dummy_app/app/patches/models/page_patch.rb +++ b/test/dummy_app/app/patches/models/page_patch.rb @@ -1,7 +1,17 @@ module PagePatch + def self.prepended(base) + base.prepend(InstanceMethods) + end + def title "Changed from Host app" end + module InstanceMethods + def name + "Homepage" + end + end + ::DummyCms::Page.prepend(self) end diff --git a/test/test_flickwerk.rb b/test/test_flickwerk.rb index b9b47fa..45e3bdd 100644 --- a/test/test_flickwerk.rb +++ b/test/test_flickwerk.rb @@ -76,4 +76,13 @@ def boot assert User assert "The outer rim", User.address end + + test "prepended base class can be prepended" do + require "dummy_cms" + + boot + + assert DummyCms::Page + assert_equal [], Flickwerk.patches["base"] + end end