File: assertions_test.rb

package info (click to toggle)
ruby-eim-xml 0.0.4-3
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 192 kB
  • ctags: 171
  • sloc: ruby: 1,993; makefile: 7
file content (30 lines) | stat: -rw-r--r-- 679 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Test for eim_xml/assertions.rb
#
# Copyright (C) 2006, KURODA Hiraku <hiraku@hinet.mydns.jp>
# You can redistribute it and/or modify it under GPL2.

$:.unshift "#{File.dirname(File.dirname(File.expand_path(__FILE__)))}/lib"
require "test/unit"
require "eim_xml/assertions"

class EimXMLAssertionsTest < Test::Unit::TestCase
	include EimXML
	include EimXML::Assertions

	def test_assert_has
		e = Element.new(:tag) do |e|
			e <<= Element.new(:sub)
		end

		assert_nothing_raised do
			assert_has(:sub, e)
		end

		a = assert_raises(Test::Unit::AssertionFailedError) do
			assert_has(:no, e)
		end
		assert(!a.backtrace.any?{ |i|
				i=~/eim_xml\/assertions\.rb/
			})
	end
end