Module: ActiveSupport::Testing::ConstantLookup
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Included In:
::ActionCable::Channel::TestCase ,
::ActionCable::Channel::TestCase::Behavior ,
::ActionCable::Connection::TestCase ,
::ActionCable::Connection::TestCase::Behavior ,
::ActionController::TestCase ,
::ActionController::TestCase::Behavior ,
::ActionMailer::TestCase ,
::ActionMailer::TestCase::Behavior ,
::ActionView::TestCase ,
::ActionView::TestCase::Behavior
| |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
::ActiveSupport::Concern
|
|
Defined in: | activesupport/lib/active_support/testing/constant_lookup.rb |
Overview
Resolves a constant from a minitest spec name.
Given the following spec-style test:
describe WidgetsController, :index do
describe "authenticated user" do
describe "returns widgets" do
it "has a controller that exists" do
assert_kind_of WidgetsController, @controller
end
end
end
end
The test will have the following name:
"WidgetsController::index::authenticated user::returns widgets"
The constant WidgetsController can be resolved from the name. The following code will resolve the constant:
controller = determine_constant_from_test_name(name) do |constant|
Class === constant && constant < ::ActionController::Metal
end
Class Method Summary
::ActiveSupport::Concern
- Extended
class_methods | Define class methods from given block. |
included | Evaluate given block in context of base class, so that you can write class macros here. |
prepended | Evaluate given block in context of base class, so that you can write class macros here. |