module TestBelt::Matchers

Public Class Methods

included(receiving_test_class) click to toggle source

Test Belt provides matchers to test common scenarios. Use these matchers in combination with the 'should' method to run common test cases.

# File lib/test_belt/matchers.rb, line 14
def self.included(receiving_test_class)
  if receiving_test_class.ancestors.include?(::Test::Unit::TestCase)
    receiving_test_class.send(:include, HaveInstanceMethods)
    receiving_test_class.send(:include, HaveClassMethods)
    receiving_test_class.send(:include, HaveReaders)
    receiving_test_class.send(:include, HaveWriters)
    receiving_test_class.send(:include, HaveAccessors)
    receiving_test_class.send(:include, HaveFiles)
  end
end

Public Instance Methods

assert_matcher(matcher) click to toggle source
# File lib/test_belt/matchers.rb, line 25
def assert_matcher(matcher)
  instance_exec(*matcher.args, &matcher.test)
end