Sha256: a411bd16285cb4e1891fc38e713fd3bbc4a5a8ffe3852f4f21371aa2b1b3e3fb

Contents?: true

Size: 1.36 KB

Versions: 5

Compression:

Stored size: 1.36 KB

Contents

require 'spec_helper'
module Alf
  class Environment
    describe Folder do

      it 'should be registered' do
        Environment.environments.find{|n,c| c == Folder}.should_not be_nil
      end

      it 'should lead to an Environment.folder method' do
        Environment.should respond_to(:folder)
        Environment.folder(File.dirname(__FILE__)).should be_a(Folder)
      end

      let(:path){ File.expand_path('../examples', __FILE__) }
      let(:env){ Folder.new(path) }

      describe "recognizes?" do

        it 'should return true on an existing path' do
          Folder.recognizes?([File.dirname(__FILE__)]).should be_true
        end

        it 'should return false on an non existing path' do
          Folder.recognizes?(["not/an/existing/one"]).should be_false
        end

      end # recognizes?

      describe "dataset" do

        subject{ env.dataset(name) }

        describe "when called on explicit file" do
          let(:name){ "suppliers.rash" }
          it{ should be_a(Reader::Rash) }
        end

        describe "when called on existing" do
          let(:name){ "suppliers" }
          it{ should be_a(Reader::Rash) }
        end

        describe "when called on unexisting" do
          let(:name){ "notavalidone" }
          specify{ lambda{ subject }.should raise_error(Alf::NoSuchDatasetError) }
        end

      end # dataset

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
alf-0.12.2 spec/unit/alf-core/environment/test_folder.rb
alf-0.12.1 spec/unit/alf-core/environment/test_folder.rb
alf-0.12.0 spec/unit/alf-core/environment/test_folder.rb
alf-0.11.1 spec/unit/alf-core/environment/test_folder.rb
alf-0.11.0 spec/unit/alf-core/environment/test_folder.rb