C0 code coverage information
Generated on Tue Jun 09 17:50:06 +0900 2009 with
rcov 0.8.1.2
Code reported as executed by Ruby looks like
this... and this: this line is also marked as
covered. Lines considered as run by rcov, but
not reported by Ruby, look like this, and
this: these lines were inferred by rcov (using simple heuristics).
Finally, here's a line marked as not
executed.
1
require 'nested_ajax/pane' 2 3
module NestedAjax 4 module
Pane 5 class BelongsToPane
< AssociationPane 6 def
initialize(template, form_or_object, association_name, options = {})
7 super(template,
form_or_object, association_name, options) 8 logger.debug("BelongsToPane.initialize @form_name
=> #{@form_name}")
9 unless @reflection.macro == :belongs_to 10 raise ArgumentError, "#{association_name} of
#{object.class.name} is not defined with belongs_to but
#{@reflection.macro}" 11 end 12 end 13 14
def link_to_new(link_name, options = {}, html_options = {}) 15 html_options[:id] ||=
"#{id}_#{association_name}_new" 16 link_id = html_options[:id] 17 options = { 18 :method => :get, 19 :update => link_id,
20 :position =>
:after, 21 :object_name
=> controller.to_s.singularize, 22 :url => new_url 23 }.update(self.options[:link_to_new] ||
{}).update(options || {}) 24 base_script = remote_function(options) 25 script = <<-"EOS"
26 (function(){
27
Event.observe("#{link_id}", "click", function(event){
28 #{options[:onclick]};
29 #{base_script};
30 Event.stop(event);
31 }, true);
32 })(); 33 EOS 34 link_to(link_name,
'javascript:void(0)', html_options) << 35 javascript_tag(script.split(/$/).map(&:strip).join)
36 end 37 38 def new_url 39 nested_ajax = { 40 :in_form => !form.nil?, 41 :pane_id => pane_id, 42 :form_name => form_name
43 } 44 result = {:controller =>
controller, :action => :new, :nested_ajax => nested_ajax} 45 yield(result) if block_given?
46 result 47 end 48 49 def form_name 50 @form_name ||= form_name_with_parent 51
logger.debug("BelongsToPane.form_name parent.nil? =>
#{parent.nil?.inspect} @form_name => #{@form_name}") 52 @form_name 53 end 54 55 end 56 end 57 end
Generated using the rcov
code coverage analysis tool for Ruby version 0.8.1.2.