Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

do not raise if piwik_id is a number #5

Merged
merged 1 commit into from

2 participants

@jhass

No description provided.

@GSI GSI merged commit 4d42631 into from
@GSI
Collaborator

Good idea. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 11, 2012
  1. @jhass
This page is out of date. Refresh to see the latest.
Showing with 11 additions and 2 deletions.
  1. +1 −1  lib/rack/piwik.rb
  2. +10 −1 test/test_rack_piwik.rb
View
2  lib/rack/piwik.rb
@@ -8,7 +8,7 @@ class Piwik
def initialize(app, options = {})
raise ArgumentError, "piwik_url must be present" unless options[:piwik_url] and !options[:piwik_url].empty?
- raise ArgumentError, "piwik_id must be present" unless options[:piwik_id] and !options[:piwik_id].empty?
+ raise ArgumentError, "piwik_id must be present" unless options[:piwik_id] and !options[:piwik_id].to_s.empty?
@app, @options = app, DEFAULT.merge(options)
end
View
11 test/test_rack_piwik.rb
@@ -29,8 +29,17 @@ class TestRackPiwik < Test::Unit::TestCase
assert_no_match %r{Piwik}, last_response.body
assert_match %r{head only}, last_response.body
end
+
+ end
+
+ context "with a number as piwik id" do
+ setup { mock_app :async => true, :tracker => 'somebody', :piwik_url => 'piwik.example.org', :piwik_id => 123 }
+ should "not raise an exception" do
+ assert_nothing_raised do
+ get "/body_only"
+ end
+ end
end
-
end
=begin
Something went wrong with that request. Please try again.