Sha256: 07ad0fbb50debe7d39118073a33348809692ba353757c157ce9261a80bebf503

Contents?: true

Size: 1.49 KB

Versions: 6

Compression:

Stored size: 1.49 KB

Contents

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

module Wally
  describe CountsTags do
    after do
      Feature.delete_all
    end

    def create_feature path, content
      feature = Feature.new
      feature.path = path
      feature.content = 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")
      lists_features = ListsFeatures.new

      CountsTags.new(lists_features).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")
      lists_features = ListsFeatures.new
      CountsTags.new(lists_features).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")
      lists_features = ListsFeatures.new

      CountsTags.new(lists_features).count_tags.should == {
        "@tag1" => 3
      }
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
wally-0.0.28 spec/wally/counts_tags_spec.rb
wally-0.0.27 spec/wally/counts_tags_spec.rb
wally-0.0.26 spec/wally/counts_tags_spec.rb
wally-0.0.25 spec/wally/counts_tags_spec.rb
wally-0.0.24 spec/wally/counts_tags_spec.rb
wally-0.0.22 spec/wally/counts_tags_spec.rb