Sha256: 6c2c7944bd2146637e398bcbc961d09fbf8463221e88ecafe2db48f51930af2c

Contents?: true

Size: 1.2 KB

Versions: 2

Compression:

Stored size: 1.2 KB

Contents

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

module Wally
  describe CountsTags do
    before do
      FileUtils.mkdir_p "application-features"
    end

    after do
      FileUtils.rm_rf "application-features"
    end

    def write_feature(name, contents)
      File.open("application-features/#{name}", "w") do |file|
        file.write(contents)
      end
    end

    it "counts feature tags" do
      write_feature("feature-1.feature", "@tag1 @tag2\nFeature: Feature 1")
      write_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
      write_feature("feature-1.feature", "Feature: Feature 1\n@tag1@tag1\nScenario: Scenario 1")
      write_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
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wally-0.0.17 spec/wally/counts_tags_spec.rb
wally-0.0.16 spec/wally/counts_tags_spec.rb