oa-globocom 0.4.8 → 0.4.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@ module OAGloboCom
2
2
  module VERSION
3
3
  MAJOR = 0
4
4
  MINOR = 4
5
- PATCH = 8
5
+ PATCH = 9
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH] * '.'
8
8
  end
@@ -64,7 +64,7 @@ module OmniAuth
64
64
  end
65
65
 
66
66
  def log_env
67
- "SERVER_NAME: #{request.env['SERVER_NAME']} | PATH_INFO: #{request.env['PATH_INFO']} | QUERY_STRING: #{request.env['QUERY_STRING']}"
67
+ "#{Time.now.strftime("%d/%m/%Y %H:%M")} - SERVER_NAME: #{request.env['SERVER_NAME']} | PATH_INFO: #{request.env['PATH_INFO']} | QUERY_STRING: #{request.env['QUERY_STRING']}"
68
68
  end
69
69
 
70
70
  def log_exception(exception)
data/oa-globocom.gemspec CHANGED
@@ -22,4 +22,5 @@ Gem::Specification.new do |s|
22
22
  s.add_development_dependency 'rspec'
23
23
  s.add_development_dependency 'rr'
24
24
  s.add_development_dependency 'fakeweb'
25
+ s.add_development_dependency 'timecop'
25
26
  end
@@ -134,18 +134,23 @@ describe OmniAuth::Strategies::GloboCom do
134
134
  describe "#log_env" do
135
135
  it 'should render the log' do
136
136
  stub_fail_requests
137
- strategy.call! Rack::MockRequest.env_for("http://localhost/auth/cadun/callback?GLBID=GLBID", "rack.session" => {}, "REMOTE_ADDR" => "127.0.0.1")
138
- strategy.log_env.should == "SERVER_NAME: localhost | PATH_INFO: /auth/cadun/callback | QUERY_STRING: GLBID=GLBID"
137
+ Timecop.travel(Time.now) do
138
+ strategy.call! Rack::MockRequest.env_for("http://localhost/auth/cadun/callback?GLBID=GLBID", "rack.session" => {}, "REMOTE_ADDR" => "127.0.0.1")
139
+ strategy.log_env.should == "#{Time.now.strftime("%d/%m/%Y %H:%M")} - SERVER_NAME: localhost | PATH_INFO: /auth/cadun/callback | QUERY_STRING: GLBID=GLBID"
140
+ end
139
141
  end
140
142
  end
141
143
 
142
144
  describe "#log_exception" do
143
145
  it "should render the log" do
144
146
  stub_fail_requests
145
- strategy.call! Rack::MockRequest.env_for("http://localhost/auth/cadun/callback?GLBID=GLBID", "rack.session" => {}, "REMOTE_ADDR" => "127.0.0.1")
146
147
 
147
- exception = Exception.new('NAO_AUTORIZADO')
148
- strategy.log_exception(exception).should == "SERVER_NAME: localhost | PATH_INFO: /auth/cadun/callback | QUERY_STRING: GLBID=GLBID | EXCEPTION: NAO_AUTORIZADO"
148
+ Timecop.travel(Time.now) do
149
+ strategy.call! Rack::MockRequest.env_for("http://localhost/auth/cadun/callback?GLBID=GLBID", "rack.session" => {}, "REMOTE_ADDR" => "127.0.0.1")
150
+
151
+ exception = Exception.new('NAO_AUTORIZADO')
152
+ strategy.log_exception(exception).should == "#{Time.now.strftime("%d/%m/%Y %H:%M")} - SERVER_NAME: localhost | PATH_INFO: /auth/cadun/callback | QUERY_STRING: GLBID=GLBID | EXCEPTION: NAO_AUTORIZADO"
153
+ end
149
154
  end
150
155
  end
151
156
 
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "#{File.dirname(__FILE__)}/../lib/oa-globocom"
2
2
  require 'fakeweb'
3
3
  require 'rack/mock'
4
+ require 'timecop'
4
5
 
5
6
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
6
7
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oa-globocom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.8
4
+ version: 0.4.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -15,7 +15,7 @@ date: 2011-08-05 00:00:00.000000000Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: oa-core
18
- requirement: &2164414600 !ruby/object:Gem::Requirement
18
+ requirement: &2157312920 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ~>
@@ -23,10 +23,10 @@ dependencies:
23
23
  version: 0.2.6
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *2164414600
26
+ version_requirements: *2157312920
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: cadun
29
- requirement: &2157532540 !ruby/object:Gem::Requirement
29
+ requirement: &2157312420 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
32
  - - ~>
@@ -34,10 +34,10 @@ dependencies:
34
34
  version: 0.5.5
35
35
  type: :runtime
36
36
  prerelease: false
37
- version_requirements: *2157532540
37
+ version_requirements: *2157312420
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: rack
40
- requirement: &2157532160 !ruby/object:Gem::Requirement
40
+ requirement: &2157312040 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ! '>='
@@ -45,10 +45,10 @@ dependencies:
45
45
  version: '0'
46
46
  type: :development
47
47
  prerelease: false
48
- version_requirements: *2157532160
48
+ version_requirements: *2157312040
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: rake
51
- requirement: &2157531700 !ruby/object:Gem::Requirement
51
+ requirement: &2157311580 !ruby/object:Gem::Requirement
52
52
  none: false
53
53
  requirements:
54
54
  - - ! '>='
@@ -56,10 +56,10 @@ dependencies:
56
56
  version: '0'
57
57
  type: :development
58
58
  prerelease: false
59
- version_requirements: *2157531700
59
+ version_requirements: *2157311580
60
60
  - !ruby/object:Gem::Dependency
61
61
  name: rspec
62
- requirement: &2157531280 !ruby/object:Gem::Requirement
62
+ requirement: &2157311160 !ruby/object:Gem::Requirement
63
63
  none: false
64
64
  requirements:
65
65
  - - ! '>='
@@ -67,10 +67,10 @@ dependencies:
67
67
  version: '0'
68
68
  type: :development
69
69
  prerelease: false
70
- version_requirements: *2157531280
70
+ version_requirements: *2157311160
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: rr
73
- requirement: &2157530860 !ruby/object:Gem::Requirement
73
+ requirement: &2157310740 !ruby/object:Gem::Requirement
74
74
  none: false
75
75
  requirements:
76
76
  - - ! '>='
@@ -78,10 +78,10 @@ dependencies:
78
78
  version: '0'
79
79
  type: :development
80
80
  prerelease: false
81
- version_requirements: *2157530860
81
+ version_requirements: *2157310740
82
82
  - !ruby/object:Gem::Dependency
83
83
  name: fakeweb
84
- requirement: &2157530440 !ruby/object:Gem::Requirement
84
+ requirement: &2157310320 !ruby/object:Gem::Requirement
85
85
  none: false
86
86
  requirements:
87
87
  - - ! '>='
@@ -89,7 +89,18 @@ dependencies:
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
- version_requirements: *2157530440
92
+ version_requirements: *2157310320
93
+ - !ruby/object:Gem::Dependency
94
+ name: timecop
95
+ requirement: &2157309900 !ruby/object:Gem::Requirement
96
+ none: false
97
+ requirements:
98
+ - - ! '>='
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ type: :development
102
+ prerelease: false
103
+ version_requirements: *2157309900
93
104
  description: The goal of this gem is to allow the developer to use ContaGlobo.com
94
105
  (a login webservice made by Globo.com) in any web app using OmniAuth
95
106
  email: