justlogging-rails 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
justlogging-rails (0.0.
|
4
|
+
justlogging-rails (0.0.4)
|
5
5
|
activesupport
|
6
6
|
rails
|
7
7
|
rake
|
@@ -44,7 +44,7 @@ GEM
|
|
44
44
|
hike (1.2.1)
|
45
45
|
i18n (0.6.0)
|
46
46
|
journey (1.0.4)
|
47
|
-
json (1.7.
|
47
|
+
json (1.7.5)
|
48
48
|
mail (2.4.4)
|
49
49
|
i18n (>= 0.4.0)
|
50
50
|
mime-types (~> 1.16)
|
data/lib/justlogging/agent.rb
CHANGED
@@ -19,7 +19,6 @@ module Justlogging
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def add_to_queue(transaction)
|
22
|
-
Rails.logger.info 'added transaction to queue'
|
23
22
|
@queue << transaction
|
24
23
|
end
|
25
24
|
|
@@ -45,10 +44,8 @@ module Justlogging
|
|
45
44
|
result = http_client.request(request)
|
46
45
|
code = result.code
|
47
46
|
rescue => error
|
48
|
-
Rails.logger.err "[Justlogging] Error: #{error.message}"
|
49
47
|
code = nil
|
50
48
|
end
|
51
|
-
Rails.logger.info "[Justlogging] Sent queue: #{code}"
|
52
49
|
handle_result(code)
|
53
50
|
end
|
54
51
|
|
data/lib/justlogging/version.rb
CHANGED
@@ -17,18 +17,23 @@ describe Justlogging::Agent do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
describe '#send_queue' do
|
20
|
+
let(:http_client) { stub(:request => stub(:code => '200')) }
|
20
21
|
before do
|
22
|
+
agent.stub(:http_client).and_return(http_client)
|
21
23
|
agent.add_to_queue(event)
|
22
24
|
ActiveSupport::JSON.stub(:encode => '{"abc":"def"}')
|
23
|
-
Net::HTTP.stub(:post_form).and_return(stub(:code => '200'))
|
24
25
|
end
|
25
26
|
|
26
27
|
it 'should call Net::HTTP.post_form with the correct params' do
|
27
|
-
|
28
|
-
|
28
|
+
post = stub
|
29
|
+
post.should_receive(:set_form_data).with(
|
29
30
|
'api_key' => 'abc',
|
30
31
|
'log_entries' => '{"abc":"def"}'
|
31
|
-
)
|
32
|
+
)
|
33
|
+
|
34
|
+
Net::HTTP::Post.should_receive(:new).with(
|
35
|
+
'/api/1/log_entries'
|
36
|
+
).and_return(post)
|
32
37
|
end
|
33
38
|
|
34
39
|
it "should call handle_result" do
|
@@ -21,7 +21,7 @@ describe Justlogging::Railtie do
|
|
21
21
|
it "should call add_event for non action_controller event" do
|
22
22
|
current = stub
|
23
23
|
current.should_receive(:add_event)
|
24
|
-
Justlogging::Transaction.should_receive(:current).and_return(current)
|
24
|
+
Justlogging::Transaction.should_receive(:current).twice.and_return(current)
|
25
25
|
end
|
26
26
|
|
27
27
|
after do
|
@@ -35,7 +35,7 @@ describe Justlogging::Railtie do
|
|
35
35
|
it "should call set_log_entry for action_controller event" do
|
36
36
|
current = stub
|
37
37
|
current.should_receive(:set_log_entry)
|
38
|
-
Justlogging::Transaction.should_receive(:current).and_return(current)
|
38
|
+
Justlogging::Transaction.should_receive(:current).twice.and_return(current)
|
39
39
|
end
|
40
40
|
|
41
41
|
after do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: justlogging-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|