garb 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,26 @@
1
+ require File.join(File.dirname(__FILE__), '..', '/test_helper')
2
+
3
+ module Garb
4
+ class SessionTest < Test::Unit::TestCase
5
+
6
+ context "The Session class" do
7
+
8
+ should "be able retrieve an auth_token for a user" do
9
+ auth_request = mock {|m| m.expects(:auth_token).with().returns('toke') }
10
+ AuthenticationRequest.expects(:new).with('email', 'password').returns(auth_request)
11
+
12
+ Session.login('email', 'password')
13
+ assert_equal 'toke', Session.auth_token
14
+ end
15
+
16
+ should "retain the email address for this session" do
17
+ AuthenticationRequest.stubs(:new).returns(stub(:auth_token => 'toke'))
18
+
19
+ Session.login('email', 'password')
20
+ assert_equal 'email', Session.email
21
+ end
22
+
23
+ end
24
+
25
+ end
26
+ end
@@ -0,0 +1,9 @@
1
+ require File.join(File.dirname(__FILE__), '..', '/test_helper')
2
+
3
+ class StringTest < Test::Unit::TestCase
4
+ context "An instance of a String" do
5
+ should 'prefix a string with ga: for GA' do
6
+ assert_equal 'ga:bob', 'bob'.to_ga
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,44 @@
1
+ require File.join(File.dirname(__FILE__), '..', '/test_helper')
2
+
3
+ class SymbolTest < Test::Unit::TestCase
4
+
5
+ context "An instance of the Symbol class" do
6
+
7
+ should "properly format itself for ga" do
8
+ assert_equal "ga:requestUri", :request_uri.to_ga
9
+ end
10
+
11
+ should "define a :desc operator" do
12
+ operator = stub()
13
+ symbol = :foo
14
+
15
+ Operator.expects(:new).with(:foo, '-', true).returns(operator)
16
+ assert_equal operator, :foo.desc
17
+ end
18
+
19
+ def self.should_define_operator(operators)
20
+ operators.each do |method, operator|
21
+ should "define an :#{method} operator" do
22
+ new_operator = stub()
23
+ symbol = :foo
24
+
25
+ Operator.expects(:new).with(:foo, operator).returns(new_operator)
26
+ assert_equal new_operator, :foo.send(method)
27
+ end
28
+ end
29
+ end
30
+
31
+ should_define_operator :eql => '==',
32
+ :not_eql => '!=',
33
+ :gt => '>',
34
+ :gte => '>=',
35
+ :lt => '<',
36
+ :lte => '<=',
37
+ :matches => '==',
38
+ :does_not_match => '!=',
39
+ :contains => '=~',
40
+ :does_not_contain => '!~',
41
+ :substring => '=@',
42
+ :not_substring => '!@'
43
+ end
44
+ end
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: garb
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.1
5
+ platform: ruby
6
+ authors:
7
+ - Tony Pitale
8
+ - Justin Marney
9
+ - Patrick Reagan
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+
14
+ date: 2009-05-01 00:00:00 -04:00
15
+ default_executable:
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
18
+ name: jnunemaker-happymapper
19
+ type: :runtime
20
+ version_requirement:
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: 0.2.2
26
+ version:
27
+ description:
28
+ email: tony.pitale@viget.com
29
+ executables: []
30
+
31
+ extensions: []
32
+
33
+ extra_rdoc_files: []
34
+
35
+ files:
36
+ - README.md
37
+ - Rakefile
38
+ - lib/extensions
39
+ - lib/extensions/happymapper.rb
40
+ - lib/extensions/operator.rb
41
+ - lib/extensions/string.rb
42
+ - lib/extensions/symbol.rb
43
+ - lib/garb
44
+ - lib/garb/authentication_request.rb
45
+ - lib/garb/data_request.rb
46
+ - lib/garb/oauth_session.rb
47
+ - lib/garb/profile.rb
48
+ - lib/garb/report.rb
49
+ - lib/garb/report_parameter.rb
50
+ - lib/garb/report_response.rb
51
+ - lib/garb/resource.rb
52
+ - lib/garb/session.rb
53
+ - lib/garb/version.rb
54
+ - lib/garb.rb
55
+ has_rdoc: false
56
+ homepage: http://github.com/vigetlabs/garb
57
+ post_install_message:
58
+ rdoc_options: []
59
+
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: "0"
67
+ version:
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: "0"
73
+ version:
74
+ requirements: []
75
+
76
+ rubyforge_project:
77
+ rubygems_version: 1.3.1
78
+ signing_key:
79
+ specification_version: 2
80
+ summary: Google Analytics API Ruby Wrapper
81
+ test_files:
82
+ - test/fixtures
83
+ - test/fixtures/profile_feed.xml
84
+ - test/fixtures/report_feed.xml
85
+ - test/test_helper.rb
86
+ - test/unit
87
+ - test/unit/authentication_request_test.rb
88
+ - test/unit/data_request_test.rb
89
+ - test/unit/garb_test.rb
90
+ - test/unit/oauth_session_test.rb
91
+ - test/unit/operator_test.rb
92
+ - test/unit/profile_test.rb
93
+ - test/unit/report_parameter_test.rb
94
+ - test/unit/report_response_test.rb
95
+ - test/unit/report_test.rb
96
+ - test/unit/resource_test.rb
97
+ - test/unit/session_test.rb
98
+ - test/unit/string_test.rb
99
+ - test/unit/symbol_test.rb