Class: Test::Unit::TestCase
- Inherits:
-
Object
- Object
- Test::Unit::TestCase
- Defined in:
- lib/mosquito.rb
Overview
:nodoc:
Direct Known Subclasses
Class Method Summary collapse
- .fixtures(*table_names) ⇒ Object
-
.test(name, &block) ⇒ Object
From Jay Fields.
Instance Method Summary collapse
Class Method Details
.fixtures(*table_names) ⇒ Object
59 60 61 62 63 64 65 |
# File 'lib/mosquito.rb', line 59 def self.fixtures(*table_names) if block_given? Fixtures.create_fixtures(Test::Unit::TestCase.fixture_path, table_names) { yield } else Fixtures.create_fixtures(Test::Unit::TestCase.fixture_path, table_names) end end |
.test(name, &block) ⇒ Object
From Jay Fields.
Allows tests to be specified as a block.
test "should do this and that" do
...
end
76 77 78 79 80 |
# File 'lib/mosquito.rb', line 76 def self.test(name, &block) test_name = :"test_#{name.gsub(' ','_')}" raise ArgumentError, "#{test_name} is already defined" if self.instance_methods.include? test_name.to_s define_method test_name, &block end |
Instance Method Details
#create_fixtures(*table_names) ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/mosquito.rb', line 51 def create_fixtures(*table_names) if block_given? self.class.fixtures(*table_names) { |*anything| yield(*anything) } else self.class.fixtures(*table_names) end end |