)]}'
{"spec/common_spec.rb":[{"author":{"_account_id":7128,"name":"Mark Vanderwiel","email":"vanderwl@us.ibm.com","username":"kramvan"},"change_message_id":"25e8c9333aa1566a44897d653121190ca11c60f2","unresolved":false,"context_lines":[{"line_number":67,"context_line":"      describe \u0027bigswitch\u0027 do"},{"line_number":68,"context_line":"        let(:file) { chef_run.template(\u0027/etc/neutron/plugins/bigswitch/restproxy.ini\u0027) }"},{"line_number":69,"context_line":"        it_behaves_like \u0027core plugin common configurator\u0027, \u0027bigswitch\u0027, %w(servers) do"},{"line_number":70,"context_line":"          let(:cfg_file) { file }"},{"line_number":71,"context_line":"        end"},{"line_number":72,"context_line":"      end"},{"line_number":73,"context_line":""}],"source_content_type":"text/x-ruby","patch_set":1,"id":"baa201ad_fddf49d4","line":70,"updated":"2014-10-13 15:23:06.000000000","message":"humm, I don\u0027t really like having a internal shared example helper variable, cfg_file being set outside its method def.   Maybe consider adding this as the first parameter?","commit_id":"b45300d88ca44d280435af5ab9509fbf459c3285"},{"author":{"_account_id":7128,"name":"Mark Vanderwiel","email":"vanderwl@us.ibm.com","username":"kramvan"},"change_message_id":"5b55c6aca19ca4dff9375ab1b7cd357c44f791f1","unresolved":false,"context_lines":[{"line_number":67,"context_line":"      describe \u0027bigswitch\u0027 do"},{"line_number":68,"context_line":"        let(:file) { chef_run.template(\u0027/etc/neutron/plugins/bigswitch/restproxy.ini\u0027) }"},{"line_number":69,"context_line":"        it_behaves_like \u0027core plugin common configurator\u0027, \u0027bigswitch\u0027, %w(servers) do"},{"line_number":70,"context_line":"          let(:cfg_file) { file }"},{"line_number":71,"context_line":"        end"},{"line_number":72,"context_line":"      end"},{"line_number":73,"context_line":""}],"source_content_type":"text/x-ruby","patch_set":1,"id":"baa201ad_e9ecebbd","line":70,"in_reply_to":"baa201ad_e005e014","updated":"2014-10-13 17:12:48.000000000","message":"This is what I had in mind.\n\nshared_examples \u0027core plugin common configurator\u0027 do |plugin_name, file_name, attr_names|\n\n  describe \u0027config file\u0027 do\n\n    let(:cfg_file) { chef_run.template(\"/etc/neutron/plugins/#{plugin_name}/#{file_name}\") }\n...\n      describe \u0027bigswitch\u0027 do\n        it_behaves_like \u0027core plugin common configurator\u0027, \u0027bigswitch\u0027, \u0027restproxy.ini\u0027, %w(servers)\n      end\n\n\n\nThis way that helper example method is self contained and can deal with all it\u0027s internals as it wants.  Then we can remove the lines like 75 and 77-78 below.    And only define it again in cases where it\u0027s needed.\n\nClear as mud?","commit_id":"b45300d88ca44d280435af5ab9509fbf459c3285"},{"author":{"_account_id":10791,"name":"Federico Gimenez","email":"fgimenez@canonical.com","username":"fgimenez"},"change_message_id":"ee9cf49228ee416ac0d0d48f1dd5b2c3373cc1c1","unresolved":false,"context_lines":[{"line_number":67,"context_line":"      describe \u0027bigswitch\u0027 do"},{"line_number":68,"context_line":"        let(:file) { chef_run.template(\u0027/etc/neutron/plugins/bigswitch/restproxy.ini\u0027) }"},{"line_number":69,"context_line":"        it_behaves_like \u0027core plugin common configurator\u0027, \u0027bigswitch\u0027, %w(servers) do"},{"line_number":70,"context_line":"          let(:cfg_file) { file }"},{"line_number":71,"context_line":"        end"},{"line_number":72,"context_line":"      end"},{"line_number":73,"context_line":""}],"source_content_type":"text/x-ruby","patch_set":1,"id":"baa201ad_61d64f29","line":70,"in_reply_to":"baa201ad_e9ecebbd","updated":"2014-10-13 18:33:26.000000000","message":"Ok, implemented in next patchset, much better now.\n\nI begun with something similar to this but discarded it because of the double call to chef_run.template needed for complex plugins like cisco or openvswitch (one call in the shared example an another one in the specific template examples), anyway it is more clear this way","commit_id":"b45300d88ca44d280435af5ab9509fbf459c3285"},{"author":{"_account_id":10791,"name":"Federico Gimenez","email":"fgimenez@canonical.com","username":"fgimenez"},"change_message_id":"8eb3a2a22a6b5a02a320838d34cb311ee93c3062","unresolved":false,"context_lines":[{"line_number":67,"context_line":"      describe \u0027bigswitch\u0027 do"},{"line_number":68,"context_line":"        let(:file) { chef_run.template(\u0027/etc/neutron/plugins/bigswitch/restproxy.ini\u0027) }"},{"line_number":69,"context_line":"        it_behaves_like \u0027core plugin common configurator\u0027, \u0027bigswitch\u0027, %w(servers) do"},{"line_number":70,"context_line":"          let(:cfg_file) { file }"},{"line_number":71,"context_line":"        end"},{"line_number":72,"context_line":"      end"},{"line_number":73,"context_line":""}],"source_content_type":"text/x-ruby","patch_set":1,"id":"baa201ad_e005e014","line":70,"in_reply_to":"baa201ad_fddf49d4","updated":"2014-10-13 16:08:40.000000000","message":"Very good point, the problem is that, because file is being defined with let, it cannot be used as a it_behaves_like parameter, it is out of scope there. \n\nFor this kind of template, in which all the cases are covered with the \u0027core plugin common configurator\u0027 shared examples, perhaps the chef_run.template call might be used as the parameter itself (don\u0027t know if chef_run is visible there). In more complex cases (ie cisco) the file is reused later, it must be defined once and be accessible for the shared example method call and for the later examples.\n\nOne possible solution (honestly I haven\u0027t tried this) could be to define file as an instance variable in a before block. Maybe I\u0027m missing something obvious, what do think?","commit_id":"b45300d88ca44d280435af5ab9509fbf459c3285"}]}
