Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added snippets for Test::Unit 2.2.0 assertions

I dumped the bulk of these snippets by cooking up the following in IRB.
I then adjusted the corner cases and existing snippet conflicts by hand.

gem 'test-unit', '>= 2.2.0'
require 'test/unit'
(assertions = Test::Unit::Assertions).instance_methods.map do |name|
  abbr = name.to_s.split('_').map {|w| w[0, w == 'assert' ? 2 : 1] }.join
  File.open(abbr + '.snippet', 'w') do |snippet|
    snippet.puts [name,
      assertions.instance_method(name).parameters.
      select {|type, param| type == :req }.each_with_index.
      map {|(type,param),idx| "${#{idx.next}:#{param}}" }.join(', ')
    ].join(' ')
  end
end
  • Loading branch information...
commit a9f4887259ec04628db39be2419c00805de20ad5 1 parent d5a1b1d
@sunaku authored
View
1  ruby/asam.snippet
@@ -0,0 +1 @@
+assert_alias_method ${1:object}, ${2:alias_name}, ${3:original_name}
View
1  ruby/asb.snippet
@@ -0,0 +1 @@
+assert_boolean ${1:actual}
View
1  ruby/asc.snippet
@@ -0,0 +1 @@
+assert_compare ${1:expected}, ${2:operator}, ${3:actual}
View
1  ruby/ascd.snippet
@@ -0,0 +1 @@
+assert_const_defined ${1:object}, ${2:constant_name}
View
1  ruby/asem.snippet
@@ -0,0 +1 @@
+assert_empty ${1:object}
View
1  ruby/asf.snippet
@@ -0,0 +1 @@
+assert_false ${1:actual}
View
1  ruby/asfa.snippet
@@ -0,0 +1 @@
+assert_fail_assertion { ${1:block} }
View
1  ruby/asi.snippet
@@ -0,0 +1 @@
+assert_include ${1:collection}, ${2:object}
View
1  ruby/asie.snippet
@@ -0,0 +1 @@
+assert_in_epsilon ${1:expected_float}, ${2:actual_float}
View
1  ruby/asncd.snippet
@@ -0,0 +1 @@
+assert_not_const_defined ${1:object}, ${2:constant_name}
View
1  ruby/asnem.snippet
@@ -0,0 +1 @@
+assert_not_empty ${1:object}
View
1  ruby/asni.snippet
@@ -0,0 +1 @@
+assert_not_include ${1:collection}, ${2:object}
View
1  ruby/asnid.snippet
@@ -0,0 +1 @@
+assert_not_in_delta ${1:expected_float}, ${2:actual_float}
View
1  ruby/asnie.snippet
@@ -0,0 +1 @@
+assert_not_in_epsilon ${1:expected_float}, ${2:actual_float}
View
1  ruby/asnp.snippet
@@ -0,0 +1 @@
+assert_not_predicate ${1:object}, ${2:predicate}
View
1  ruby/asnr.snippet
@@ -0,0 +1 @@
+assert_nothing_raised { ${1:block} }
View
1  ruby/asnrt.snippet
@@ -0,0 +1 @@
+assert_not_respond_to ${1:object}, ${2:method}
View
1  ruby/asnse.snippet
@@ -0,0 +1 @@
+assert_not_send ${1:send_array}
View
1  ruby/asp.snippet
@@ -0,0 +1 @@
+assert_predicate ${1:object}, ${2:predicate}
View
1  ruby/aspe.snippet
@@ -0,0 +1 @@
+assert_path_exist ${1:path}
View
1  ruby/aspne.snippet
@@ -0,0 +1 @@
+assert_path_not_exist ${1:path}
View
1  ruby/asrko.snippet
@@ -0,0 +1 @@
+assert_raise_kind_of(${1:kinds...}) { ${2:block} }
View
1  ruby/asrm.snippet
@@ -0,0 +1 @@
+assert_raise_message ${1:expected_message}
View
1  ruby/asse.snippet
@@ -0,0 +1 @@
+assert_send ${1:send_array}
View
1  ruby/astr.snippet
@@ -0,0 +1 @@
+assert_true ${1:actual}
Please sign in to comment.
Something went wrong with that request. Please try again.