spec/bond_targetable_spec.rb in bond-spy-0.1.0 vs spec/bond_targetable_spec.rb in bond-spy-0.2.0
- old
+ new
@@ -43,10 +43,13 @@
def annotated_method_mocking_required(arg1) 'return' end
bond.spy_point(spy_point_name: 'spy_return', spy_result: true)
def annotated_method_spy_return(arg1) 'return' end
+ bond.spy_point(spy_point_name: 'mock_only', mock_only: true)
+ def annotated_method_mock_only; 'return' end
+
bond.spy_point
def annotated_method_with_block(arg1, &blk) yield; end
def method_calling_protected; annotated_protected_method('value') end
@@ -139,9 +142,19 @@
end
it 'correctly spies the return value when mocking' do
bond.deploy_agent('spy_return', result: 'new return')
tc.annotated_method_spy_return('arg_value')
+ end
+
+ it 'correctly respects mock_only' do
+ bond.spy('unmocked_return', val: tc.annotated_method_mock_only)
+
+ bond.deploy_agent('mock_only', result: 'mocked return')
+ bond.spy('mocked_return', val: tc.annotated_method_mock_only)
+
+ bond.deploy_agent('mock_only', skip_save_observation: false, result: 'mocked return')
+ bond.spy('mocked_return', val: tc.annotated_method_mock_only)
end
end
it 'correctly spies protected methods' do
tc.method_calling_protected