7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/minitest_spec_converter/assertion_rewriter.rb', line 7
def on_send(node)
case node.children[1]
when :assert_equal
new_node = convert_to_spec_method(node, :must_equal)
when :assert_not_equal
new_node = convert_to_spec_method(node, :wont_equal)
when :assert_nil
new_node = convert_to_spec_method(node, :must_be_nil)
when :refute_nil
new_node = convert_to_spec_method(node, :wont_be_nil)
when :assert_empty
new_node = convert_to_spec_method(node, :must_be_empty)
when :refute_empty
new_node = convert_to_spec_method(node, :wont_be_empty)
when :assert_includes
new_node = convert_to_spec_method(node, :must_include, reverse: true)
when :refute_includes
new_node = convert_to_spec_method(node, :wont_include, reverse: true)
when :assert_match
new_node = convert_to_spec_method(node, :must_match)
when :refute_match
new_node = convert_to_spec_method(node, :wont_match)
when :assert_instance_of
new_node = convert_to_spec_method(node, :must_be_instance_of)
when :assert_kind_of
new_node = convert_to_spec_method(node, :must_be_kind_of)
when :refute_instance_of
new_node = convert_to_spec_method(node, :wont_be_instance_of)
when :refute_kind_of
new_node = convert_to_spec_method(node, :wont_be_kind_of)
when :assert
new_node = convert_to_spec_method(node, :must_equal, value: "true", reverse: true)
when :refute
new_node = convert_to_spec_method(node, :must_equal, value: "false", reverse: true)
when :assert_predicate
new_node = convert_to_spec_predicate_method(node, :must_be)
when :refute_predicate
new_node = convert_to_spec_predicate_method(node, :wont_be)
when :assert_operator
new_node = convert_to_spec_operator_method(node, :must_be)
when :refute_operator
new_node = convert_to_spec_operator_method(node, :wont_be)
else
return super
end
replace(node.location.expression, Unparser.unparse(new_node))
end
|