analytical 3.0.8 → 3.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. data/lib/analytical/api.rb +2 -2
  2. metadata +6 -86
  3. data/.document +0 -5
  4. data/.rspec +0 -2
  5. data/.rvmrc +0 -8
  6. data/Gemfile +0 -18
  7. data/Gemfile.lock +0 -118
  8. data/Guardfile +0 -8
  9. data/Rakefile +0 -34
  10. data/VERSION +0 -1
  11. data/analytical.gemspec +0 -187
  12. data/example/.gitignore +0 -4
  13. data/example/Gemfile +0 -27
  14. data/example/Gemfile.lock +0 -80
  15. data/example/README +0 -244
  16. data/example/Rakefile +0 -10
  17. data/example/app/controllers/application_controller.rb +0 -6
  18. data/example/app/controllers/page_controller.rb +0 -18
  19. data/example/app/helpers/application_helper.rb +0 -2
  20. data/example/app/helpers/page_helper.rb +0 -2
  21. data/example/app/views/layouts/application.html.erb +0 -17
  22. data/example/app/views/page/index.html.erb +0 -6
  23. data/example/app/views/page/test_a.html.erb +0 -11
  24. data/example/app/views/page/test_b.html.erb +0 -7
  25. data/example/config.ru +0 -4
  26. data/example/config/analytical.yml +0 -30
  27. data/example/config/application.rb +0 -46
  28. data/example/config/boot.rb +0 -6
  29. data/example/config/database.yml +0 -22
  30. data/example/config/environment.rb +0 -7
  31. data/example/config/environments/development.rb +0 -21
  32. data/example/config/environments/production.rb +0 -42
  33. data/example/config/environments/test.rb +0 -32
  34. data/example/config/initializers/backtrace_silencers.rb +0 -7
  35. data/example/config/initializers/inflections.rb +0 -10
  36. data/example/config/initializers/mime_types.rb +0 -5
  37. data/example/config/initializers/secret_token.rb +0 -7
  38. data/example/config/initializers/session_store.rb +0 -8
  39. data/example/config/locales/en.yml +0 -5
  40. data/example/config/routes.rb +0 -63
  41. data/example/db/seeds.rb +0 -7
  42. data/example/doc/README_FOR_APP +0 -2
  43. data/example/lib/tasks/.gitkeep +0 -0
  44. data/example/public/404.html +0 -26
  45. data/example/public/422.html +0 -26
  46. data/example/public/500.html +0 -26
  47. data/example/public/favicon.ico +0 -0
  48. data/example/public/images/rails.png +0 -0
  49. data/example/public/javascripts/application.js +0 -2
  50. data/example/public/javascripts/controls.js +0 -965
  51. data/example/public/javascripts/dragdrop.js +0 -974
  52. data/example/public/javascripts/effects.js +0 -1123
  53. data/example/public/javascripts/prototype.js +0 -4874
  54. data/example/public/javascripts/rails.js +0 -118
  55. data/example/public/robots.txt +0 -5
  56. data/example/public/stylesheets/.gitkeep +0 -0
  57. data/example/script/rails +0 -9
  58. data/example/test/functional/page_controller_test.rb +0 -19
  59. data/example/test/performance/browsing_test.rb +0 -9
  60. data/example/test/test_helper.rb +0 -13
  61. data/example/test/unit/helpers/page_helper_test.rb +0 -4
  62. data/example/vendor/plugins/.gitkeep +0 -0
  63. data/spec/analytical/api_spec.rb +0 -167
  64. data/spec/analytical/bot_detector_spec.rb +0 -24
  65. data/spec/analytical/command_store_spec.rb +0 -36
  66. data/spec/analytical/modules/adroll_spec.rb +0 -27
  67. data/spec/analytical/modules/adwords_spec.rb +0 -76
  68. data/spec/analytical/modules/base_spec.rb +0 -138
  69. data/spec/analytical/modules/chartbeat_spec.rb +0 -26
  70. data/spec/analytical/modules/clicky_spec.rb +0 -44
  71. data/spec/analytical/modules/comscore_spec.rb +0 -27
  72. data/spec/analytical/modules/google_spec.rb +0 -54
  73. data/spec/analytical/modules/kiss_metrics_spec.rb +0 -51
  74. data/spec/analytical/modules/mixpanel_spec.rb +0 -49
  75. data/spec/analytical/modules/optimizely_spec.rb +0 -26
  76. data/spec/analytical/modules/quantcast.rb +0 -26
  77. data/spec/analytical/modules/reinvigorate_spec.rb +0 -35
  78. data/spec/analytical/session_command_store_spec.rb +0 -50
  79. data/spec/analytical_spec.rb +0 -118
  80. data/spec/config/analytical.yml +0 -19
  81. data/spec/spec.opts +0 -5
  82. data/spec/spec_helper.rb +0 -22
@@ -1,26 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
-
3
- describe "Analytical::Modules::Optimizely" do
4
- before(:each) do
5
- @parent = mock('api', :options=>{:optimizely=>{:key=>'abc'}})
6
- end
7
- describe 'on initialize' do
8
- it 'should set the command_location' do
9
- a = Analytical::Modules::Optimizely.new :parent=>@parent, :key=>'abc'
10
- a.tracking_command_location.should == :head_prepend
11
- end
12
- it 'should set the options' do
13
- a = Analytical::Modules::Optimizely.new :parent=>@parent, :key=>'abc'
14
- a.options.should == {:key=>'abc', :parent=>@parent}
15
- end
16
- end
17
- describe '#init_javascript' do
18
- it 'should return the init javascript' do
19
- @api = Analytical::Modules::Optimizely.new :parent=>@parent, :key=>'abcdef'
20
- @api.init_javascript(:head_prepend).should =~ /cdn\.optimizely.com\/js\/abcdef\.js/
21
- @api.init_javascript(:head_append).should == ''
22
- @api.init_javascript(:body_prepend).should == ''
23
- @api.init_javascript(:body_append).should == ''
24
- end
25
- end
26
- end
@@ -1,26 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
-
3
- describe "Analytical::Modules::Quantcast" do
4
- before(:each) do
5
- @parent = mock('api', :options=>{:quantcast=>{:key=>1234}})
6
- end
7
- describe 'on initialize' do
8
- it 'should set the command_location' do
9
- a = Analytical::Modules::Quantcast.new :parent=>@parent, :key=>1234
10
- a.tracking_command_location.should == [:head_append, :body_append]
11
- end
12
- it 'should set the options' do
13
- a = Analytical::Modules::Quantcast.new :parent=>@parent, :key=>12345
14
- a.options.should == {:key=>12345, :parent=>@parent}
15
- end
16
- end
17
- describe '#init_javascript' do
18
- it 'should return the init javascript' do
19
- @api = Analytical::Modules::Quantcast.new :parent=>@parent, :key=>12345
20
- @api.init_javascript(:head_prepend).should =~ ''
21
- @api.init_javascript(:head_append).should == /var._qevents.=._qevents.\|\|.\[\];/
22
- @api.init_javascript(:body_prepend).should == ''
23
- @api.init_javascript(:body_append).should =~ /_qevents.push\(.\{.qacct:"12345"\} \);/
24
- end
25
- end
26
- end
@@ -1,35 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
-
3
- describe "Analytical::Modules::Reinvigorate" do
4
-
5
- before(:each) do
6
- @parent = mock('api', :options=>{:reinvigorate=>{:key=>'abc'}})
7
- end
8
-
9
- describe 'on initialize' do
10
-
11
- it 'should set the command_location' do
12
- a = Analytical::Modules::Reinvigorate.new :parent=>@parent, :key=>'abc'
13
- a.tracking_command_location.should == :body_append
14
- end
15
-
16
- it 'should set the options' do
17
- a = Analytical::Modules::Reinvigorate.new :parent=>@parent, :key=>'abc'
18
- a.options.should == {:key=>'abc', :parent=>@parent}
19
- end
20
-
21
- end
22
-
23
- describe '#init_javascript' do
24
-
25
- it 'should return the init javascript' do
26
- @api = Analytical::Modules::Reinvigorate.new :parent=>@parent, :key=>'abcdef'
27
- @api.init_javascript(:head_prepend).should == ''
28
- @api.init_javascript(:head_append).should == ''
29
- @api.init_javascript(:body_prepend).should == ''
30
- @api.init_javascript(:body_append).should =~ /reinvigorate/
31
- end
32
-
33
- end
34
-
35
- end
@@ -1,50 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Analytical::SessionCommandStore do
4
-
5
- describe 'with a session hash' do
6
- before(:each) do
7
- @session = {}
8
- end
9
-
10
- it 'should add elements' do
11
- @store = Analytical::SessionCommandStore.new @session, :some_module, ['a']
12
- @store << 'b'
13
- @session[:analytical_some_module].should == ['a', 'b']
14
- end
15
- it 'should unshift elements' do
16
- @store = Analytical::SessionCommandStore.new @session, :some_module, ['b']
17
- @store.unshift 'a'
18
- @session[:analytical_some_module].should == ['a', 'b']
19
- end
20
- it 'should iterate over elements' do
21
- @store = Analytical::SessionCommandStore.new @session, :some_module, ['a', 'b']
22
- @store.each do |elem|
23
- ['a', 'b'].include?(elem).should be_true
24
- end
25
- end
26
- it 'should have size' do
27
- @store = Analytical::SessionCommandStore.new @session, :some_module, ['a', 'b']
28
- @store.size.should == 2
29
- end
30
-
31
- it 'should set up the :analytical session hash' do
32
- @store = Analytical::SessionCommandStore.new @session, :some_module, ['a', 'b']
33
- @session[:analytical_some_module].should_not be_nil
34
- end
35
-
36
- describe 'when flushing' do
37
- it 'should empty the list' do
38
- @store = Analytical::SessionCommandStore.new @session, :some_module, ['a', 'b']
39
- @store.flush
40
- @store.size.should == 0
41
- end
42
- it 'should empty the session key' do
43
- @store = Analytical::SessionCommandStore.new @session, :some_module, ['a', 'b']
44
- @store.flush
45
- @session[:analytical_some_module].should == []
46
- end
47
- end
48
- end
49
-
50
- end
@@ -1,118 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
- require 'ostruct'
3
-
4
- describe "Analytical" do
5
- describe 'on initialization' do
6
- class DummyForInit
7
- extend Analytical
8
- include Analytical::InstanceMethods
9
- include Analytical::BotDetector
10
- if ::Rails::VERSION::MAJOR < 3
11
- class_inheritable_accessor :analytical_options
12
- else
13
- class_attribute :analytical_options
14
- end
15
-
16
- def self.helper_method(*a); end
17
- def request
18
- RSpec::Mocks::Mock.new 'request',
19
- :'ssl?'=>true,
20
- :user_agent=>'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 GTB7.0'
21
- end
22
- end
23
-
24
- it 'should have the options from analytical.yml' do
25
- DummyForInit.analytical
26
- d = DummyForInit.new.analytical
27
- d.options[:modules].sort_by { |m| m.to_s }.should == [:chartbeat, :clicky, :google, :kiss_metrics]
28
- d.options[:true_option].should be_true
29
- d.options[:false_option].should be_false
30
- d.options[:string_option].should == "string"
31
- end
32
-
33
- it 'should preserve :javascript_helpers option' do
34
- options = { :javascript_helpers => false, :modules => [] }
35
- DummyForInit.analytical options
36
- a = DummyForInit.new.analytical
37
- a.options[:javascript_helpers].should be_false
38
- end
39
-
40
- it 'should use the supplied options' do
41
- DummyForInit.analytical :modules=>[:google]
42
- d = DummyForInit.new.analytical
43
- d.options[:modules].should == [:google]
44
- end
45
-
46
- describe 'conditionally disabled' do
47
- it 'should set the modules to []' do
48
- DummyForInit.analytical :disable_if => lambda { |x| true }
49
- d = DummyForInit.new
50
- d.analytical.options[:modules].should == []
51
- end
52
- end
53
-
54
- describe 'with filtered modules' do
55
- it 'should set the modules to []' do
56
- DummyForInit.analytical :filter_modules => lambda { |x, modules| modules - [:clicky] }
57
- d = DummyForInit.new
58
- d.analytical.options[:modules].include?(:clicky).should be_false
59
- end
60
- end
61
-
62
- describe 'with a robot request' do
63
- it 'should set the modules to []' do
64
- DummyForInit.analytical
65
- d = DummyForInit.new
66
- d.stub!(:'analytical_is_robot?').and_return(true)
67
- d.analytical.options[:modules].should == []
68
- end
69
- end
70
-
71
- it 'should open the initialization file' do
72
- File.should_receive(:'exists?').with("#{Rails.root}/config/analytical.yml").and_return(true)
73
- DummyForInit.analytical
74
- DummyForInit.analytical_options[:google].should == {:key=>'google_12345'}
75
- DummyForInit.analytical_options[:kiss_metrics].should == {:key=>'kiss_metrics_12345'}
76
- DummyForInit.analytical_options[:clicky].should == {:key=>'clicky_12345'}
77
- DummyForInit.analytical_options[:chartbeat].should == {:key=>'chartbeat_12345', :domain => 'your.domain.com'}
78
- end
79
-
80
- it 'should allow for module-specific controller overrides' do
81
- DummyForInit.analytical :google=>{:key=>'override_google_key'}
82
- DummyForInit.analytical_options[:google].should == {:key=>'override_google_key'}
83
- end
84
-
85
- describe 'in production mode' do
86
- before(:each) do
87
- Rails.env.stub!(:production?).and_return(true)
88
- end
89
- it 'should start with no modules' do
90
- Analytical::Api.should_not_receive(:include)
91
- DummyForInit.analytical
92
- DummyForInit.new.analytical.options[:modules] = []
93
- end
94
- end
95
-
96
- describe 'in non-production mode' do
97
- before(:each) do
98
- Rails.env.stub!(:production?).and_return(false)
99
- end
100
- it 'should start with no modules' do
101
- DummyForInit.analytical
102
- DummyForInit.new.analytical.options[:modules] = [:console]
103
- end
104
- end
105
-
106
- describe 'in development mode' do
107
- before(:each) do
108
- Rails.stub!(:env).and_return(:development)
109
- end
110
- it 'should start with no modules' do
111
- DummyForInit.analytical
112
- DummyForInit.new.analytical.options[:modules] = []
113
- end
114
- end
115
-
116
- end
117
-
118
- end
@@ -1,19 +0,0 @@
1
- test:
2
- javascript_helpers: true
3
- false_option: false
4
- true_option: true
5
- string_option: "string"
6
- google:
7
- key: google_12345
8
- clicky:
9
- key: clicky_12345
10
- kiss_metrics:
11
- key: kiss_metrics_12345
12
- chartbeat:
13
- key: chartbeat_12345
14
- domain: your.domain.com
15
-
16
- production:
17
-
18
- development:
19
-
@@ -1,5 +0,0 @@
1
- --color
2
- --loadby mtime
3
- --reverse
4
- --diff unified
5
- --backtrace
@@ -1,22 +0,0 @@
1
- require 'rubygems'
2
-
3
- ENV["RAILS_ENV"] ||= 'test'
4
-
5
- require 'active_support'
6
- require 'active_support/core_ext'
7
- require 'active_support/json'
8
- require 'action_view'
9
- require 'active_model'
10
- require 'action_controller'
11
- require 'rails'
12
- require 'rspec/rails'
13
-
14
- RSpec.configure do |config|
15
- config.mock_with :rspec
16
- config.expect_with :rspec
17
- config.before do
18
- Rails.stub(:root).and_return(Pathname.new(__FILE__).dirname)
19
- end
20
- end
21
-
22
- require 'analytical'