Browse files

removed dependency, additional tests

  • Loading branch information...
1 parent 0da9d8b commit a766751be30ab2cff249ad667ebd6504e52f7f14 cmar committed Nov 2, 2011
View
33 Gemfile.lock
@@ -2,7 +2,6 @@ PATH
remote: .
specs:
spree_analytics (0.1.0)
- rest-client
spree_core (>= 0.60.2)
GEM
@@ -46,7 +45,7 @@ GEM
builder (>= 2.0.0)
builder (3.0.0)
cocaine (0.2.0)
- deface (0.7.0)
+ deface (0.7.1)
nokogiri (~> 1.5.0)
rails (>= 3.0.9)
diff-lcs (1.1.3)
@@ -71,7 +70,7 @@ GEM
activerecord (~> 3.1.0)
activesupport (~> 3.1.0)
polyamorous (~> 0.5.0)
- mime-types (1.16)
+ mime-types (1.17.2)
multi_json (1.0.3)
nested_set (1.6.8)
activerecord (>= 3.0.0)
@@ -84,7 +83,7 @@ GEM
mime-types
polyamorous (0.5.0)
activerecord (~> 3.0)
- polyglot (0.3.2)
+ polyglot (0.3.3)
rack (1.3.5)
rack-cache (1.1)
rack (>= 0.4)
@@ -109,32 +108,30 @@ GEM
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (~> 0.14.6)
- rake (0.9.2)
+ rake (0.9.2.2)
rd_find_by_param (0.1.1)
activerecord (~> 3.0)
activesupport (~> 3.0)
rd_resource_controller (1.0.1)
rdoc (3.11)
json (~> 1.4)
- rest-client (1.6.7)
- mime-types (>= 1.16)
- rspec (2.6.0)
- rspec-core (~> 2.6.0)
- rspec-expectations (~> 2.6.0)
- rspec-mocks (~> 2.6.0)
- rspec-core (2.6.4)
- rspec-expectations (2.6.0)
+ rspec (2.7.0)
+ rspec-core (~> 2.7.0)
+ rspec-expectations (~> 2.7.0)
+ rspec-mocks (~> 2.7.0)
+ rspec-core (2.7.1)
+ rspec-expectations (2.7.0)
diff-lcs (~> 1.1.2)
- rspec-mocks (2.6.0)
- rspec-rails (2.6.1)
+ rspec-mocks (2.7.0)
+ rspec-rails (2.7.0)
actionpack (~> 3.0)
activesupport (~> 3.0)
railties (~> 3.0)
- rspec (~> 2.6.0)
- spree_core (0.70.0)
+ rspec (~> 2.7.0)
+ spree_core (0.70.1)
activemerchant (= 1.17.0)
acts_as_list (= 0.1.4)
- deface (>= 0.6.1)
+ deface (>= 0.7.0)
faker (= 1.0.0)
highline (= 1.5.1)
jquery-rails (>= 1.0.14)
View
5 app/helpers/analytics_helper.rb
@@ -1,5 +1,10 @@
# defined on https://github.com/jirafe/php-client/wiki/Jirafe-Javascript-Tags
module AnalyticsHelper
+
+ def spree_analytics
+ render :partial => 'analytics/header'
+ end
+
def analytics_tags
tags = { :id => SpreeAnalytics.site_id.to_s, :baseUrl => SpreeAnalytics.data_url }
tags.merge! product_analytics_tags
View
1 lib/spree_analytics.rb
@@ -1,3 +1,2 @@
require 'spree_core'
-require 'rest_client'
require 'spree_analytics/engine'
View
43 spec/views/analytics/_header.html.erb_spec.rb
@@ -0,0 +1,43 @@
+require "spec_helper"
+
+describe "analytics/_header.html.erb" do
+
+ before :each do
+ view.stub(:title => "test",
+ :current_order => Order.new)
+ end
+
+ describe "uninitalized" do
+ before :each do
+ SpreeAnalytics.app_id = nil
+ SpreeAnalytics.site_id = nil
+ SpreeAnalytics.token = nil
+ end
+
+ it "not initialized message" do
+ render
+ rendered.should match /Spree Analytics has not been initialized correctly/
+ end
+ end
+
+ describe "initialized" do
+ before :each do
+ SpreeAnalytics.app_id = 1
+ SpreeAnalytics.site_id = 2
+ SpreeAnalytics.token = "99"
+ end
+
+ it "includes the tags" do
+ render
+ rendered.should match /jirafe/
+ end
+
+ it "includes product tags" do
+ assign(:product, Product.new(:name => 'Ruby Shirt'))
+ render
+ rendered.should match /Ruby Shirt/
+ end
+ end
+end
+
+
View
1 spree_analytics.gemspec
@@ -18,7 +18,6 @@ Gem::Specification.new do |s|
s.requirements << 'none'
s.add_dependency 'spree_core', '>= 0.60.2'
- s.add_dependency 'rest-client'
s.add_development_dependency 'rspec-rails'
end

0 comments on commit a766751

Please sign in to comment.