Class: TargetPracticeTestCase
- Inherits:
-
MiniTest::Unit::TestCase
- Object
- MiniTest::Unit::TestCase
- TargetPracticeTestCase
- Defined in:
- lib/target_practice/target_practice_test_case.rb
Instance Method Summary collapse
- #assert_attributes(obj, hash = {}) ⇒ Object
- #files ⇒ Object
- #files=(f) ⇒ Object
- #is_meta_command?(v) ⇒ Boolean
- #meta_commands ⇒ Object
- #setup ⇒ Object
Instance Method Details
#assert_attributes(obj, hash = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/target_practice/target_practice_test_case.rb', line 14 def assert_attributes(obj, hash={}) return if hash.nil? hash.each do |k,v| assert obj.send(k.to_sym) if !(k) if k (obj, k, v) elsif v.kind_of? Array index = 0 v.each do |i| assert_attributes(obj.send(k.to_sym)[index], i) index += 1 end elsif v.kind_of? Hash assert_attributes(obj.send(k.to_sym), v) elsif v.kind_of? String assert_equal v, obj.send(k.to_sym) end end end |
#files ⇒ Object
6 7 8 |
# File 'lib/target_practice/target_practice_test_case.rb', line 6 def files @@files end |
#files=(f) ⇒ Object
10 11 12 |
# File 'lib/target_practice/target_practice_test_case.rb', line 10 def files=(f) @@files = f end |
#is_meta_command?(v) ⇒ Boolean
36 37 38 |
# File 'lib/target_practice/target_practice_test_case.rb', line 36 def (v) .include? v end |
#meta_commands ⇒ Object
40 41 42 |
# File 'lib/target_practice/target_practice_test_case.rb', line 40 def [] end |
#setup ⇒ Object
2 3 4 |
# File 'lib/target_practice/target_practice_test_case.rb', line 2 def setup assert @@files, "File data was not set!" end |