~ubuntu-branches/ubuntu/vivid/foodcritic/vivid-proposed

« back to all changes in this revision

Viewing changes to features/026_check_for_conditional_block_string.feature

  • Committer: Package Import Robot
  • Author(s): Stefano Rivera
  • Date: 2013-06-11 00:34:40 UTC
  • Revision ID: package-import@ubuntu.com-20130611003440-czusooxs9rrpe6sb
Tags: upstream-2.1.0
ImportĀ upstreamĀ versionĀ 2.1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Feature: Check for conditional attribute blocks with only strings
 
2
 
 
3
  In order to avoid wrongly actioning a resource
 
4
  As a developer
 
5
  I want to identify conditional attribute blocks that consist only of strings
 
6
 
 
7
  Scenario Outline:
 
8
    Given a cookbook recipe that declares a resource with a <conditional_attribute>
 
9
    When I check the cookbook
 
10
    Then the conditional block contains only string warning 026 should be <show_warning>
 
11
 
 
12
  Examples:
 
13
    | conditional_attribute                   | show_warning |
 
14
    | not_if { "ls foo" }                     | shown        |
 
15
    | not_if do "ls foo" end                  | shown        |
 
16
    | only_if { "ls #{node['foo']['path']}" } | shown        |
 
17
    | not_if { "ls #{foo.method()}" }         | shown        |
 
18
    | only_if { foo.bar }                     | not shown    |
 
19
    | not_if { foo.to_s }                     | not shown    |
 
20
    | not_if { File.exists?("/etc/foo") }     | not shown    |