Sha256: 2eb8868a3370af3dc001d0e2fca6e6d1e0c87be005f14cb8f9ebba602ede04e3

Contents?: true

Size: 1.56 KB

Versions: 2

Compression:

Stored size: 1.56 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("application-features")

      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("application-features")
      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("application-features")

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

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wally-0.0.21 spec/wally/counts_tags_spec.rb
wally-0.0.20 spec/wally/counts_tags_spec.rb