Sha256: ec38fa7cd633dfb843004aa9f1b67548a1f9dec5933db70d86279bf90ae88ceb

Contents?: true

Size: 899 Bytes

Versions: 1

Compression:

Stored size: 899 Bytes

Contents

require 'spec'
require File.dirname(__FILE__) + '/../lib/bolt'

describe Bolt do

  it 'should load .bolt file and access config' do
    File.stub(:exists?).and_return(true)
    YAML.stub(:load_file).and_return({ 'test', 'one' })
    Bolt.read_dotfile
    
    Bolt['test'].should == 'one'
    Bolt.get('test').should == 'one'
  end
  
  it 'should read and write config' do
    Bolt.set('test_two', 'two')
    
    Bolt['test_two'].should == 'two'
    Bolt.get('test_two').should == 'two'
  end
  
  it 'should read ARGV' do
    Bolt.set('verbose', 'false')
    ARGV << '-v'
    
    Bolt.read_argv
    Bolt['verbose'].should == true
  end
  
  it 'should response correctly to verbose?' do
    Bolt.set('verbose', 'true')
    Bolt.verbose?.should == true
    Bolt.set('verbose', 'false')
    Bolt.verbose?.should == false
    Bolt.set('verbose', nil)
    Bolt.verbose?.should == false
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
marcinbunsch-bolt-0.2.8 spec/bolt_spec.rb