Sha256: 1f7f9476508199314fb4be2ce2b7f51e2ac3611d5307307a91c57a8252fd782c

Contents?: true

Size: 1.36 KB

Versions: 5

Compression:

Stored size: 1.36 KB

Contents

require 'spec_helper'

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

describe 'Directory, Integration' do

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

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

    directory = CukeModeler::Directory.new(@default_file_directory)
    nested_directory = directory.directories.first
    file = directory.feature_files.first

    nested_directory.parent_element.should equal directory
    file.parent_element.should equal directory
  end

  context 'getting stuff' do

    before(:each) do
      nested_directory = "#{@default_file_directory}/nested_directory"
      FileUtils.mkdir(nested_directory)

      @directory = CukeModeler::Directory.new(@default_file_directory)
      @nested_directory = @directory.directories.first
    end


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

      directory.should equal @directory
    end

    it 'returns nil if it does not have the requested type of ancestor' do
      example = @nested_directory.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/directory_integration_spec.rb
cuke_modeler-0.2.0 spec/integration/directory_integration_spec.rb
cuke_modeler-0.1.0 spec/integration/directory_integration_spec.rb
cuke_modeler-0.0.2 spec/integration/directory_integration_spec.rb
cuke_modeler-0.0.1 spec/integration/directory_integration_spec.rb