bond-spy 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.yardopts +1 -0
- data/Gemfile +4 -0
- data/LICENSE +27 -0
- data/README.rst +65 -0
- data/Rakefile +6 -0
- data/bin/bond_reconcile.py +385 -0
- data/bin/setup +5 -0
- data/bond.gemspec +36 -0
- data/lib/bond.rb +469 -0
- data/lib/bond/spec_helper.rb +32 -0
- data/lib/bond/targetable.rb +210 -0
- data/lib/bond/version.rb +3 -0
- data/spec/bond_spec.rb +158 -0
- data/spec/bond_targetable_spec.rb +202 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/test_observations/.gitignore +2 -0
- data/spec/test_observations/bond_spec/Bond_with_agents_should_call_doers_before_returning_result.json +14 -0
- data/spec/test_observations/bond_spec/Bond_with_agents_should_call_the_function_passed_as_result_if_it_is_callable.json +23 -0
- data/spec/test_observations/bond_spec/Bond_with_agents_should_correctly_call_a_single_doer_if_filter_criteria_are_met.json +10 -0
- data/spec/test_observations/bond_spec/Bond_with_agents_should_correctly_call_multiple_doers.json +13 -0
- data/spec/test_observations/bond_spec/Bond_with_agents_should_not_call_doers_of_overriden_agents.json +8 -0
- data/spec/test_observations/bond_spec/Bond_with_agents_should_override_old_agents_with_newer_agents.json +0 -0
- data/spec/test_observations/bond_spec/Bond_with_agents_should_throw_an_exception_if_specified_by_agent.json +9 -0
- data/spec/test_observations/bond_spec/Bond_with_agents_should_throw_the_result_of_the_value_passed_to_exception_if_callable.json +10 -0
- data/spec/test_observations/bond_spec/Bond_with_agents_should_work_with_multiple_agents_for_different_spy_points.json +23 -0
- data/spec/test_observations/bond_spec/Bond_with_agents_with_filters_should_override_old_agents_with_newer_agents_unless_theott8glo1xn.json +22 -0
- data/spec/test_observations/bond_spec/Bond_with_agents_with_filters_should_respect_combinations_of_filters.json +37 -0
- data/spec/test_observations/bond_spec/Bond_with_agents_with_filters_should_respect_function_filters.json +16 -0
- data/spec/test_observations/bond_spec/Bond_with_agents_with_filters_should_respect_single_key_value_filters_of_all_types.json +121 -0
- data/spec/test_observations/bond_spec/Bond_without_any_agents_should_correctly_log_nested_hashes_and_arrays_with_hash_sorting.json +31 -0
- data/spec/test_observations/bond_spec/Bond_without_any_agents_should_correctly_log_some_normal_arguments_with_a_spy_point_name.json +12 -0
- data/spec/test_observations/bond_spec/Bond_without_any_agents_should_correctly_log_some_normal_arguments_without_a_spy_point_name.json +10 -0
- data/spec/test_observations/bond_targetable_spec/BondTargetable_correctly_continues_to_the_method_when_agent_result_continue_is_returned.json +10 -0
- data/spec/test_observations/bond_targetable_spec/BondTargetable_correctly_continues_to_the_method_when_agent_result_none_is_returned.json +14 -0
- data/spec/test_observations/bond_targetable_spec/BondTargetable_correctly_passes_through_blocks.json +10 -0
- data/spec/test_observations/bond_targetable_spec/BondTargetable_correctly_returns_nil__and_mocks__when_an_agent_returns_nil.json +11 -0
- data/spec/test_observations/bond_targetable_spec/BondTargetable_correctly_spies_private_methods.json +6 -0
- data/spec/test_observations/bond_targetable_spec/BondTargetable_correctly_spies_protected_methods.json +6 -0
- data/spec/test_observations/bond_targetable_spec/BondTargetable_with_different_argument_types_correctly_spies_on_a_class_method.json +7 -0
- data/spec/test_observations/bond_targetable_spec/BondTargetable_with_different_argument_types_correctly_spies_on_a_method_with_variabl19nhijeqoo.json +13 -0
- data/spec/test_observations/bond_targetable_spec/BondTargetable_with_different_argument_types_correctly_spies_on_a_mix_of_positional_a6qc3d4el92.json +33 -0
- data/spec/test_observations/bond_targetable_spec/BondTargetable_with_different_argument_types_correctly_spies_on_a_mix_of_positional_aott8glo1xn.json +20 -0
- data/spec/test_observations/bond_targetable_spec/BondTargetable_with_different_argument_types_correctly_spies_on_a_mix_of_required_andbcgjq06had.json +17 -0
- data/spec/test_observations/bond_targetable_spec/BondTargetable_with_different_argument_types_correctly_spies_on_a_normal_method.json +7 -0
- data/spec/test_observations/bond_targetable_spec/BondTargetable_with_different_argument_types_correctly_spies_on_all_optional_keyword_arguments.json +10 -0
- data/spec/test_observations/bond_targetable_spec/BondTargetable_with_different_argument_types_correctly_spies_on_variable_keyword_arguments.json +22 -0
- data/spec/test_observations/bond_targetable_spec/BondTargetable_with_different_spy_point_parameters_correctly_changes_the_spy_point_naj4gnwvcu8n.json +5 -0
- data/spec/test_observations/bond_targetable_spec/BondTargetable_with_different_spy_point_parameters_correctly_errors_when_mocking_is_r9j7wklng0z.json +6 -0
- data/spec/test_observations/bond_targetable_spec/BondTargetable_with_different_spy_point_parameters_correctly_ignores_excluded_keys.json +10 -0
- data/spec/test_observations/bond_targetable_spec/BondTargetable_with_different_spy_point_parameters_correctly_mocks_when_one_is_specified.json +10 -0
- data/spec/test_observations/bond_targetable_spec/BondTargetable_with_different_spy_point_parameters_correctly_spies_the_return_value_w19nhijeqoo.json +10 -0
- data/spec/test_observations/bond_targetable_spec/BondTargetable_with_different_spy_point_parameters_correctly_spies_the_return_value_ww8esw1qdxc.json +10 -0
- data/spec/test_observations/bond_targetable_spec/BondTargetable_with_modules_correctly_spies_on_included_module_methods.json +6 -0
- data/spec/test_observations/bond_targetable_spec/BondTargetable_with_modules_correctly_spies_on_module_methods.json +7 -0
- data/tutorials/binary_search_tree/bst.rb +120 -0
- data/tutorials/binary_search_tree/bst_spec.rb +82 -0
- data/tutorials/binary_search_tree/run_tests.sh +4 -0
- data/tutorials/binary_search_tree/test_observations/.gitignore +2 -0
- data/tutorials/binary_search_tree/test_observations/bst_spec/Node_should_add_nodes_to_the_BST_correctly__testing_with_Bond.json +20 -0
- data/tutorials/binary_search_tree/test_observations/bst_spec/Node_should_add_nodes_to_the_BST_correctly__testing_without_Bond.json +3 -0
- data/tutorials/binary_search_tree/test_observations/bst_spec/Node_should_correctly_delete_nodes_from_the_BST.json +29 -0
- data/tutorials/heat_watcher/heat_watcher.rb +107 -0
- data/tutorials/heat_watcher/heat_watcher_spec.rb +116 -0
- data/tutorials/heat_watcher/run_tests.sh +4 -0
- data/tutorials/heat_watcher/test_observations/.gitignore +2 -0
- data/tutorials/heat_watcher/test_observations/heat_watcher_spec/HeatWatcher_should_properly_report_critical_errors.json +142 -0
- data/tutorials/heat_watcher/test_observations/heat_watcher_spec/HeatWatcher_should_properly_report_warnings_and_switch_back_to_OK_status.json +132 -0
- metadata +211 -0
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"__spy_point__": "my_point",
|
4
|
+
"obs_name": "foo"
|
5
|
+
},
|
6
|
+
{
|
7
|
+
"result": 2
|
8
|
+
},
|
9
|
+
{
|
10
|
+
"__spy_point__": "my_point",
|
11
|
+
"obs_name": "bar"
|
12
|
+
},
|
13
|
+
{
|
14
|
+
"result": "agent_result_none"
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"__spy_point__": "my_point",
|
18
|
+
"obs_name": "foo"
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"result": 3
|
22
|
+
}
|
23
|
+
]
|
File without changes
|
@@ -0,0 +1,23 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"__spy_point__": "my_point_1"
|
4
|
+
},
|
5
|
+
{
|
6
|
+
"__spy_point__": "point_1_return",
|
7
|
+
"return_value": "mock result"
|
8
|
+
},
|
9
|
+
{
|
10
|
+
"__spy_point__": "my_point_2"
|
11
|
+
},
|
12
|
+
{
|
13
|
+
"__spy_point__": "point_2_return",
|
14
|
+
"return_value": "mock result 2"
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"__spy_point__": "my_point_1"
|
18
|
+
},
|
19
|
+
{
|
20
|
+
"__spy_point__": "point_1_return_2",
|
21
|
+
"return_value": "mock result"
|
22
|
+
}
|
23
|
+
]
|
@@ -0,0 +1,22 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"__spy_point__": "my_point"
|
4
|
+
},
|
5
|
+
{
|
6
|
+
"result": "second mock"
|
7
|
+
},
|
8
|
+
{
|
9
|
+
"__spy_point__": "my_point",
|
10
|
+
"obs_name": "foobar"
|
11
|
+
},
|
12
|
+
{
|
13
|
+
"result": "third mock"
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"__spy_point__": "my_point",
|
17
|
+
"obs_name": "baz"
|
18
|
+
},
|
19
|
+
{
|
20
|
+
"result": "second mock"
|
21
|
+
}
|
22
|
+
]
|
@@ -0,0 +1,37 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"__spy_point__": "my_point",
|
4
|
+
"req_key": "foo",
|
5
|
+
"req_key2": "bar",
|
6
|
+
"req_key3": "value"
|
7
|
+
},
|
8
|
+
{
|
9
|
+
"result": "agent_result_none"
|
10
|
+
},
|
11
|
+
{
|
12
|
+
"__spy_point__": "my_point",
|
13
|
+
"req_key": "foo",
|
14
|
+
"req_key2": "value",
|
15
|
+
"req_key3": "foovaluebar"
|
16
|
+
},
|
17
|
+
{
|
18
|
+
"result": "mocked"
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"__spy_point__": "my_point",
|
22
|
+
"req_key": "foo",
|
23
|
+
"req_key2": "value",
|
24
|
+
"req_key3": "lacking"
|
25
|
+
},
|
26
|
+
{
|
27
|
+
"result": "agent_result_none"
|
28
|
+
},
|
29
|
+
{
|
30
|
+
"__spy_point__": "my_point",
|
31
|
+
"req_key2": "value",
|
32
|
+
"req_key3": "value"
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"result": "agent_result_none"
|
36
|
+
}
|
37
|
+
]
|
@@ -0,0 +1,121 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"__spy_point__": "my_point",
|
4
|
+
"obs_name": "value"
|
5
|
+
},
|
6
|
+
{
|
7
|
+
"result": "mocked"
|
8
|
+
},
|
9
|
+
{
|
10
|
+
"__spy_point__": "my_point",
|
11
|
+
"obs_name": "not value"
|
12
|
+
},
|
13
|
+
{
|
14
|
+
"result": "agent_result_none"
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"__spy_point__": "my_point_eq",
|
18
|
+
"obs_name": "value"
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"result": "mocked"
|
22
|
+
},
|
23
|
+
{
|
24
|
+
"__spy_point__": "my_point_eq",
|
25
|
+
"obs_name": "not value"
|
26
|
+
},
|
27
|
+
{
|
28
|
+
"result": "agent_result_none"
|
29
|
+
},
|
30
|
+
{
|
31
|
+
"__spy_point__": "my_point_exact",
|
32
|
+
"obs_name": "value"
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"result": "mocked"
|
36
|
+
},
|
37
|
+
{
|
38
|
+
"__spy_point__": "my_point_exact",
|
39
|
+
"obs_name": "not value"
|
40
|
+
},
|
41
|
+
{
|
42
|
+
"result": "agent_result_none"
|
43
|
+
},
|
44
|
+
{
|
45
|
+
"__spy_point__": "my_point_startswith",
|
46
|
+
"obs_name": "value"
|
47
|
+
},
|
48
|
+
{
|
49
|
+
"result": "mocked"
|
50
|
+
},
|
51
|
+
{
|
52
|
+
"__spy_point__": "my_point_startswith",
|
53
|
+
"obs_name": "not value"
|
54
|
+
},
|
55
|
+
{
|
56
|
+
"result": "agent_result_none"
|
57
|
+
},
|
58
|
+
{
|
59
|
+
"__spy_point__": "my_point_startswith",
|
60
|
+
"obs_name": "value not"
|
61
|
+
},
|
62
|
+
{
|
63
|
+
"result": "mocked"
|
64
|
+
},
|
65
|
+
{
|
66
|
+
"__spy_point__": "my_point_endswith",
|
67
|
+
"obs_name": "value"
|
68
|
+
},
|
69
|
+
{
|
70
|
+
"result": "mocked"
|
71
|
+
},
|
72
|
+
{
|
73
|
+
"__spy_point__": "my_point_endswith",
|
74
|
+
"obs_name": "not value"
|
75
|
+
},
|
76
|
+
{
|
77
|
+
"result": "mocked"
|
78
|
+
},
|
79
|
+
{
|
80
|
+
"__spy_point__": "my_point_endswith",
|
81
|
+
"obs_name": "value not"
|
82
|
+
},
|
83
|
+
{
|
84
|
+
"result": "agent_result_none"
|
85
|
+
},
|
86
|
+
{
|
87
|
+
"__spy_point__": "my_point_contains",
|
88
|
+
"obs_name": "value"
|
89
|
+
},
|
90
|
+
{
|
91
|
+
"result": "mocked"
|
92
|
+
},
|
93
|
+
{
|
94
|
+
"__spy_point__": "my_point_contains",
|
95
|
+
"obs_name": "not value"
|
96
|
+
},
|
97
|
+
{
|
98
|
+
"result": "mocked"
|
99
|
+
},
|
100
|
+
{
|
101
|
+
"__spy_point__": "my_point_contains",
|
102
|
+
"obs_name": "value not"
|
103
|
+
},
|
104
|
+
{
|
105
|
+
"result": "mocked"
|
106
|
+
},
|
107
|
+
{
|
108
|
+
"__spy_point__": "my_point_contains",
|
109
|
+
"obs_name": "not value not"
|
110
|
+
},
|
111
|
+
{
|
112
|
+
"result": "mocked"
|
113
|
+
},
|
114
|
+
{
|
115
|
+
"__spy_point__": "my_point_contains",
|
116
|
+
"obs_name": "foobar"
|
117
|
+
},
|
118
|
+
{
|
119
|
+
"result": "agent_result_none"
|
120
|
+
}
|
121
|
+
]
|
@@ -0,0 +1,31 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"key1": {
|
4
|
+
"h1key1": [
|
5
|
+
"hello",
|
6
|
+
"world"
|
7
|
+
],
|
8
|
+
"h1key2": "hi"
|
9
|
+
},
|
10
|
+
"key2": [
|
11
|
+
{
|
12
|
+
"key1": "baz",
|
13
|
+
"key2": "foo",
|
14
|
+
"key3": "bar"
|
15
|
+
},
|
16
|
+
"array3",
|
17
|
+
"array2"
|
18
|
+
]
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"__spy_point__": "point_name",
|
22
|
+
"key1": "value 1",
|
23
|
+
"key3": {
|
24
|
+
"key1": "bar",
|
25
|
+
"key2": "foo",
|
26
|
+
"key3": {
|
27
|
+
"hkey": "hello world"
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}
|
31
|
+
]
|