Sha256: c008b8c704018ac981a6f05b01458630d550af176daff5fbc9b5fa992755b969

Contents?: true

Size: 1.92 KB

Versions: 3

Compression:

Stored size: 1.92 KB

Contents

require 'spec_helper'

SimpleCov.command_name('Outline') unless RUBY_VERSION.to_s < '1.9.0'

describe 'Outline, Integration' do

  it 'properly sets its child elements' do
    source = ['@a_tag',
              '  Scenario Outline:',
              '    * a step',
              '  Examples:',
              '    | param |']
    source = source.join("\n")

    outline = CucumberAnalytics::Outline.new(source)
    example = outline.examples.first
    step = outline.steps.first
    tag = outline.tag_elements.first

    example.parent_element.should equal outline
    step.parent_element.should equal outline
    tag.parent_element.should equal outline
  end


  context 'getting stuff' do

    before(:each) do
      source = ['Feature: Test feature',
                '',
                '  Scenario Outline: Test test',
                '    * a step',
                '  Examples: Test example',
                '    | a param |']
      source = source.join("\n")

      file_path = "#{@default_file_directory}/outline_test_file.feature"
      File.open(file_path, 'w') { |file| file.write(source) }

      @directory = CucumberAnalytics::Directory.new(@default_file_directory)
      @outline = @directory.feature_files.first.features.first.tests.first
    end


    it 'can get its directory' do
      directory = @outline.get_ancestor(:directory)

      directory.should equal @directory
    end

    it 'can get its feature file' do
      feature_file = @outline.get_ancestor(:feature_file)

      feature_file.should equal @directory.feature_files.first
    end

    it 'can get its feature' do
      feature = @outline.get_ancestor(:feature)

      feature.should equal @directory.feature_files.first.features.first
    end

    it 'returns nil if it does not have the requested type of ancestor' do
      test = @outline.get_ancestor(:test)

      test.should be_nil
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cucumber_analytics-1.4.2 spec/integration/outline_integration_spec.rb
cucumber_analytics-1.4.1 spec/integration/outline_integration_spec.rb
cucumber_analytics-1.4.0 spec/integration/outline_integration_spec.rb