Sha256: ea8e4e3d8da9638d81cdb0d3fa05bbf0542861d7848b821d01d8c9b7247bd319

Contents?: true

Size: 1.15 KB

Versions: 5

Compression:

Stored size: 1.15 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 = CukeModeler::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 = CukeModeler::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
cuke_modeler-0.3.0 spec/integration/feature_file_integration_spec.rb
cuke_modeler-0.2.0 spec/integration/feature_file_integration_spec.rb
cuke_modeler-0.1.0 spec/integration/feature_file_integration_spec.rb
cuke_modeler-0.0.2 spec/integration/feature_file_integration_spec.rb
cuke_modeler-0.0.1 spec/integration/feature_file_integration_spec.rb