Module: Mosquito::Dusty

Included in:
Camping::Test
Defined in:
lib/mosquito.rb

Instance Method Summary collapse

Instance Method Details

#test(name, &block) ⇒ Object

From Jay Fields.

Allows tests to be specified as a block.

test "should do this and that" do
  ...
end

Raises:

  • (ArgumentError)


55
56
57
58
59
# File 'lib/mosquito.rb', line 55

def 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