Sha256: dc188eb8de660b4b27481e50e40c16f8e66890dd3f7423059ac50c9e45070c73

Contents?: true

Size: 1.84 KB

Versions: 1

Compression:

Stored size: 1.84 KB

Contents

require 'spec_helper'
include CukeIterations

describe "Extracting scenarios" do
  before do
    features_dir = File.join(File.dirname(__FILE__), '..', 'example', 'features')

    @parsed_features = CukeParser.parse_features(features_dir)
  end

  it "should find all the scenarios and examples" do
    expected_features = [
      {filename: 'cuking_rocks.feature', line: 10},
      {filename: 'cuking_rocks.feature', line: 21},
      {filename: 'cuking_rocks.feature', line: 22},
      {filename: 'subdirectory/i_love_cukes.feature', line: 4},
      {filename: 'subdirectory/i_love_cukes.feature', line: 15},
      {filename: 'subdirectory/i_love_cukes.feature', line: 16},
      {filename: 'subdirectory/i_love_cukes.feature', line: 25},
    ]

    parsed_files_with_lines = @parsed_features.map{|x| {filename: x[:filename], line: x[:line]}}
    parsed_files_with_lines.should =~ expected_features
  end

  it "should read scenario-level tags" do
    @parsed_features.should include filename: 'subdirectory/i_love_cukes.feature',
      line: 4,
      tags: ['@tag1', '@tag2']
  end

  it "should read feature-level tags on scenarios" do
    @parsed_features.should include filename: 'cuking_rocks.feature',
      line: 10,
      tags: ['@feature_tag1', '@feature_tag2']
  end

  it "should read scenario-level tags on example rows" do
    @parsed_features.should include filename: 'subdirectory/i_love_cukes.feature',
      line: 15,
      tags: ['@tag3', '@tag4']
  end

  it "should read feature-level tags on example rows" do
    @parsed_features.should include filename: 'cuking_rocks.feature',
      line: 21,
      tags: ['@feature_tag1', '@feature_tag2']
  end

  it "should read example-group tags on example rows" do
    @parsed_features.should include filename: 'subdirectory/i_love_cukes.feature',
      line: 25,
      tags: ['@tag5', '@tag6', '@tag7', '@tag8']
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cuke_iterations-0.0.2 spec/cuke_parser_spec.rb