Hello all,
Probably I need a fresh eye on my problem - I am working on it for too long.
I am working on integration test that should create a host by filling in
all fields. The problem is that I am stuck on IP field for the interface -
the value is not sent to the server.
Test code can be found here: http://www.fpaste.org/303651/14506818/
The code actually does fill all other fields, but for some reason I can see
that the IP field remains empty when sending the info to server. I can see
that by inspecting test.log:
> 2015-12-20T19:01:32 [app] [I] Processing by HostsController#create as /
> 2015-12-20T19:01:32 [app] [I] Parameters: {"utf8"=>"✓",
> "host"=>{"name"=>"myhost1", "hostgroup_id"=>"928644286",
> "compute_resource_id"=>"", "config_group_ids"=>[""],
> "puppetclass_ids"=>[""], "managed"=>"true",
> "progress_report_id"=>"[FILTERED]", type"=>"Host::Managed",
> "interfaces_attributes"=>{"0"=>{"_destroy"=>"0", "type"=>"Nic::Managed",
> "mac"=>"11:11:11:11:11:11", "identifier"=>"", "name"=>"myhost1",
> "domain_id"=>"22495316", "subnet_id"=>"980190962", "managed"=>"1",
> "primary"=>"1", "provision"=>"1", "virtual"=>"0", "tag"=>"",
> "attached_to"=>""}}, "architecture_id"=>"501905021",
> "operatingsystem_id"=>"1073012830", "provision_method"=>"build",
> "build"=>"0", "medium_id"=>"1011586620", "ptable_id"=>"1007981703",
> "disk"=>"", "root_pass"=>"[FILTERED]", "is_owned_by"=>"135138680-Users",
> "enabled"=>"1", "model_id"=>"", "comment"=>"", "overwrite"=>"false"},
> "bare_metal_capabilities"=>"build"}
> 2015-12-20T19:01:32 [app] [D] Setting current user thread-local variable
> to secret_admin
> 2015-12-20T19:01:32 [app] [I] Failed to save: Ip can't be blank
> 2015-12-20T19:01:32 [app] [I] Rendered hosts/_progress.html.erb (0.1ms)
You can see that "interfaces_attributes"[0] does not contain the IP field.
If I stop the test (binding.pry) just before clicking on a submit button, I
can run "page.evaluate_script("$('form').serialize()")" that will return
the values that should be sent to the server, I can see the IP field there.
Any advice will be appreciated.