Sha256: ae0c3b8f5257ecef831baabbef676cdc8887ab9ea4a456538d21e182bda0d29a

Contents?: true

Size: 1.39 KB

Versions: 5

Compression:

Stored size: 1.39 KB

Contents

require 'cucumber/file_specs'

module Cucumber
  describe FileSpecs do
    let(:file_specs) { FileSpecs.new(["features/foo.feature:1:2:3", "features/bar.feature:4:5:6"]) }
    let(:locations) { file_specs.locations }

    it "parses locations from multiple files" do
      expect(locations.length).to eq 6
      expect(locations).to eq [
        Cucumber::Core::Ast::Location.new("features/foo.feature", 1),
        Cucumber::Core::Ast::Location.new("features/foo.feature", 2),
        Cucumber::Core::Ast::Location.new("features/foo.feature", 3),
        Cucumber::Core::Ast::Location.new("features/bar.feature", 4),
        Cucumber::Core::Ast::Location.new("features/bar.feature", 5),
        Cucumber::Core::Ast::Location.new("features/bar.feature", 6),
      ]
    end

    it "parses file names from multiple file specs" do
      files = file_specs.files

      expect(files.length).to eq 2
      expect(files).to eq [
        "features/foo.feature",
        "features/bar.feature",
      ]
    end

    context "when no line number is specified" do
      let(:file_specs) { FileSpecs.new(["features/foo.feature", "features/bar.feature:34"]) }

      it "returns a wildcard location for that file" do
        expect(locations).to eq [
          Cucumber::Core::Ast::Location.new("features/foo.feature"),
          Cucumber::Core::Ast::Location.new("features/bar.feature", 34),
        ]
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cucumber-2.0.0.beta.5 spec/cucumber/file_specs_spec.rb
cucumber-2.0.0.beta.4 spec/cucumber/file_specs_spec.rb
cucumber-2.0.0.beta.3 spec/cucumber/file_specs_spec.rb
cucumber-2.0.0.beta.2 spec/cucumber/file_specs_spec.rb
cucumber-2.0.0.beta.1 spec/cucumber/file_specs_spec.rb