Skip to content

Instantly share code, notes, and snippets.

@dv
Created November 7, 2015 11:55
Show Gist options
  • Save dv/523e5358d434df0b3b51 to your computer and use it in GitHub Desktop.
Save dv/523e5358d434df0b3b51 to your computer and use it in GitHub Desktop.
Expanded Rails 5 Test Case for ActiveSupport::Concern::UnreachableIncludedBlock
class Fixtures::Concern::CircularClass
A = "a"
include Fixtures::Concern::CircularConcern
end
module Fixtures::Concern::CircularConcern
extend ActiveSupport::Concern
B = Fixtures::Concern::CircularClass::A
included do
end
end
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