Module: MiniTest::Spec::Magic::Expectations::ClassMethods
- Defined in:
- lib/minitest/spec/magic/expectations.rb
Instance Method Summary collapse
-
#should(expectation, &block) ⇒ Object
Accepts either a matcher or a message with a block.
- #should_not(matcher) ⇒ Object
Instance Method Details
#should(expectation, &block) ⇒ Object
Accepts either a matcher or a message with a block. Example:
class UserTest < ActiveSupport::TestCase
should validate_presesence_of(:email)
should "be valid" do
subject.must_be :valid?
end
end
46 47 48 49 50 51 52 53 54 |
# File 'lib/minitest/spec/magic/expectations.rb', line 46 def should(expectation, &block) = if expectation.respond_to?(:description) block = lambda { should expectation } expectation.description else expectation end it "should #{}", &block end |
#should_not(matcher) ⇒ Object
57 58 59 60 |
# File 'lib/minitest/spec/magic/expectations.rb', line 57 def should_not(matcher) block = lambda { should_not matcher } it "should not #{matcher.description}", &block end |