Skip to content

Commit

Permalink
Added support for gauges
Browse files Browse the repository at this point in the history
  • Loading branch information
Tammer Saleh committed Jan 27, 2012
1 parent 5641f1f commit a4e12e6
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
1 change: 1 addition & 0 deletions engine_of_war.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Gem::Specification.new do |gem|
gem.add_dependency "rdiscount"
gem.add_dependency "coffee-script"
gem.add_dependency "rack-google-analytics"
gem.add_dependency "rack-gauges"

gem.add_development_dependency "yard"
gem.add_development_dependency "rake"
Expand Down
1 change: 1 addition & 0 deletions lib/engine_of_war.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require 'sinatra'
require 'rack/google-analytics'
require 'rack/gauges'
require 'compass'
require "builder"
require 'haml'
Expand Down
7 changes: 5 additions & 2 deletions lib/engine_of_war/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@ class EngineOfWar::App < Sinatra::Base
set :scss, Compass.sass_engine_options
set :github_info, nil
set :site_title, nil
set :google_analytics_key, nil

set :config do
File.expand_path(root + '/config/')
end

def self.google_analytics_key=(key)
use Rack::GoogleAnalytics, :tracker => key
use Rack::GoogleAnalytics, tracker: key
end

def self.gauges_key=(key)
use Rack::Gauges, tracker: key
end

def render_page_with_layout(page)
Expand Down
2 changes: 1 addition & 1 deletion lib/engine_of_war/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module EngineOfWar
VERSION = "1.4.0"
VERSION = "1.5.0"
end
13 changes: 13 additions & 0 deletions spec/root_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,19 @@
end
end
end

context "with gauges configured" do
before { Capybara.app.gauges_key = "gauges_key" }

context "on GET to /" do
before { visit "/" }

it "renders the google analytics JS" do
page.should have_selector('script[type="text/javascript"]:contains("gaug.es")')
page.should have_selector('script[type="text/javascript"]:contains("gauges_key")')
end
end
end
end
end

Expand Down

0 comments on commit a4e12e6

Please sign in to comment.