Module: MiniTest::Spec::Magic::Expectations
- Included in:
- Test::Unit::TestCase
- Defined in:
- lib/minitest/spec/magic/expectations.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
-
#should(matcher) ⇒ Object
Tests a matcher for validity.
-
#should_not(matcher) ⇒ Object
Tests a matcher for negative validity.
Class Method Details
.included(base) ⇒ Object
3 4 5 6 |
# File 'lib/minitest/spec/magic/expectations.rb', line 3 def self.included(base) base.extend ClassMethods super end |
Instance Method Details
#should(matcher) ⇒ Object
Tests a matcher for validity. Example:
class UserTest < ActiveSupport::TestCase
it { should validate_presesence_of(:email) }
end
16 17 18 |
# File 'lib/minitest/spec/magic/expectations.rb', line 16 def should(matcher) assert_accepts matcher, subject end |
#should_not(matcher) ⇒ Object
Tests a matcher for negative validity. Example:
class UserTest < ActiveSupport::TestCase
it { should_not validate_presesence_of(:email) }
end
27 28 29 |
# File 'lib/minitest/spec/magic/expectations.rb', line 27 def should_not(matcher) assert_rejects matcher, subject end |