Sha256: b846a500302ac298613e449a12b8951d2cf12688e8eac86205f84ede0e319b9c

Contents?: true

Size: 1.61 KB

Versions: 1

Compression:

Stored size: 1.61 KB

Contents

require 'environment/spec_helper'

require 'rad/environment'
require 'rad/spec/environment'

describe "Environment basic spec" do
  with_load_path "#{spec_dir}/path1", "#{spec_dir}/path2"
      
  inject env: :environment

  before :all do        
    @path1, @path2 = "#{spec_dir}/path1", "#{spec_dir}/path2"
  end
  
  describe 'files' do    
    with_environment
    
    it "find_files?" do
      env.file_exist?('/some_folder/some_file').should be_true
      env.file_exist?('/file1').should be_true
    end
  
    it "find_file" do
      lambda{env.find_file('/some_folder/some_file')}.should raise_error(/Found multiple files/)
      env.find_file('/file1').should == "#{@path1}/file1"
      lambda{env.find_file('file1')}.should raise_error(AssertionError)
    end
  
    it "find_files" do
      env.find_files('/some_folder/some_file').sort.should == ["#{@path1}/some_folder/some_file", "#{@path2}/some_folder/some_file"]
    end
  
    it "find_files_by_pattern" do
      env.find_files_by_pattern('/*/some_file').sort.should == ["#{@path1}/some_folder/some_file", "#{@path2}/some_folder/some_file"]
    end
  end
  
  describe 'config' do
    with_environment

    it "smoke test" do
      config
    end
  end
  
  describe "spec should be isolated (via swap_metadata)" do
    describe "first spec" do
      with_environment
    
      before :all do
        rad.register(:spec_component)
      end
      
      it "check" do
        Micon.metadata.should include(:spec_component)
      end
    end
    
    describe "second spec" do
      it "check" do
        Micon.metadata.should_not include(:spec_component)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rad_core-0.0.13 spec/environment/environment_spec.rb