Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove whitespace [Gun.io WhitespaceBot]

  • Loading branch information...
commit 23260ff4460cd5cc7336e0d88bbc20582765b5ac 1 parent c1aee2b
Gun.io Whitespace Robot authored
View
2  Rakefile
@@ -46,7 +46,7 @@ begin
Rcov::RcovTask.new(:rcov) do |t|
t.libs << "test"
t.test_files = FileList['test/**/*_test.rb']
- t.rcov_opts << "-x \"test/*,gems/*,/Library/Ruby/*,config/*\" -x lib/garb.rb -x lib/garb/version.rb --rails"
+ t.rcov_opts << "-x \"test/*,gems/*,/Library/Ruby/*,config/*\" -x lib/garb.rb -x lib/garb/version.rb --rails"
end
rescue LoadError
nil
View
2  lib/garb.rb
@@ -4,7 +4,7 @@
require 'cgi'
require 'ostruct'
-begin
+begin
require 'yajl/json_gem' # JSON.parse
rescue LoadError
require 'json'
View
2  lib/garb/core_ext/string.rb
@@ -30,7 +30,7 @@ def camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true)
lower_case_and_underscored_word.to_s[0].chr.downcase + camelize(lower_case_and_underscored_word)[1..-1]
end
end
-
+
def underscore(camel_cased_word)
word = camel_cased_word.to_s.dup
word.gsub!(/::/, '/')
View
8 lib/garb/report_parameter.rb
@@ -2,21 +2,21 @@ module Garb
class ReportParameter
attr_reader :elements
-
+
def initialize(name)
@name = name
@elements = []
end
-
+
def name
@name.to_s
end
-
+
def <<(element)
(@elements += [element].flatten).compact!
self
end
-
+
def to_params
value = self.elements.map{|param| Garb.to_google_analytics(param)}.join(',')
value.empty? ? {} : {self.name => value}
View
2  lib/garb/report_response.rb
@@ -1,4 +1,4 @@
-module Garb
+module Garb
class ReportResponse
KEYS = ['dxp$metric', 'dxp$dimension']
View
4 lib/garb/request/authentication.rb
@@ -20,7 +20,7 @@ def parameters
'source' => 'vigetLabs-garb-001'
}
end
-
+
def uri
URI.parse(URL)
end
@@ -45,7 +45,7 @@ def build_request
post.set_form_data(parameters)
post
end
-
+
def auth_token(opts={})
ssl_mode = opts[:secure] ? OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE
send_request(ssl_mode).body.match(/^Auth=(.*)$/)[1]
View
4 test/unit/garb/filter_parameters_test.rb
@@ -7,12 +7,12 @@ class FilterParametersTest < MiniTest::Unit::TestCase
# should "create an operator and add to parameters for the #{operator} method" do
# new_operator = stub
# symbol = :foo
- #
+ #
# SymbolOperator.expects(:new).with(:bar, operator).returns(new_operator)
# @filter_parameters.filters do
# send(operator.to_sym, :bar, 100)
# end
- #
+ #
# parameter = {new_operator => 100}
# assert_equal parameter, @filter_parameters.parameters.last
# end
View
2  test/unit/garb/management/profile_test.rb
@@ -19,7 +19,7 @@ class ProfileTest < MiniTest::Unit::TestCase
should "find all profiles for a given account" do
Profile.stubs(:all)
Profile.for_account(stub(:session => 'session', :path => '/accounts/123'))
- assert_received(Profile, :all) {|e| e.with('session', '/accounts/123/webproperties/~all/profiles')}
+ assert_received(Profile, :all) {|e| e.with('session', '/accounts/123/webproperties/~all/profiles')}
end
should "find all profiles for a given web_property" do
View
12 test/unit/garb/report_parameter_test.rb
@@ -2,25 +2,25 @@
module Garb
class ReportParameterTest < MiniTest::Unit::TestCase
-
+
context "An instance of the ReportParameter class" do
setup do
@metrics = ReportParameter.new(:metrics)
end
-
+
should "have a name" do
assert_equal "metrics", @metrics.name
end
-
+
should "have a list of elements" do
assert_equal [], @metrics.elements
end
-
+
should "be able to add new elements" do
assert_equal(@metrics, @metrics << :page_path)
assert_equal [:page_path], @metrics.elements
end
-
+
should "merge an array of elements" do
assert_equal(@metrics, @metrics << [:page_path])
assert_equal [:page_path], @metrics.elements
@@ -38,6 +38,6 @@ class ReportParameterTest < MiniTest::Unit::TestCase
end
end
end
-
+
end
end
View
22 test/unit/garb/request/authentication_test.rb
@@ -5,17 +5,17 @@
module Garb
module Request
class AuthenticationTest < MiniTest::Unit::TestCase
-
+
context "An instance of the Request::Authentication class" do
-
+
setup { @request = Request::Authentication.new('email', 'password') }
teardown do
Garb.proxy_address = nil
Garb.proxy_port = nil
end
-
+
should "have a collection of parameters that include the email and password" do
- expected =
+ expected =
{
'Email' => 'user@example.com',
'Passwd' => 'fuzzybunnies',
@@ -23,7 +23,7 @@ class AuthenticationTest < MiniTest::Unit::TestCase
'service' => 'analytics',
'source' => 'vigetLabs-garb-001'
}
-
+
request = Request::Authentication.new('user@example.com', 'fuzzybunnies')
assert_equal expected, request.parameters
end
@@ -44,7 +44,7 @@ class AuthenticationTest < MiniTest::Unit::TestCase
m.expects(:ca_file=).with(CA_CERT_FILE)
m.expects(:request).with('post').yields(response)
end
-
+
Net::HTTP.expects(:new).with('www.google.com', 443, nil, nil).returns(http)
@request.send_request(OpenSSL::SSL::VERIFY_PEER)
@@ -61,12 +61,12 @@ class AuthenticationTest < MiniTest::Unit::TestCase
m.expects(:verify_mode=).with(OpenSSL::SSL::VERIFY_NONE)
m.expects(:request).with('post').yields(response)
end
-
+
Net::HTTP.expects(:new).with('www.google.com', 443, nil, nil).returns(http)
@request.send_request(OpenSSL::SSL::VERIFY_NONE)
end
-
+
should "be able to build a request for the GAAPI service" do
params = "param"
@request.expects(:parameters).with().returns(params)
@@ -78,7 +78,7 @@ class AuthenticationTest < MiniTest::Unit::TestCase
@request.build_request
end
-
+
should "be able to retrieve an auth_token from the body" do
response_data =
"SID=mysid\n" +
@@ -100,7 +100,7 @@ class AuthenticationTest < MiniTest::Unit::TestCase
assert_equal 'auth_token', @request.auth_token(:secure => true)
end
-
+
should "raise an exception when requesting an auth_token when the authorization fails" do
@request.stubs(:build_request)
response = mock do |m|
@@ -115,7 +115,7 @@ class AuthenticationTest < MiniTest::Unit::TestCase
end
Net::HTTP.stubs(:new).with('www.google.com', 443, nil, nil).returns(http)
-
+
assert_raises(Garb::Request::Authentication::AuthError) do
@request.send_request(OpenSSL::SSL::VERIFY_NONE)
end
View
12 test/unit/garb/request/data_test.rb
@@ -3,7 +3,7 @@
module Garb
module Request
class DataTest < MiniTest::Unit::TestCase
-
+
context "An instance of the Request::Data class" do
setup do
@session = Session.new
@@ -18,16 +18,16 @@ class DataTest < MiniTest::Unit::TestCase
should "be able to build the query string from parameters" do
parameters = {'ids' => '12345', 'metrics' => 'country'}
data_request = Request::Data.new(@session, "", parameters)
-
+
query_string = data_request.query_string
-
+
assert_match(/^\?/, query_string)
-
+
query_string.sub!(/^\?/, '')
-
+
assert_equal ["alt=json", "ids=12345", "metrics=country"], query_string.split('&').sort
end
-
+
should "only contain JSON response option if parameters are empty" do
data_request = Request::Data.new(@session, "")
assert_equal "?alt=json", data_request.query_string
View
14 test/unit/garb/session_test.rb
@@ -2,9 +2,9 @@
module Garb
class SessionTest < MiniTest::Unit::TestCase
-
+
context "The Session class" do
-
+
should "be able retrieve an auth_token for a user" do
auth_request = mock {|m| m.expects(:auth_token).with({}).returns('toke') }
Request::Authentication.expects(:new).with('email', 'password', {}).returns(auth_request)
@@ -21,10 +21,10 @@ class SessionTest < MiniTest::Unit::TestCase
Session.login('email', 'password', opts)
assert_equal 'toke', Session.auth_token
end
-
+
should "retain the email address for this session" do
Request::Authentication.stubs(:new).returns(stub(:auth_token => 'toke'))
-
+
Session.login('email', 'password')
assert_equal 'email', Session.email
end
@@ -44,7 +44,7 @@ class SessionTest < MiniTest::Unit::TestCase
setup do
@session = Session.new
end
-
+
should "be able retrieve an auth_token for a user" do
auth_request = mock {|m| m.expects(:auth_token).with({}).returns('toke') }
Request::Authentication.expects(:new).with('email', 'password', {}).returns(auth_request)
@@ -61,10 +61,10 @@ class SessionTest < MiniTest::Unit::TestCase
@session.login('email', 'password', opts)
assert_equal 'toke', @session.auth_token
end
-
+
should "retain the email address for this session" do
Request::Authentication.stubs(:new).returns(stub(:auth_token => 'toke'))
-
+
@session.login('email', 'password')
assert_equal 'email', @session.email
end
View
6 test/unit/garb_test.rb
@@ -6,9 +6,9 @@ class GarbTest < MiniTest::Unit::TestCase
assert_equal '-ga:bob', Garb.to_google_analytics(stub(:to_google_analytics => '-ga:bob'))
assert_equal 'ga:bob', Garb.to_google_analytics('bob')
end
-
- should 'parse out - and put it before ga:' do
- assert_equal '-ga:pageviews', Garb.to_google_analytics('-pageviews')
+
+ should 'parse out - and put it before ga:' do
+ assert_equal '-ga:pageviews', Garb.to_google_analytics('-pageviews')
end
should 'remove ga: prefix' do
View
6 test/unit/symbol_operator_test.rb
@@ -19,16 +19,16 @@ class SymbolOperatorTest < MiniTest::Unit::TestCase
# op2 = SymbolOperator.new(:hello, "==")
# assert_equal op1, op2
# end
- #
+ #
# should "not be equal to another operator if target, operator, or prefix is different" do
# op1 = SymbolOperator.new(:hello, "==")
# op2 = SymbolOperator.new(:hello, "==", true)
# refute_equal op1, op2
- #
+ #
# op1 = SymbolOperator.new(:hello1, "==")
# op2 = SymbolOperator.new(:hello2, "==")
# refute_equal op1, op2
- #
+ #
# op1 = SymbolOperator.new(:hello, "!=")
# op2 = SymbolOperator.new(:hello, "==")
# refute_equal op1, op2
Please sign in to comment.
Something went wrong with that request. Please try again.