Class: CucumberTags::TagsHelper
- Inherits:
-
Object
- Object
- CucumberTags::TagsHelper
- Defined in:
- lib/cucumber_tags/cucumber_tags.rb
Overview
search for tags and filter the files
Instance Attribute Summary collapse
-
#filtered_feature ⇒ Object
readonly
Returns the value of attribute filtered_feature.
Instance Method Summary collapse
-
#filter_feature ⇒ Object
rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity.
-
#initialize(files, tags) ⇒ TagsHelper
constructor
A new instance of TagsHelper.
- #node_tags(node) ⇒ Object
- #not_allowed_tags ⇒ Object
- #required_tags ⇒ Object
Constructor Details
#initialize(files, tags) ⇒ TagsHelper
Returns a new instance of TagsHelper.
8 9 10 11 12 |
# File 'lib/cucumber_tags/cucumber_tags.rb', line 8 def initialize(files, ) @feature_files = files = .strip.tr('\"', '').split(' and ') @filtered_feature = [] end |
Instance Attribute Details
#filtered_feature ⇒ Object (readonly)
Returns the value of attribute filtered_feature.
6 7 8 |
# File 'lib/cucumber_tags/cucumber_tags.rb', line 6 def filtered_feature @filtered_feature end |
Instance Method Details
#filter_feature ⇒ Object
rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
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 |
# File 'lib/cucumber_tags/cucumber_tags.rb', line 27 def filter_feature @feature_files.each do |file| find = false gherkin_document = Gherkin::Parser.new.parse(File.read(file)) = (gherkin_document[:feature]) gherkin_document[:feature][:children].each do |child| next if child[:type] == :Background break if find = (child) + next if .any? { |x| .include? x } if child[:type] == :ScenarioOutline child[:examples].each do |example| = (example) + next if .any? { |x| .include? x } next unless - == [] find = true @filtered_feature << file break end elsif - == [] @filtered_feature << file break end end end end |
#node_tags(node) ⇒ Object
22 23 24 |
# File 'lib/cucumber_tags/cucumber_tags.rb', line 22 def (node) node[:tags].map { |x| x[:name] } end |
#not_allowed_tags ⇒ Object
18 19 20 |
# File 'lib/cucumber_tags/cucumber_tags.rb', line 18 def = .filter { |x| x if x.include? 'not' } end |
#required_tags ⇒ Object
14 15 16 |
# File 'lib/cucumber_tags/cucumber_tags.rb', line 14 def = .filter { |x| x unless x.include? 'not' } end |