Sha256: b7dae14fa8ec545048f7e76b843f70a8402bb3424f56a5d958d6ace964bfb7f1

Contents?: true

Size: 1.52 KB

Versions: 11

Compression:

Stored size: 1.52 KB

Contents

# File: gherkin-listener_spec.rb

require_relative '../spec_helper'


require_relative 'file-parsing'

# Load the class under testing
require_relative '../../lib/cukedep/gherkin-listener'

module Cukedep # Open module to get rid of long qualified names

describe GherkinListener do
  include FileParsing # Use mixin module to parse of sample feature files
  
  subject { GherkinListener.new }

  context 'Creation and initialization:' do
    it 'should be created without argument' do
      expect {GherkinListener.new }.not_to raise_error
    end
    
    it 'should have no feature file at start' do
      expect(subject).to have(0).feature_files
    end
  end # context
  
  context 'Provided services:' do
    it 'should build a FeatureFileRep per parsed file' do
      parse_for(subject)
      expect(subject).to have(FileParsing::SampleFileNames.size).feature_files
    end
    
    it 'should know the tags of each feature' do
      parse_for(subject)
      
      expectations = [
        %w[a_few feature:qux],
        %w[some feature:foo depends_on:bar depends_on:qux],
        %w[still_other feature:baz],
        %w[yet_other feature:bar depends_on:baz depends_on:qux depends_on:quux],
        %w[feature:quux more],
        []
      ]

      # Sort the expectations to ease further comparison
      expectations.map! { |tags| tags.sort }
      
      subject.feature_files.each_with_index do |file, i|
        expect(file.feature.tags.sort).to eq(expectations[i])
      end
    end
  end # context

end # describe

end # module

# End of file

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
cukedep-0.1.06 spec/cukedep/gherkin-listener_spec.rb
cukedep-0.1.05 spec/cukedep/gherkin-listener_spec.rb
cukedep-0.1.04 spec/cukedep/gherkin-listener_spec.rb
cukedep-0.1.03 spec/cukedep/gherkin-listener_spec.rb
cukedep-0.0.8 spec/cukedep/gherkin-listener_spec.rb
cukedep-0.0.7 spec/cukedep/gherkin-listener_spec.rb
cukedep-0.0.6 spec/cukedep/gherkin-listener_spec.rb
cukedep-0.0.5 spec/cukedep/gherkin-listener_spec.rb
cukedep-0.0.4 spec/cukedep/gherkin-listener_spec.rb
cukedep-0.0.3 spec/cukedep/gherkin-listener_spec.rb
cukedep-0.0.1 spec/cukedep/gherkin-listener_spec.rb