Sha256: d9ee3368d62199af1af12fc88de3c129653412ca89b54f0e35458779a73cad02

Contents?: true

Size: 1.35 KB

Versions: 4

Compression:

Stored size: 1.35 KB

Contents

require File.join(File.dirname(__FILE__), "..", "spec_helper")
require 'fileutils'

module Wally
  describe CountsTags do
    after do
      Feature.delete_all
    end

    def create_feature path, content
      feature = Feature.new
      feature.path = path
      feature.gherkin = ParsesFeatures.new.parse(content)
      feature.save
    end

    it "counts feature tags" do
      create_feature("feature-1.feature", "@tag1 @tag2\nFeature: Feature 1")
      create_feature("feature-2.feature", "@tag2 @tag2\nFeature: Feature 2")
      CountsTags.new(Feature).count_tags.should == {
        "@tag1" => 1,
        "@tag2" => 3
      }
    end

    it "counts scenario tags" do
      create_feature("feature-1.feature", "Feature: Feature 1\n@tag1@tag1\nScenario: Scenario 1")
      create_feature("feature-2.feature", "Feature: Feature 2\n@tag3@tag1\nScenario: Scenario 1")
      CountsTags.new(Feature).count_tags.should == {
        "@tag1" => 3,
        "@tag3" => 1
      }
    end

    it "counts feature tags irrespective of their case" do
      create_feature("feature-1.feature", "@tag1\nFeature: Feature 1")
      create_feature("feature-2.feature", "@TAG1\nFeature: Feature 2")
      create_feature("feature-3.feature", "Feature: Feature 2\n@TAG1\nScenario: Scenario 1")
      CountsTags.new(Feature).count_tags.should == {
        "@tag1" => 3
      }
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
wally-0.0.33 spec/wally/counts_tags_spec.rb
wally-0.0.32 spec/wally/counts_tags_spec.rb
wally-0.0.31 spec/wally/counts_tags_spec.rb
wally-0.0.30 spec/wally/counts_tags_spec.rb