File tree 1 file changed +14
-22
lines changed
1 file changed +14
-22
lines changed Original file line number Diff line number Diff line change @@ -1638,33 +1638,25 @@ def authorize(u, p)
1638
1638
end
1639
1639
1640
1640
describe '.logger' do
1641
- subject do
1642
- Class . new ( described_class ) do
1643
- def self . io
1644
- @io ||= StringIO . new
1645
- end
1646
- logger ::Logger . new ( io )
1647
- end
1648
- end
1649
-
1650
1641
it 'returns an instance of Logger class by default' do
1651
1642
expect ( subject . logger . class ) . to eql Logger
1652
1643
end
1653
1644
1654
- it 'allows setting a custom logger' do
1655
- mylogger = Class . new
1656
- subject . logger mylogger
1657
- expect ( mylogger ) . to receive ( :info ) . once
1658
- subject . logger . info 'this will be logged'
1659
- end
1645
+ context 'with a custom logger' do
1646
+ subject do
1647
+ Class . new ( described_class ) do
1648
+ def self . io
1649
+ @io ||= StringIO . new
1650
+ end
1651
+ logger ::Logger . new ( io )
1652
+ end
1653
+ end
1660
1654
1661
- it 'defaults to a standard logger log format' do
1662
- t = Time . at ( 100 )
1663
- allow ( Time ) . to receive ( :now ) . and_return ( t )
1664
- message = "this will be logged\n "
1665
- message = "I, [#{ Logger ::Formatter . new . send ( :format_datetime , t ) } \# #{ Process . pid } ] INFO -- : #{ message } " if !defined? ( Rails ) || Gem ::Version . new ( Rails ::VERSION ::STRING ) >= Gem ::Version . new ( '4.0' )
1666
- expect ( subject . io ) . to receive ( :write ) . with ( message )
1667
- subject . logger . info 'this will be logged'
1655
+ it 'exposes its interaface' do
1656
+ message = 'this will be logged'
1657
+ subject . logger . info message
1658
+ expect ( subject . io . string ) . to include ( message )
1659
+ end
1668
1660
end
1669
1661
1670
1662
it 'does not unnecessarily retain duplicate setup blocks' do
You can’t perform that action at this time.
0 commit comments