garails 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -7,5 +7,7 @@ gem "rails", "~> 3.0.3"
7
7
 
8
8
  group :test do
9
9
  gem 'shoulda'
10
+ gem 'webmock'
11
+ gem 'flexmock'
10
12
  end
11
13
 
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- garails (0.0.5)
5
- gabbara (~> 0.0.4)
4
+ garails (0.0.6)
5
+ gabbara (~> 0.0.5)
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
@@ -34,11 +34,14 @@ GEM
34
34
  activemodel (= 3.0.3)
35
35
  activesupport (= 3.0.3)
36
36
  activesupport (3.0.3)
37
+ addressable (2.2.5)
37
38
  arel (2.0.6)
38
39
  builder (2.1.2)
40
+ crack (0.1.8)
39
41
  erubis (2.6.6)
40
42
  abstract (>= 1.0.0)
41
- gabbara (0.0.4)
43
+ flexmock (0.9.0)
44
+ gabbara (0.0.5)
42
45
  activesupport
43
46
  i18n (0.5.0)
44
47
  mail (2.2.12)
@@ -72,11 +75,16 @@ GEM
72
75
  treetop (1.4.9)
73
76
  polyglot (>= 0.3.1)
74
77
  tzinfo (0.3.23)
78
+ webmock (1.6.2)
79
+ addressable (>= 2.2.2)
80
+ crack (>= 0.1.7)
75
81
 
76
82
  PLATFORMS
77
83
  ruby
78
84
 
79
85
  DEPENDENCIES
86
+ flexmock
80
87
  garails!
81
88
  rails (~> 3.0.3)
82
89
  shoulda
90
+ webmock
@@ -18,7 +18,7 @@ class Garails::GoogleAnalyticsController < ActionController::Base
18
18
 
19
19
  def utm
20
20
  if Garails.ga_setup?
21
- g = Garails.mobile_gabba(request, :utmn => params[:utmn])
21
+ g = Garails.mobile_gabba(request, :utmn => params[:utmn], :utmcc => "__utma=999.999.999.999.999.1;", :utmhid => "")
22
22
  g.page_view('', :utmvid => @visitor_id)
23
23
  end
24
24
  response.headers.merge(UTM_HEADERS)
data/garails.gemspec CHANGED
@@ -17,5 +17,5 @@ Gem::Specification.new do |s|
17
17
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
18
  s.require_paths = ["lib"]
19
19
 
20
- s.add_dependency("gabbara", "~> 0.0.4")
20
+ s.add_dependency("gabbara", "~> 0.0.5")
21
21
  end
@@ -1,3 +1,3 @@
1
1
  module Garails
2
- VERSION = '0.0.5'
2
+ VERSION = '0.0.6'
3
3
  end
@@ -4,13 +4,18 @@ class GoogleAnalyticsControllerTest < ActionController::TestCase
4
4
  tests Garails::GoogleAnalyticsController
5
5
 
6
6
  context "GET to :utm" do
7
- setup { get :utm, :format => :gif }
7
+ setup do
8
+ flexmock(@controller, :rand => 405451725)
9
+ stub_analytics("0xd5d59357458cc280")
10
+ get :utm, :format => :gif
11
+ end
8
12
  should respond_with :success
9
13
  should assign_to(:visitor_id)
10
14
  end
11
15
 
12
16
  context "GET to :utm with guid" do
13
17
  setup do
18
+ stub_analytics("0x80620d96c658ed0f")
14
19
  request.env["HTTP_X_DCMGUID"] = "blah"
15
20
  get :utm, :format => :gif
16
21
  end
@@ -18,4 +23,14 @@ class GoogleAnalyticsControllerTest < ActionController::TestCase
18
23
  should assign_to(:visitor_id)
19
24
  end
20
25
 
26
+ def stub_analytics(vid)
27
+ query = {
28
+ :utmac => "MO-12345678-9", :utmcc => "__utma=999.999.999.999.999.1;", :utmcs => "UTF-8",
29
+ :utmhn => "example.org", :utmip => "0.0.0.0", :utmr => "-", :utmul => "en-us",
30
+ :utmvid => vid, :utmwv => "4.4sh" }
31
+ stub_request(:get, "http://www.google-analytics.com/__utm.gif").
32
+ with(:query => query, :headers => {'Accept'=>'*/*', 'User-Agent'=>'Rails%20Testing'}).
33
+ to_return(:status => 200, :body => "", :headers => {})
34
+ end
35
+
21
36
  end
@@ -0,0 +1 @@
1
+ Garails.ga_account = 'UA-12345678-9'
data/test/test_helper.rb CHANGED
@@ -3,4 +3,6 @@ $:.unshift File.dirname(__FILE__)
3
3
 
4
4
  require 'test_app/config/environment'
5
5
  require 'rails/test_help'
6
+ require 'webmock/test_unit'
7
+ require 'flexmock/test_unit'
6
8
 
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: garails
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 5
9
- version: 0.0.5
4
+ prerelease:
5
+ version: 0.0.6
10
6
  platform: ruby
11
7
  authors:
12
8
  - Michael Reinsch
@@ -14,7 +10,7 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2011-04-19 00:00:00 +09:00
13
+ date: 2011-04-25 00:00:00 +09:00
18
14
  default_executable:
19
15
  dependencies:
20
16
  - !ruby/object:Gem::Dependency
@@ -25,11 +21,7 @@ dependencies:
25
21
  requirements:
26
22
  - - ~>
27
23
  - !ruby/object:Gem::Version
28
- segments:
29
- - 0
30
- - 0
31
- - 4
32
- version: 0.0.4
24
+ version: 0.0.5
33
25
  type: :runtime
34
26
  version_requirements: *id001
35
27
  description: Google Analytics for Rails
@@ -69,6 +61,7 @@ files:
69
61
  - test/test_app/config/environment.rb
70
62
  - test/test_app/config/environments/test.rb
71
63
  - test/test_app/config/initializers/backtrace_silencers.rb
64
+ - test/test_app/config/initializers/garails.rb
72
65
  - test/test_app/config/initializers/inflections.rb
73
66
  - test/test_app/config/initializers/mime_types.rb
74
67
  - test/test_app/config/initializers/secret_token.rb
@@ -95,46 +88,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
95
88
  requirements:
96
89
  - - ">="
97
90
  - !ruby/object:Gem::Version
98
- segments:
99
- - 0
100
91
  version: "0"
101
92
  required_rubygems_version: !ruby/object:Gem::Requirement
102
93
  none: false
103
94
  requirements:
104
95
  - - ">="
105
96
  - !ruby/object:Gem::Version
106
- segments:
107
- - 0
108
97
  version: "0"
109
98
  requirements: []
110
99
 
111
100
  rubyforge_project:
112
- rubygems_version: 1.3.7
101
+ rubygems_version: 1.6.2
113
102
  signing_key:
114
103
  specification_version: 3
115
104
  summary: Google Analytics for Rails
116
- test_files:
117
- - test/controllers/google_analytics_controller_test.rb
118
- - test/test_app/.gitignore
119
- - test/test_app/app/controllers/application_controller.rb
120
- - test/test_app/app/helpers/application_helper.rb
121
- - test/test_app/app/views/layouts/application.html.erb
122
- - test/test_app/config.ru
123
- - test/test_app/config/application.rb
124
- - test/test_app/config/boot.rb
125
- - test/test_app/config/database.yml
126
- - test/test_app/config/environment.rb
127
- - test/test_app/config/environments/test.rb
128
- - test/test_app/config/initializers/backtrace_silencers.rb
129
- - test/test_app/config/initializers/inflections.rb
130
- - test/test_app/config/initializers/mime_types.rb
131
- - test/test_app/config/initializers/secret_token.rb
132
- - test/test_app/config/initializers/session_store.rb
133
- - test/test_app/config/routes.rb
134
- - test/test_app/db/seeds.rb
135
- - test/test_app/public/404.html
136
- - test/test_app/public/422.html
137
- - test/test_app/public/500.html
138
- - test/test_app/public/favicon.ico
139
- - test/test_app/script/rails
140
- - test/test_helper.rb
105
+ test_files: []
106
+