Created
November 7, 2015 11:55
-
-
Save dv/523e5358d434df0b3b51 to your computer and use it in GitHub Desktop.
Expanded Rails 5 Test Case for ActiveSupport::Concern::UnreachableIncludedBlock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Fixtures::Concern::CircularClass | |
A = "a" | |
include Fixtures::Concern::CircularConcern | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Fixtures::Concern::CircularConcern | |
extend ActiveSupport::Concern | |
B = Fixtures::Concern::CircularClass::A | |
included do | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'abstract_unit' | |
require 'active_support/concern' | |
class ConcernTest < ActiveSupport::TestCase | |
# ... | |
module ::Fixtures | |
extend ActiveSupport::Autoload | |
module Concern | |
extend ActiveSupport::Autoload | |
end | |
end | |
test "test_raise_when_included_block_unreachable" do | |
module ::Fixtures::Concern | |
eager_autoload do | |
# Autoload CircularConcern before CircularClass | |
autoload :CircularConcern, "fixtures/concern/circular_concern" | |
autoload :CircularClass, "fixtures/concern/circular_class" | |
end | |
end | |
assert_raises(ActiveSupport::Concern::UnreachableIncludedBlock) do | |
::Fixtures::Concern.eager_load! | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment