Class: Shoulda::Context
- Inherits:
-
Object
- Object
- Shoulda::Context
- Defined in:
- lib/test4requirements/shoulda.rb
Instance Method Summary collapse
-
#should(name_or_matcher, options = {}, &blk) ⇒ Object
Extend #should inside a context to support assignment to requirement.
-
#should_old ⇒ Object
remember original definition.
Instance Method Details
#should(name_or_matcher, options = {}, &blk) ⇒ Object
Extend #should inside a context to support assignment to requirement.
Usage:
should 'fullfill request 1', requirement: :req1 do
assert_equal(2,1+1)
end
74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/test4requirements/shoulda.rb', line 74 def should(name_or_matcher, = {}, &blk) if [:requirement] #testmethodname must fit self.name of the later test (TestCase#run_test) testmethodname = 'test: ' testmethodname << self.name testmethodname << ' should ' testmethodname << name_or_matcher testmethodname << '. ' testmethodname << "(#{self.parent.name})" raise RuntimeError, "No requirements defined for #{self}" unless get_requirements get_requirements.assign_test([:requirement], testmethodname, Test4requirements::TestResults.new ) end should_old(name_or_matcher, = {}, &blk) end |
#should_old ⇒ Object
remember original definition.
65 |
# File 'lib/test4requirements/shoulda.rb', line 65 alias :should_old :should |