Skip to content

Commit

Permalink
Adds unit tests related to level selection
Browse files Browse the repository at this point in the history
  • Loading branch information
thisismydesign committed Aug 19, 2017
1 parent 4fafb72 commit 5da5d9a
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions spec/easy_logging_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,28 @@ class TestDirectLogChange4;end
end
end
end

context 'level selection' do
it 'has a level setting of INFO by default' do
expect(TestClass.logger.level).to eq(Logger::Severity::INFO)
end

it 'remembers selected level' do
easy_clone = EasyLogging.clone
easy_clone.level = Logger::Severity::DEBUG
expect(easy_clone.level).to eq(Logger::Severity::DEBUG)
end

it 'retains `level` between includes' do
EasyLogging.level = Logger::Severity::DEBUG
class TestRetain; end
TestRetain.send(:include, EasyLogging)

class TestRetain2; end
TestRetain2.send(:include, EasyLogging)

expect(TestRetain.logger.level).to eq(Logger::Severity::DEBUG)
expect(TestRetain2.logger.level).to eq(Logger::Severity::DEBUG)
end
end
end

0 comments on commit 5da5d9a

Please sign in to comment.