1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
Feature: setting logger options
In order to customize logging output
As a user
I want to specify the logger options
Background: Guard is installed through bundler
Given Guard is bundled using source
@spawn
Scenario: Customize logger template
Given my Guardfile contains:
"""
require 'guard/plugin'
logger(template: '[Custom - :severity - :time - :progname] :message')
module ::Guard
class Myplugin < Plugin
def run_on_additions(files)
$stdout.puts "Files added: #{files.inspect}"
$stdout.flush
end
end
end
guard :myplugin do
watch('foo')
end
"""
Given I start `bundle exec guard -n f`
And I create a file "foo"
And I wait for Guard to become idle
And I stop guard
Then the output should match /\[Custom - INFO - \d\d:\d\d:\d\d - Guard]/
@spawn
Scenario: Customize logger level
Given my Guardfile contains:
"""
require 'guard/plugin'
logger(level: :warn)
module ::Guard
class Myplugin < Plugin
def run_on_additions(files)
$stdout.puts "Files added: #{files.inspect}"
$stdout.flush
end
end
end
guard :myplugin do
watch('foo')
end
"""
Given I start `bundle exec guard -n f`
And I create a file "foo"
And I wait for Guard to become idle
And I stop guard
Then the output should not contain "INFO"
|