class Greener::Checker::Style::FeatureName
Ensure .feature filename matches feature name in the Gherkin e.g. filename_of_feature.feature => “Feature: filename of feature”
Constants
- MSG
Public Instance Methods
allow_punctuation?()
click to toggle source
# File lib/greener/checker/style/feature_name.rb, line 39 def allow_punctuation? @config["AllowPunctuation"] end
enforce_title_case?()
click to toggle source
# File lib/greener/checker/style/feature_name.rb, line 43 def enforce_title_case? @config["EnforceTitleCase"] end
run()
click to toggle source
# File lib/greener/checker/style/feature_name.rb, line 12 def run return unless @config["Enabled"] run_against_filename run_against_titlecase end
run_against_filename()
click to toggle source
# File lib/greener/checker/style/feature_name.rb, line 19 def run_against_filename filename_without_extension = File.basename(@path, ".*") expected = feature[:name] expected = expected.gsub(/[^0-9a-z ]/i, "") if allow_punctuation? expected = expected.downcase.gsub(" ", "_") return if filename_without_extension == expected log_violation(feature[:location][:line], feature[:location][:column]) end
run_against_titlecase()
click to toggle source
# File lib/greener/checker/style/feature_name.rb, line 29 def run_against_titlecase return unless enforce_title_case? return if feature[:name].titlecase == feature[:name] log_violation( feature[:location][:line], feature[:location][:column], "feature title is not title case. expected: #{feature[:name].titlecase}" ) end