test-declarative-0.0.5/0000700000175000017500000000000011555622724013753 5ustar lucaslucastest-declarative-0.0.5/MIT-LICENSE0000600000175000017500000000211211555622724015405 0ustar lucaslucasMIT LICENSE Copyright (c) 2010 Sven Fuchs Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. test-declarative-0.0.5/metadata.yml0000600000175000017500000000252311555622724016262 0ustar lucaslucas--- !ruby/object:Gem::Specification name: test_declarative version: !ruby/object:Gem::Version hash: 21 prerelease: false segments: - 0 - 0 - 5 version: 0.0.5 platform: ruby authors: - Sven Fuchs autorequire: bindir: bin cert_chain: [] date: 2010-12-26 00:00:00 +01:00 default_executable: dependencies: [] description: Simply adds a declarative test method syntax to test/unit. email: svenfuchs@artweb-design.de executables: [] extensions: [] extra_rdoc_files: [] files: - lib/test_declarative/version.rb - lib/test_declarative.rb - test/test_declarative_test.rb - MIT-LICENSE - README.textile has_rdoc: true homepage: http://github.com/svenfuchs/test_declarative licenses: [] post_install_message: rdoc_options: [] require_paths: - lib required_ruby_version: !ruby/object:Gem::Requirement none: false requirements: - - ">=" - !ruby/object:Gem::Version hash: 3 segments: - 0 version: "0" required_rubygems_version: !ruby/object:Gem::Requirement none: false requirements: - - ">=" - !ruby/object:Gem::Version hash: 23 segments: - 1 - 3 - 6 version: 1.3.6 requirements: [] rubyforge_project: "[none]" rubygems_version: 1.3.7 signing_key: specification_version: 3 summary: Simply adds a declarative test method syntax to test/unit test_files: [] test-declarative-0.0.5/test/0000700000175000017500000000000011555622724014732 5ustar lucaslucastest-declarative-0.0.5/test/test_declarative_test.rb0000600000175000017500000000100011555622724021631 0ustar lucaslucas$: << File.expand_path('../../lib', __FILE__) require 'test/unit' require 'test_declarative' class TestDeclarativeTest < Test::Unit::TestCase def test_responds_to_test assert self.class.respond_to?(:test) end def test_adds_a_test_method called = false assert_nothing_raised { Test::Unit::TestCase.test('some test') { called = true } } Test::Unit::TestCase.new(:'test_some_test').run((RUBY_VERSION < '1.9.1' ? Test::Unit::TestResult : MiniTest::Unit).new) {} assert called end endtest-declarative-0.0.5/lib/0000700000175000017500000000000011555622724014521 5ustar lucaslucastest-declarative-0.0.5/lib/test_declarative.rb0000600000175000017500000000152411555622724020374 0ustar lucaslucastargets = [Module] targets << Test::Unit::TestCase if defined?(Test::Unit::TestCase) targets << MiniTest::Unit::TestCase if defined?(MiniTest::Unit::TestCase) targets.each do |target| target.class_eval do def test(name, &block) test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym defined = instance_method(test_name) rescue false raise "#{test_name} is already defined in #{self}" if defined if block_given? define_method(test_name, &block) else define_method(test_name) do flunk "No implementation provided for #{name}" end end end end target.instance_eval do alias :orig_test_methods :test_methods def test_methods methods = orig_test_methods methods.delete('test') methods end end if target.respond_to?(:test_methods) end test-declarative-0.0.5/lib/test_declarative/0000700000175000017500000000000011555622724020043 5ustar lucaslucastest-declarative-0.0.5/lib/test_declarative/version.rb0000600000175000017500000000005611555622724022060 0ustar lucaslucasmodule TestDeclarative VERSION = '0.0.5' endtest-declarative-0.0.5/README.textile0000600000175000017500000000035411555622724016314 0ustar lucaslucash1. TestDeclarative Simply adds a declarative test method syntax to test/unit.
  require 'test-declarative'

  class MyTest < Test::Unit::TestCase
    test "your test description" do
      # your test code
    end  
  end