Method: Test::Unit::TestCase.use
- Defined in:
- lib/tu-context/shared_behavior.rb
.use(shared_name) ⇒ Object
Pull in behavior shared by shared
or a module.
Examples
shared "other things" do
it "should do things but not some things" do
# behavior is fun
end
end
use "other things"
# or...
it_should_behave_like "other things"
module Things
end
uses Things
82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/tu-context/shared_behavior.rb', line 82 def use(shared_name) case shared_name.class.name when "Context::SharedBehavior", "Module" include shared_name when "String" include Object.const_get(shared_name.to_module_name) when "Symbol" include Object.const_get(shared_name.to_s.to_module_name) else raise ArgumentError, "Provide a String or Symbol as the name of the shared behavior group or the module name" end end |