Sha256: aa55135ecb3a9aaeccdab7f5c8e285a7b6dd28af75e1a5caf2e79cb8490838e8

Contents?: true

Size: 1.57 KB

Versions: 54

Compression:

Stored size: 1.57 KB

Contents

require_relative '../../support/spec_helper'

describe Henry::Input do

  describe '#export!' do

    let :params do
      {test:'this'}
    end

    it 'should set the Input::EXPORT_KEY' do
      Henry::Input.export! params

      ENV[Henry::Input::EXPORT_KEY].should == '{"test":"this"}'
    end

    describe 'for an instance' do

      let :input do
        Henry::Input.new({test:"this instance"})
      end

      it 'should set the Input::EXPORT_KEY' do
        input.export!

        ENV[Henry::Input::EXPORT_KEY].should == '{"test":"this instance"}'
      end

    end

  end

  describe '#import!' do

    describe 'when Input::EXPORT_KEY is set' do
    
      it 'should import the Input::EXPORT_KEY as hash' do
        ENV[Henry::Input::EXPORT_KEY] = '{"test":"that"}'

        Henry::Input.import!.params.should == {"test"=>"that"}
      end

    end
      
    describe 'when Input::EXPORT_KEY is not set' do

      it 'should import the Input::EXPORT_KEY as hash' do
        ENV[Henry::Input::EXPORT_KEY] = nil
        
        Henry::Input.import!.params.should == {}
      end

    end
   
    describe 'for an instance' do
     
      describe 'when Input::EXPORT_KEY is not set' do

        let :input do
          Henry::Input.new
        end
      
        it 'should import the Input::EXPORT_KEY as hash' do
          ENV[Henry::Input::EXPORT_KEY] = nil
          
          input.should_receive(:warn).with("Could not load the execution params.\nAre you running this Task via the henry-ruby-container? You should!".red)

          input.import!
        end

      end

    end

  end

end

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
henry-container-0.1.82 spec/lib/henry/input_spec.rb
henry-container-0.1.81 spec/lib/henry/input_spec.rb
henry-container-0.1.80 spec/lib/henry/input_spec.rb
henry-container-0.1.79 spec/lib/henry/input_spec.rb
henry-container-0.1.78 spec/lib/henry/input_spec.rb
henry-container-0.1.77 spec/lib/henry/input_spec.rb
henry-container-0.1.76 spec/lib/henry/input_spec.rb
henry-container-0.1.75 spec/lib/henry/input_spec.rb
henry-container-0.1.74 spec/lib/henry/input_spec.rb
henry-container-0.1.73 spec/lib/henry/input_spec.rb
henry-container-0.1.72 spec/lib/henry/input_spec.rb
henry-container-0.1.71 spec/lib/henry/input_spec.rb
henry-container-0.1.70 spec/lib/henry/input_spec.rb
henry-container-0.1.69 spec/lib/henry/input_spec.rb
henry-container-0.1.68 spec/lib/henry/input_spec.rb
henry-container-0.1.67 spec/lib/henry/input_spec.rb
henry-container-0.1.66 spec/lib/henry/input_spec.rb
henry-container-0.1.65 spec/lib/henry/input_spec.rb
henry-container-0.1.64 spec/lib/henry/input_spec.rb
henry-container-0.1.63 spec/lib/henry/input_spec.rb