Sha256: 9afa7c5b561adc176df6c2550f1d4813a8835d34d0977fa14fa4283bca61d34c

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 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 = CucumberAnalytics::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 = CucumberAnalytics::Directory.new(@default_file_directory)
      @nested_directory = @directory.directories.first
    end


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

      directory.path.should == @directory.path
    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

1 entries across 1 versions & 1 rubygems

Version Path
cucumber_analytics-1.3.0 spec/integration/directory_integration_spec.rb