Created
September 27, 2011 20:31
-
-
Save rcreasey/1246155 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| class Parser | |
| attr_accessor :logger | |
| def initialize() | |
| @logger = GELF::Notifier.new | |
| end | |
| def log_request( data ) | |
| @logger.notify!(:short_message => 'parsing data', :full_message => data.inspect) | |
| end | |
| end |
This file contains hidden or 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
| describe Parser do | |
| before(:each) do | |
| @parser = Parser.new | |
| @parser.logger = mock('GELF::Notifier') | |
| end | |
| it 'should log the incoming data to graylog.' do | |
| @parser.log_request('ohai2u!') | |
| @parser.logger.should_receive(:notify!).with({:short_message => 'parsing data', :full_message => 'ohai2u!'}) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment