Permalink
Browse files

Add cucumber feature for logging options

Test two scenarios:
- User can customize logger template
- User can customize logger level
  • Loading branch information...
fwoelm committed Jan 2, 2018
1 parent 115793e commit 7bb1faeb9f1a4c507647215a774e4526ec6ab5be
Showing with 64 additions and 0 deletions.
  1. +64 −0 features/logging.feature
View
@@ -0,0 +1,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"

0 comments on commit 7bb1fae

Please sign in to comment.