Permalink
Browse files

Update slimmer. Send analytics headers.

  • Loading branch information...
1 parent 9b47baf commit 485bb9832def35f96fde789af3e09db78a5c1b85 @threedaymonk threedaymonk committed Dec 14, 2011
View
4 Gemfile
@@ -18,13 +18,13 @@ gem 'stringex'
gem 'loofah'
gem 'nokogiri'
gem 'whenever'
-gem 'plek', '0.1.5'
+gem 'plek', '0.1.11'
gem 'rummageable', :git => 'git@github.com:alphagov/rummageable.git'
if ENV['SLIMMER_DEV']
gem 'slimmer', :path => '../slimmer'
else
- gem 'slimmer', '0.8.0'
+ gem 'slimmer', '~> 1.1'
end
group :development do
View
16 Gemfile.lock
@@ -57,7 +57,7 @@ GEM
jquery-rails (1.0.16)
railties (~> 3.0)
thor (~> 0.14)
- json (1.6.1)
+ json (1.6.3)
loofah (1.2.0)
nokogiri (>= 1.4.4)
mail (2.3.0)
@@ -73,7 +73,7 @@ GEM
mysql2 (0.3.7)
nokogiri (1.5.0)
null_logger (0.0.1)
- plek (0.1.5)
+ plek (0.1.11)
builder
polyglot (0.3.2)
rack (1.3.5)
@@ -113,8 +113,12 @@ GEM
simplecov-html (0.4.5)
simplecov-rcov (0.2.3)
simplecov (>= 0.4.1)
- slimmer (0.8.0)
- nokogiri
+ slimmer (1.1.8)
+ json
+ nokogiri (~> 1.5.0)
+ null_logger
+ plek (>= 0.1.8)
+ rack (~> 1.3.5)
sprockets (2.0.3)
hike (~> 1.2)
rack (~> 1.0)
@@ -151,7 +155,7 @@ DEPENDENCIES
mocha
mysql2
nokogiri
- plek (= 0.1.5)
+ plek (= 0.1.11)
rack (= 1.3.5)
rails (= 3.1.1)
rake (= 0.9.2)
@@ -160,7 +164,7 @@ DEPENDENCIES
rummageable!
simplecov (= 0.4.2)
simplecov-rcov
- slimmer (= 0.8.0)
+ slimmer (~> 1.1)
sqlite3-ruby
stringex
turn
View
14 app/controllers/application_controller.rb
@@ -1,2 +1,16 @@
+require "slimmer/headers"
+
class ApplicationController < ActionController::Base
+ include Slimmer::Headers
+ before_filter :set_analytics_headers
+
+protected
+ def set_analytics_headers
+ set_slimmer_headers(
+ section: "FCO",
+ need_id: 133,
+ format: "fco",
+ proposition: "citizen"
+ )
+ end
end
View
2 config/environments/development.rb
@@ -27,6 +27,4 @@
# Expands the lines which load the assets
# config.assets.debug = true
- config.middleware.use Slimmer::App, :template_path => "#{config.root}/public/templates"
-
end
View
2 config/environments/production.rb
@@ -58,5 +58,5 @@
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
- config.middleware.use Slimmer::App, :asset_host => Plek.current.find("static")
+ config.slimmer.asset_host = Plek.current.find('assets')
end
View
12 test/functional/home_controller_test.rb
@@ -0,0 +1,12 @@
+require 'test_helper'
+
+class HomeControllerTest < ActionController::TestCase
+
+ test "should send slimmer analytics headers" do
+ get :show
+ assert_equal "FCO", @response.headers["X-Slimmer-Section"]
+ assert_equal "133", @response.headers["X-Slimmer-Need-ID"].to_s
+ assert_equal "fco", @response.headers["X-Slimmer-Format"]
+ assert_equal "citizen", @response.headers["X-Slimmer-Proposition"]
+ end
+end

0 comments on commit 485bb98

Please sign in to comment.