Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Clean overall architecture of the gem + use Bundler

  • Loading branch information...
commit 04cd4723b2be8a0db87313ccba333669ab8530ff 1 parent f950d87
@rymai rymai authored
View
2  .gitignore
@@ -17,6 +17,8 @@ tmtags
coverage
rdoc
pkg
+.bundle
+Gemfile.lock
## PROJECT::SPECIFIC
._*
View
5 Gemfile
@@ -0,0 +1,5 @@
+source 'https://rubygems.org'
+
+gemspec
+
+gem 'rake'
View
1  VERSION
@@ -1 +0,0 @@
-0.10.0
View
1  lib/rack-google-analytics.rb
@@ -0,0 +1 @@
+require 'rack/google-analytics'
View
5 lib/rack/google-analytics/version.rb
@@ -0,0 +1,5 @@
+module Rack
+ class GoogleAnalytics
+ VERSION = '0.10.0'
+ end
+end
View
10 rack-google-analytics.gemspec
@@ -1,9 +1,10 @@
# -*- encoding: utf-8 -*-
+$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
+require 'rack/google-analytics/version'
Gem::Specification.new do |s|
-
s.name = "rack-google-analytics"
- s.version = File.read('VERSION').to_s
+ s.version = Rack::GoogleAnalytics::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["Lee Hambley"]
s.email = ["lee.hambley@gmail.com"]
@@ -14,4 +15,9 @@ Gem::Specification.new do |s|
s.files = Dir.glob("lib/**/*") + %w(README.md LICENSE)
s.require_path = 'lib'
+ s.add_development_dependency 'bundler'
+ s.add_development_dependency 'test-unit', '~> 2.5.1'
+ s.add_development_dependency 'shoulda', '~> 2.11.3'
+ s.add_development_dependency 'rack', '~> 1.2.0'
+ s.add_development_dependency 'rack-test', '~> 0.5.4'
end
View
10 test/helper.rb
@@ -1,15 +1,17 @@
require 'rubygems'
require 'test/unit'
require 'shoulda'
-require 'rack'
require 'rack/test'
-require File.expand_path('../../lib/rack/google-analytics',__FILE__)
+
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
+$LOAD_PATH.unshift(File.dirname(__FILE__))
+require 'rack/google-analytics'
class Test::Unit::TestCase
include Rack::Test::Methods
-
+
def app; Rack::Lint.new(@app); end
-
+
def mock_app(options)
main_app = lambda { |env|
request = Rack::Request.new(env)
View
8 test/test_rack-google-analytics.rb
@@ -1,7 +1,7 @@
-require File.expand_path('../helper',__FILE__)
+require 'helper'
class TestRackGoogleAnalytics < Test::Unit::TestCase
-
+
context "Asyncronous" do
context "default" do
setup { mock_app :async => true, :tracker => 'somebody' }
@@ -34,7 +34,7 @@ class TestRackGoogleAnalytics < Test::Unit::TestCase
assert_equal "579", last_response.headers['Content-Length']
end
end
-
+
context "multiple top-level domains" do
setup { mock_app :async => true, :top_level => true, :tracker => 'get', :domain => 'mydomain.com' }
should "add top_level domain script" do
@@ -45,7 +45,7 @@ class TestRackGoogleAnalytics < Test::Unit::TestCase
end
end
-
+
context "Syncronous" do
setup { mock_app :async => false, :tracker => 'whatthe' }
should "show non-asyncronous tracker" do
Please sign in to comment.
Something went wrong with that request. Please try again.