mongo_request_logger 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 510692960aea0897abb5821f81b6d4b697030fb9
4
- data.tar.gz: 646f281bb97316a9a68e0efbf54fa92e7d6e7c0d
3
+ metadata.gz: 53d796aa5a6db0352796bd9b46d084720365b2ba
4
+ data.tar.gz: f558a7fb8110e323c44d6b654e80d3388a24b6c4
5
5
  SHA512:
6
- metadata.gz: 613a8196480d0dfdf8a427a1a569ec1f56bb12d81567df3cc1c7b9b4bb99f72baacfbe5eadac06826285c6967e60554f60efddbc08450be696dfe8d25d91af74
7
- data.tar.gz: ca5be89a4936dc8367f7125ab90ce94c3a8e715b49a3d5e61dbbc8c0c4c77b9a51797b4dc07b234a5bdf4dccf737c3898001433da21484ab6e37ee47217d84db
6
+ metadata.gz: 1804e0557babf3f86126f22a3046d3d16b992fd2f773453f9f4e8dbb5bd0edbcf3cce9541eb38d3521935bdd19c8bb0cd8987b019930e870bb82d197758f86fc
7
+ data.tar.gz: e81f29301848770c59d1b9285ba21265d967704425ce60dbd89dd9a3c3b8cbca96c5aea5f122d34109596bf39f16f2c620291f2321e3ae040d1edf4c73335ba2
data/.gitignore CHANGED
@@ -3,7 +3,6 @@
3
3
  .bundle
4
4
  .config
5
5
  .yardoc
6
- *emfile.lock
7
6
  InstalledFiles
8
7
  _yardoc
9
8
  coverage
@@ -15,3 +14,4 @@ spec/reports
15
14
  test/tmp
16
15
  test/version_tmp
17
16
  tmp
17
+ **.log
data/Gemfile.lock ADDED
@@ -0,0 +1,61 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ mongo_request_logger (0.2.6)
5
+ activesupport (> 3.0.0)
6
+ sinatra (>= 1.3.2)
7
+ sinatra-contrib
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ activesupport (3.2.13)
13
+ i18n (= 0.6.1)
14
+ multi_json (~> 1.0)
15
+ backports (3.3.0)
16
+ bson (1.8.5)
17
+ bson_ext (1.8.5)
18
+ bson (~> 1.8.5)
19
+ diff-lcs (1.2.3)
20
+ eventmachine (1.0.3)
21
+ i18n (0.6.1)
22
+ mongo (1.8.5)
23
+ bson (~> 1.8.5)
24
+ moped (1.4.5)
25
+ multi_json (1.7.2)
26
+ rack (1.5.2)
27
+ rack-protection (1.5.0)
28
+ rack
29
+ rack-test (0.6.2)
30
+ rack (>= 1.0)
31
+ rspec (2.13.0)
32
+ rspec-core (~> 2.13.0)
33
+ rspec-expectations (~> 2.13.0)
34
+ rspec-mocks (~> 2.13.0)
35
+ rspec-core (2.13.1)
36
+ rspec-expectations (2.13.0)
37
+ diff-lcs (>= 1.1.3, < 2.0)
38
+ rspec-mocks (2.13.1)
39
+ sinatra (1.4.2)
40
+ rack (~> 1.5, >= 1.5.2)
41
+ rack-protection (~> 1.4)
42
+ tilt (~> 1.3, >= 1.3.4)
43
+ sinatra-contrib (1.4.0)
44
+ backports (>= 2.0)
45
+ eventmachine
46
+ rack-protection
47
+ rack-test
48
+ sinatra (~> 1.4.2)
49
+ tilt (~> 1.3)
50
+ tilt (1.3.7)
51
+
52
+ PLATFORMS
53
+ ruby
54
+
55
+ DEPENDENCIES
56
+ bson_ext
57
+ mongo
58
+ mongo_request_logger!
59
+ moped
60
+ rspec
61
+ sinatra (~> 1.4.0)
@@ -0,0 +1,130 @@
1
+ PATH
2
+ remote: /home/ralf/src/request_logger
3
+ specs:
4
+ mongo_request_logger (0.2.6)
5
+ activesupport (> 3.0.0)
6
+ sinatra (>= 1.3.2)
7
+ sinatra-contrib
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ actionmailer (3.2.13)
13
+ actionpack (= 3.2.13)
14
+ mail (~> 2.5.3)
15
+ actionpack (3.2.13)
16
+ activemodel (= 3.2.13)
17
+ activesupport (= 3.2.13)
18
+ builder (~> 3.0.0)
19
+ erubis (~> 2.7.0)
20
+ journey (~> 1.0.4)
21
+ rack (~> 1.4.5)
22
+ rack-cache (~> 1.2)
23
+ rack-test (~> 0.6.1)
24
+ sprockets (~> 2.2.1)
25
+ activemodel (3.2.13)
26
+ activesupport (= 3.2.13)
27
+ builder (~> 3.0.0)
28
+ activerecord (3.2.13)
29
+ activemodel (= 3.2.13)
30
+ activesupport (= 3.2.13)
31
+ arel (~> 3.0.2)
32
+ tzinfo (~> 0.3.29)
33
+ activeresource (3.2.13)
34
+ activemodel (= 3.2.13)
35
+ activesupport (= 3.2.13)
36
+ activesupport (3.2.13)
37
+ i18n (= 0.6.1)
38
+ multi_json (~> 1.0)
39
+ arel (3.0.2)
40
+ backports (3.3.0)
41
+ bson (1.8.5)
42
+ bson_ext (1.8.5)
43
+ bson (~> 1.8.5)
44
+ builder (3.0.4)
45
+ diff-lcs (1.2.3)
46
+ erubis (2.7.0)
47
+ eventmachine (1.0.3)
48
+ hike (1.2.2)
49
+ i18n (0.6.1)
50
+ journey (1.0.4)
51
+ json (1.7.7)
52
+ mail (2.5.3)
53
+ i18n (>= 0.4.0)
54
+ mime-types (~> 1.16)
55
+ treetop (~> 1.4.8)
56
+ mime-types (1.22)
57
+ mongo (1.8.5)
58
+ bson (~> 1.8.5)
59
+ moped (1.4.5)
60
+ multi_json (1.7.2)
61
+ polyglot (0.3.3)
62
+ rack (1.4.5)
63
+ rack-cache (1.2)
64
+ rack (>= 0.4)
65
+ rack-protection (1.5.0)
66
+ rack
67
+ rack-ssl (1.3.3)
68
+ rack
69
+ rack-test (0.6.2)
70
+ rack (>= 1.0)
71
+ rails (3.2.13)
72
+ actionmailer (= 3.2.13)
73
+ actionpack (= 3.2.13)
74
+ activerecord (= 3.2.13)
75
+ activeresource (= 3.2.13)
76
+ activesupport (= 3.2.13)
77
+ bundler (~> 1.0)
78
+ railties (= 3.2.13)
79
+ railties (3.2.13)
80
+ actionpack (= 3.2.13)
81
+ activesupport (= 3.2.13)
82
+ rack-ssl (~> 1.3.2)
83
+ rake (>= 0.8.7)
84
+ rdoc (~> 3.4)
85
+ thor (>= 0.14.6, < 2.0)
86
+ rake (10.0.4)
87
+ rdoc (3.12.2)
88
+ json (~> 1.4)
89
+ rspec (2.13.0)
90
+ rspec-core (~> 2.13.0)
91
+ rspec-expectations (~> 2.13.0)
92
+ rspec-mocks (~> 2.13.0)
93
+ rspec-core (2.13.1)
94
+ rspec-expectations (2.13.0)
95
+ diff-lcs (>= 1.1.3, < 2.0)
96
+ rspec-mocks (2.13.1)
97
+ sinatra (1.3.6)
98
+ rack (~> 1.4)
99
+ rack-protection (~> 1.3)
100
+ tilt (~> 1.3, >= 1.3.3)
101
+ sinatra-contrib (1.3.2)
102
+ backports (>= 2.0)
103
+ eventmachine
104
+ rack-protection
105
+ rack-test
106
+ sinatra (~> 1.3.0)
107
+ tilt (~> 1.3)
108
+ sprockets (2.2.2)
109
+ hike (~> 1.2)
110
+ multi_json (~> 1.0)
111
+ rack (~> 1.0)
112
+ tilt (~> 1.1, != 1.3.0)
113
+ thor (0.18.1)
114
+ tilt (1.3.7)
115
+ treetop (1.4.12)
116
+ polyglot
117
+ polyglot (>= 0.3.1)
118
+ tzinfo (0.3.37)
119
+
120
+ PLATFORMS
121
+ ruby
122
+
123
+ DEPENDENCIES
124
+ bson_ext
125
+ mongo
126
+ mongo_request_logger!
127
+ moped
128
+ rails (~> 3.2.10)
129
+ rspec
130
+ sinatra (~> 1.3.2)
@@ -0,0 +1,61 @@
1
+ PATH
2
+ remote: /home/ralf/src/request_logger
3
+ specs:
4
+ mongo_request_logger (0.2.6)
5
+ activesupport (> 3.0.0)
6
+ sinatra (>= 1.3.2)
7
+ sinatra-contrib
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ activesupport (3.2.13)
13
+ i18n (= 0.6.1)
14
+ multi_json (~> 1.0)
15
+ backports (3.3.0)
16
+ bson (1.8.5)
17
+ bson_ext (1.8.5)
18
+ bson (~> 1.8.5)
19
+ diff-lcs (1.2.3)
20
+ eventmachine (1.0.3)
21
+ i18n (0.6.1)
22
+ mongo (1.8.5)
23
+ bson (~> 1.8.5)
24
+ moped (1.4.5)
25
+ multi_json (1.7.2)
26
+ rack (1.5.2)
27
+ rack-protection (1.5.0)
28
+ rack
29
+ rack-test (0.6.2)
30
+ rack (>= 1.0)
31
+ rspec (2.13.0)
32
+ rspec-core (~> 2.13.0)
33
+ rspec-expectations (~> 2.13.0)
34
+ rspec-mocks (~> 2.13.0)
35
+ rspec-core (2.13.1)
36
+ rspec-expectations (2.13.0)
37
+ diff-lcs (>= 1.1.3, < 2.0)
38
+ rspec-mocks (2.13.1)
39
+ sinatra (1.4.2)
40
+ rack (~> 1.5, >= 1.5.2)
41
+ rack-protection (~> 1.4)
42
+ tilt (~> 1.3, >= 1.3.4)
43
+ sinatra-contrib (1.4.0)
44
+ backports (>= 2.0)
45
+ eventmachine
46
+ rack-protection
47
+ rack-test
48
+ sinatra (~> 1.4.2)
49
+ tilt (~> 1.3)
50
+ tilt (1.3.7)
51
+
52
+ PLATFORMS
53
+ ruby
54
+
55
+ DEPENDENCIES
56
+ bson_ext
57
+ mongo
58
+ mongo_request_logger!
59
+ moped
60
+ rspec
61
+ sinatra (~> 1.4.0)
@@ -68,6 +68,10 @@ module MongoRequestLogger
68
68
  @collection.find_one(::BSON::ObjectId(id))
69
69
  end
70
70
 
71
+ def clear!
72
+ raise NotImplementedError
73
+ end
74
+
71
75
  private
72
76
 
73
77
  def mongo_connection_object
@@ -6,6 +6,10 @@ require 'active_support/core_ext/hash/indifferent_access'
6
6
  module MongoRequestLogger
7
7
  module Adapters
8
8
  class Moped < Base
9
+ class << self
10
+ attr_accessor :connection
11
+ end
12
+
9
13
 
10
14
  def initialize(options = {})
11
15
  @configuration = options.with_indifferent_access
@@ -74,6 +78,10 @@ module MongoRequestLogger
74
78
  @collection.find("_id" => ::Moped::BSON::ObjectId.from_string(id)).first
75
79
  end
76
80
 
81
+ def clear!
82
+ @collection.drop
83
+ end
84
+
77
85
  private
78
86
 
79
87
  def mongo_connection_object
@@ -86,9 +94,31 @@ module MongoRequestLogger
86
94
  conn = ::Moped::Session.new(["#{@configuration['host']}:#{@configuration['port']}"], :timeout => 6)
87
95
  end
88
96
  @connection_type = conn.class
97
+
98
+ MongoRequestLogger::Adapters::Moped.connection = conn
89
99
  conn
90
100
  end
91
101
 
92
102
  end
93
103
  end
94
104
  end
105
+
106
+ # Adapted from Mongoid 3.0.16 lib/mongoid/railtie.rb
107
+
108
+ # Unicorn clears the START_CTX when a worker is forked, so if we have
109
+ # data in START_CTX then we know we're being preloaded. Unicorn does
110
+ # not provide application-level hooks for executing code after the
111
+ # process has forked, so we reconnect lazily.
112
+ if defined?(Unicorn) && !Unicorn::HttpServer::START_CTX.empty?
113
+ MongoRequestLogger::Adapters::Moped.connection.disconnect if MongoRequestLogger::Adapters::Moped.connection
114
+ end
115
+
116
+ # Passenger provides the :starting_worker_process event for executing
117
+ # code after it has forked, so we use that and reconnect immediately.
118
+ if defined?(PhusionPassenger)
119
+ PhusionPassenger.on_event(:starting_worker_process) do |forked|
120
+ if MongoRequestLogger::Adapters::Moped.connection && forked
121
+ MongoRequestLogger::Adapters::Moped.connection.disconnect
122
+ end
123
+ end
124
+ end
@@ -43,6 +43,12 @@ module MongoRequestLogger
43
43
  logger.log_request do
44
44
  begin
45
45
  request = ::Rack::Request.new(env)
46
+ begin
47
+ cl = request.content_length.to_i
48
+ rescue
49
+ cl = 0
50
+ end
51
+
46
52
  options = {
47
53
  path: request.path_info,
48
54
  host: request.host_with_port,
@@ -52,6 +58,7 @@ module MongoRequestLogger
52
58
  query_string: request.query_string,
53
59
  request_method: request.request_method,
54
60
  content_type: request.content_type,
61
+ content_length: cl,
55
62
  params: request.params
56
63
  }
57
64
  logger.add_metadata options
@@ -1,3 +1,3 @@
1
1
  module MongoRequestLogger
2
- VERSION = '0.2.5'
2
+ VERSION = '0.2.6'
3
3
  end
@@ -0,0 +1,37 @@
1
+ require 'rails'
2
+ require 'action_controller/railtie'
3
+
4
+
5
+ class Dummy < Rails::Application
6
+ config.root = File.dirname(__FILE__)
7
+
8
+ # Rails needs these keys, but they don't really have to be secret for our tests
9
+ config.session_store :cookie_store, key: '****************************************'
10
+ config.secret_token = '****************************************'
11
+
12
+ # Our routes
13
+ routes.draw do
14
+ mount MongoRequestLogger::Viewer, :at => "log"
15
+
16
+ get '/' => 'dummy#index'
17
+ post '/' => 'dummy#index'
18
+ get '/other' => 'dummy#other'
19
+ end
20
+ end
21
+
22
+ # A simple controller
23
+ class DummyController < ActionController::Base
24
+ def index
25
+ render text: 'Home'
26
+ end
27
+
28
+ def other
29
+ render text: 'Other'
30
+ end
31
+ end
32
+
33
+
34
+ # Not sure how to make Rails automatically run the railtie with a dummy app, so we do it manually.
35
+ # In a proper Rails app we don't need this.
36
+ require 'mongo_request_logger/railtie'
37
+ MongoRequestLogger::Railtie.setup(Rails.application)
@@ -0,0 +1,5 @@
1
+ test:
2
+ host: localhost
3
+ database: request_logger_test
4
+ capsize: 10 # megabytes
5
+
File without changes
@@ -0,0 +1,101 @@
1
+ require 'spec_helper'
2
+
3
+ begin
4
+ require 'rails'
5
+
6
+ # Configure the Rails application
7
+ ENV["RAILS_ENV"] = "test"
8
+ require 'dummy/application'
9
+
10
+
11
+
12
+ describe "Rails Integration" do
13
+ let(:app) do
14
+ Rails.application
15
+ end
16
+
17
+ let(:adapter) do
18
+ MongoRequestLogger::Viewer.adapter
19
+ end
20
+
21
+
22
+ before :each do
23
+ adapter.clear!
24
+ end
25
+
26
+ it "should initialize" do
27
+ Rails.logger.should be_a MongoRequestLogger::Logger
28
+
29
+ adapter.should be
30
+ end
31
+
32
+ it "should log basic info" do
33
+ get '/'
34
+ last_response.status.should == 200
35
+ last_response.body.should =~ /Home/
36
+ last_response.should be_ok
37
+
38
+ results = adapter.query({}).to_a
39
+ results.count.should == 1
40
+ result = results.first
41
+ result['timestamp'].should be_within(1.minute).of(Time.now)
42
+ result['path'].should == '/'
43
+ result['host'].should == 'example.org'
44
+ result['ip'].should == '127.0.0.1'
45
+ result['request_method'].should == 'GET'
46
+ result['response'].should == 200
47
+ result['user_agent'].should == ''
48
+ end
49
+
50
+ it "should log get parameters" do
51
+ get '/?a=5&b=test'
52
+
53
+ result = adapter.query({}).first
54
+ result['path'].should == '/'
55
+ result['params'].should == {'a' => '5', 'b' => 'test'}
56
+ end
57
+
58
+ it "should log post JSON paramters" do
59
+ data = '{"test": "yes"}'
60
+ post '/', {}, {input: data, "CONTENT_TYPE" => 'application/json'}
61
+ result = adapter.query({}).first
62
+ result['path'].should == '/'
63
+ result['request_method'].should == 'POST'
64
+ result['content_type'].should == 'application/json'
65
+ result['content_length'].should == data.length
66
+ result['response'].should == 200
67
+ # TODO: result['params'].should == {'test' => 'yes'}
68
+ end
69
+
70
+ it "should handle broken post JSON content" do
71
+ data = "This is not JSON"
72
+ post '/', {}, {input: data, "CONTENT_TYPE" => 'application/json'}
73
+ last_response.status.should == 500
74
+
75
+ result = adapter.query({}).first
76
+ result['path'].should == '/'
77
+ result['response'].should == 500 # Why is it 500?
78
+ result['request_method'].should == 'POST'
79
+ result['content_type'].should == 'application/json'
80
+ result['content_length'].should == data.length
81
+ result['exception'].should be
82
+ end
83
+
84
+ it "should handle broken post XML content" do
85
+ data = "This is not XML"
86
+ post '/', {}, {input: data, "CONTENT_TYPE" => 'application/xml'}
87
+ last_response.status.should == 500
88
+
89
+ result = adapter.query({}).first
90
+ result['path'].should == '/'
91
+ result['response'].should == 500 # Why is it 500?
92
+ result['request_method'].should == 'POST'
93
+ result['content_type'].should == 'application/xml'
94
+ result['content_length'].should == data.length
95
+ result['exception'].should be
96
+ end
97
+
98
+ end
99
+ rescue LoadError
100
+ # Cannot find Rails - skip these tests
101
+ end
@@ -97,12 +97,7 @@ shared_examples "log" do
97
97
 
98
98
  block = ->{
99
99
  logger.log_request do
100
- begin
101
- infinite_recursion
102
- rescue => e
103
- logger.exception e
104
- raise e
105
- end
100
+ infinite_recursion
106
101
  end
107
102
  }
108
103
 
@@ -114,6 +109,5 @@ shared_examples "log" do
114
109
  log['exception'].should == {"class"=>"SystemStackError", "message"=>"stack level too deep"}
115
110
  messages = log['messages']
116
111
  messages[0].should match /ERROR.*SystemStackError.*stack level too deep/
117
- puts messages
118
112
  end
119
113
  end
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  require 'rspec'
2
+ require 'rack/test'
3
+
2
4
  if ENV['COVERAGE']
3
5
  require 'simplecov'
4
6
  SimpleCov.start do
@@ -15,6 +17,7 @@ end
15
17
  if defined? Rails
16
18
  Rails.backtrace_cleaner.remove_silencers!
17
19
  ENV["RAILS_ENV"] = 'test'
20
+ RAILS_ROOT = File.join(File.dirname(__FILE__), 'spec/dummy')
18
21
  end
19
22
 
20
23
  # Require all files, so they show up in coverage
@@ -22,3 +25,8 @@ Dir['lib/**/*.rb'].each do |file|
22
25
  path = /lib\/(.*)\.rb/.match(file)[1]
23
26
  require path
24
27
  end
28
+
29
+
30
+ RSpec.configure do |conf|
31
+ conf.include Rack::Test::Methods
32
+ end
data/spec/testapp/app.rb CHANGED
@@ -5,8 +5,10 @@ class SinatraApp < Sinatra::Base
5
5
  set :logging, nil
6
6
 
7
7
  get '/' do
8
- logger.info 'Logging from Sinatra!'
8
+ puts logger.class.name
9
+ logger.debug 'Logging from Sinatra!'
9
10
 
10
11
  "Log test on Sinatra #{Sinatra::VERSION}"
11
12
  end
12
13
  end
14
+
@@ -1,9 +1,21 @@
1
+ require 'rack/builder'
1
2
  require 'mongo_request_logger'
2
3
  require './app'
4
+ require 'rack/cascade'
3
5
 
4
- MongoRequestLogger.configure(File.join(File.dirname(__FILE__), 'config/logger.yml'))
6
+ app = Rack::Builder.new do
7
+ use Rack::Session::Cookie, secret: 'phungah1Geik8Eeth4Eezoh0aj1naeV2oiroh4EZe6Ulei1ohdooxae8cu0amake'
5
8
 
6
- use MongoRequestLogger::Rack
9
+ MongoRequestLogger.configure(File.join(File.dirname(__FILE__), 'config/logger.yml'))
10
+ use MongoRequestLogger::Rack
7
11
 
8
- run Rack::URLMap.new("/" => SinatraApp.new,
9
- "/log" => MongoRequestLogger::Viewer.new)
12
+ map "/log" do
13
+ run MongoRequestLogger::Viewer.new
14
+ end
15
+
16
+ map "/" do
17
+ run SinatraApp.new
18
+ end
19
+ end
20
+
21
+ run app
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongo_request_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Embark Mobile
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-19 00:00:00.000000000 Z
11
+ date: 2013-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
@@ -63,6 +63,7 @@ files:
63
63
  - .travis.yml
64
64
  - CHANGELOG.md
65
65
  - Gemfile
66
+ - Gemfile.lock
66
67
  - LICENSE.txt
67
68
  - README.md
68
69
  - Rakefile
@@ -371,7 +372,9 @@ files:
371
372
  - angular/test/unit/servicesSpec.js
372
373
  - config.ru
373
374
  - gemfiles/sinatra1.3.gemfile
375
+ - gemfiles/sinatra1.3.gemfile.lock
374
376
  - gemfiles/sinatra1.4.gemfile
377
+ - gemfiles/sinatra1.4.gemfile.lock
375
378
  - lib/mongo_request_logger.rb
376
379
  - lib/mongo_request_logger/adapters/base.rb
377
380
  - lib/mongo_request_logger/adapters/mongo.rb
@@ -390,10 +393,13 @@ files:
390
393
  - lib/mongo_request_logger/version.rb
391
394
  - lib/mongo_request_logger/viewer.rb
392
395
  - mongo_request_logger.gemspec
396
+ - spec/dummy/application.rb
397
+ - spec/dummy/config/logger.yml
398
+ - spec/dummy/log/.gitkeep
393
399
  - spec/mongo_logger_spec.rb
394
400
  - spec/moped_logger_spec.rb
395
401
  - spec/query_spec.rb
396
- - spec/railtie_spec.rb
402
+ - spec/rails_spec.rb
397
403
  - spec/shared_examples.rb
398
404
  - spec/spec_helper.rb
399
405
  - spec/testapp/app.rb
@@ -426,10 +432,13 @@ signing_key:
426
432
  specification_version: 4
427
433
  summary: Structured logger and log viewer for Rack (including Rails) requests
428
434
  test_files:
435
+ - spec/dummy/application.rb
436
+ - spec/dummy/config/logger.yml
437
+ - spec/dummy/log/.gitkeep
429
438
  - spec/mongo_logger_spec.rb
430
439
  - spec/moped_logger_spec.rb
431
440
  - spec/query_spec.rb
432
- - spec/railtie_spec.rb
441
+ - spec/rails_spec.rb
433
442
  - spec/shared_examples.rb
434
443
  - spec/spec_helper.rb
435
444
  - spec/testapp/app.rb
data/spec/railtie_spec.rb DELETED
@@ -1,22 +0,0 @@
1
- if defined? Rails
2
- require 'spec_helper'
3
- require 'mongo_request_logger/railtie'
4
-
5
- class TestApp < Rails::Application
6
- config.root = File.join(__FILE__, '../testapp')
7
- end
8
-
9
- describe 'railtie' do
10
- it "should load the Railtie" do
11
- # For now, we mostly test that no errors are raised
12
- MongoRequestLogger::Railtie.should be
13
- MongoRequestLogger::Railtie.setup TestApp
14
-
15
- File.exist?(Rails.root.join('log/test.log')).should == true
16
- end
17
-
18
- after do
19
- FileUtils.rm_f(Rails.root.join('log/test.log'))
20
- end
21
- end
22
- end