diff --git a/README.rdoc b/README.rdoc index 4c244bf..18af230 100644 --- a/README.rdoc +++ b/README.rdoc @@ -104,10 +104,6 @@ You call these analytical commands like this: When you call these commands, it will pass the track/event name & data on to each of the modules. (Take a look at the simple javascript helpers in your for more information.) -To disable this functionality, use - - analytical :javascript_helpers => false - == Note on Patches/Pull Requests diff --git a/lib/analytical/api.rb b/lib/analytical/api.rb index 23998a2..3810f37 100644 --- a/lib/analytical/api.rb +++ b/lib/analytical/api.rb @@ -79,13 +79,11 @@ def head_append_javascript tracking_javascript(:head_append), ] - if options[:javascript_helpers] - if Gem::Version.new(::Rails::VERSION::STRING) >= Gem::Version.new('3.1.0') # Rails 3.1 lets us override views in engines - js << options[:controller].send(:render_to_string, :partial=>'analytical_javascript') if options[:controller] - else # All other rails - _partial_path = Pathname.new(__FILE__).dirname.join('..', '..', 'app/views/application', '_analytical_javascript.html.erb').to_s - js << options[:controller].send(:render_to_string, :file=>_partial_path, :layout=>false) if options[:controller] - end + if Gem::Version.new(::Rails::VERSION::STRING) >= Gem::Version.new('3.1.0') # Rails 3.1 lets us override views in engines + js << options[:controller].send(:render_to_string, :partial=>'analytical_javascript') if options[:controller] + else # All other rails + _partial_path = Pathname.new(__FILE__).dirname.join('..', '..', 'app/views/application', '_analytical_javascript.html.erb').to_s + js << options[:controller].send(:render_to_string, :file=>_partial_path, :layout=>false) if options[:controller] end js.delete_if{|s| s.blank?}.join("\n") diff --git a/spec/analytical/api_spec.rb b/spec/analytical/api_spec.rb index df2158b..27faf4e 100644 --- a/spec/analytical/api_spec.rb +++ b/spec/analytical/api_spec.rb @@ -100,15 +100,9 @@ @api.head_append_javascript.should == "console_agoogle_a" end it 'should render an existing template for Rails 3.0' do - @api.options[:javascript_helpers] = true (@api.options[:controller] ||= Object.new).stub!(:render_to_string) { |param| param[:file] } File.exist?(@api.head_append_javascript).should be_true end - it 'should not render an existing template if javascript_helpers is false' do - @api.options[:javascript_helpers] = false - (@api.options[:controller] ||= Object.new).should_not_receive(:render_to_string) - @api.head_append_javascript.should be_blank - end end describe '#body_prepend_javascript' do diff --git a/spec/analytical_spec.rb b/spec/analytical_spec.rb index 8c79c4d..6e6acd4 100644 --- a/spec/analytical_spec.rb +++ b/spec/analytical_spec.rb @@ -30,13 +30,6 @@ def request d.options[:string_option].should == "string" end - it 'should preserve :javascript_helpers option' do - options = { :javascript_helpers => false, :modules => [] } - DummyForInit.analytical options - a = DummyForInit.new.analytical - a.options[:javascript_helpers].should be_false - end - it 'should use the supplied options' do DummyForInit.analytical :modules=>[:google] d = DummyForInit.new.analytical diff --git a/spec/config/analytical.yml b/spec/config/analytical.yml index 1715720..35f1577 100644 --- a/spec/config/analytical.yml +++ b/spec/config/analytical.yml @@ -1,5 +1,4 @@ test: - javascript_helpers: true false_option: false true_option: true string_option: "string"