Sha256: 492ff776401a3bc526ee3516b09bd60a394f8bced69aa99c95ee792840140fe0

Contents?: true

Size: 1.16 KB

Versions: 5

Compression:

Stored size: 1.16 KB

Contents

require 'spec_helper'

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

describe 'FeatureFile, Integration' do

  it 'properly sets its child elements' do
    file_path = "#{@default_file_directory}/#{@default_feature_file_name}"

    File.open(file_path, "w") { |file|
      file.puts('Feature: Test feature')
    }

    file = CucumberAnalytics::FeatureFile.new(file_path)
    feature = file.feature

    feature.parent_element.should equal file
  end

  context 'getting stuff' do

    before(:each) do
      file_path = "#{@default_file_directory}/feature_file_test_file.feature"
      File.open(file_path, 'w') { |file| file.write('Feature: Test feature') }

      @directory = CucumberAnalytics::Directory.new(@default_file_directory)
      @feature_file = @directory.feature_files.first
    end


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

      directory.should equal @directory
    end

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

      example.should be_nil
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cucumber_analytics-1.5.1 spec/integration/feature_file_integration_spec.rb
cucumber_analytics-1.5.0 spec/integration/feature_file_integration_spec.rb
cucumber_analytics-1.4.2 spec/integration/feature_file_integration_spec.rb
cucumber_analytics-1.4.1 spec/integration/feature_file_integration_spec.rb
cucumber_analytics-1.4.0 spec/integration/feature_file_integration_spec.rb