Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #400 from michaelherold/rails-logger
Fix loading of Hashie.logger and set it to Rails.logger when in Rails
- Loading branch information
Showing
7 changed files
with
87 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ coverage | |
rdoc | ||
pkg | ||
*.gem | ||
*.log | ||
.bundle | ||
.rvmrc | ||
Gemfile.lock | ||
Gemfile.lock | ||
log/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--colour | ||
--format=documentation | ||
--pattern=*_spec.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
source 'http://rubygems.org' | ||
|
||
gem 'hashie', path: '../../..' | ||
gem 'rails' | ||
gem 'rspec', '~> 3.5.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
ENV['RACK_ENV'] = 'test' | ||
|
||
require 'rspec/core' | ||
require 'rails' | ||
require 'rails/all' | ||
require 'action_view/testing/resolvers' | ||
|
||
module RailsApp | ||
class Application < ::Rails::Application | ||
config.action_dispatch.show_exceptions = false | ||
config.active_support.deprecation = :stderr | ||
config.eager_load = false | ||
config.root = __dir__ | ||
config.secret_key_base = 'hashieintegrationtest' | ||
|
||
routes.append do | ||
get '/' => 'application#index' | ||
end | ||
|
||
config.assets.paths << File.join(__dir__, 'assets/javascripts') | ||
config.assets.debug = true | ||
end | ||
end | ||
|
||
LAYOUT = <<-HTML | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>TestApp</title> | ||
<%= stylesheet_link_tag "application", :media => "all" %> | ||
<%= javascript_include_tag "application" %> | ||
<%= csrf_meta_tags %> | ||
</head> | ||
<body> | ||
<%= yield %> | ||
</body> | ||
</html> | ||
HTML | ||
|
||
INDEX = <<-HTML | ||
<h1>Hello, world!</h1> | ||
HTML | ||
|
||
class ApplicationController < ActionController::Base | ||
include Rails.application.routes.url_helpers | ||
|
||
layout 'application' | ||
|
||
self.view_paths = [ActionView::FixtureResolver.new( | ||
'layouts/application.html.erb' => LAYOUT, | ||
'application/index.html.erb' => INDEX | ||
)] | ||
|
||
def index | ||
end | ||
end | ||
|
||
RailsApp::Application.initialize! | ||
|
||
require 'hashie' | ||
|
||
RSpec.describe 'the Hashie logger' do | ||
it 'is set to the Rails logger' do | ||
expect(Hashie.logger).to eq(Rails.logger) | ||
end | ||
end |