|
@@ -128,5 +128,24 @@ shared_examples_for AgentControllerConcern do
|
|
|
expect(agent.control_targets.reload).to all(satisfy { |a| a.options['url'] == 'http://some-new-url.com/SOMETHING' })
|
|
|
expect(agents(:bob_website_agent).reload.options).to eq(old_options.merge('url' => 'http://some-new-url.com/SOMETHING'))
|
|
|
end
|
|
|
+
|
|
|
+ it "should configure targets with nested objects" do
|
|
|
+ agent.control_targets << agents(:bob_data_output_agent)
|
|
|
+ agent.options['action'] = 'configure'
|
|
|
+ agent.options['configure_options'] = {
|
|
|
+ template: {
|
|
|
+ item: {
|
|
|
+ title: "changed"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ agent.save!
|
|
|
+ old_options = agents(:bob_data_output_agent).options
|
|
|
+
|
|
|
+ agent.check
|
|
|
+
|
|
|
+ expect(agent.control_targets.reload).to all(satisfy { |a| a.options['template'] && a.options['template']['item'] && (a.options['template']['item']['title'] == 'changed') })
|
|
|
+ expect(agents(:bob_data_output_agent).reload.options).to eq(old_options.deep_merge(agent.options['configure_options']))
|
|
|
+ end
|
|
|
end
|
|
|
end
|