Sha256: df965a461c3f709d6b570a0a59d18aa5ec9a366a7721016fe9927418cf88bd39

Contents?: true

Size: 1.91 KB

Versions: 11

Compression:

Stored size: 1.91 KB

Contents

require 'logger'
require 'ohai'
require 'rbconfig'
require 'stringio'
require 'xdg'

# > What is Dependency Testing?
# >
# > Examines an application's requirements for pre-existing software, initial states and configuration in order to
# > maintain proper functionality.
# >
# > -- http://sqa.fyicenter.com/FAQ/Software-QA-Testing/What_is_Dependency_Testing_.html
describe 'Dependency expectations' do
  describe Logger do
    # Depending on the situation, `Logger` might have been overwritten to have a different interface.  (I'm looking at you, Rails.)
    it 'logs with the expected interface' do
      io = StringIO.new
      logger = Logger.new(io)
      logger.info('my message')
      logger.formatter = lambda { |_, _, _, msg| msg }
      io.string.should match(/my message/)
    end
  end

  describe Ohai do
    before do
      @ohai = Ohai::System.new
      # FIXME: For some reason this is really slow when using `guard`
      @ohai.require_plugin('os')
    end
  
    it 'has platform information' do
      @ohai.require_plugin('platform')
      @ohai['platform'].should match(/[a-z]+/i)
      @ohai['platform_version'].should match(/[0-9]+/)
    end
  
    it 'has Ruby information' do
      ruby = @ohai['languages']['ruby']
      ruby['version'].should match(/^[0-9\.]+$/i)
      ruby['platform'].should match(/[a-z0-9]+/i)
    end
  end

  describe RbConfig do
    it 'identifies the host operating system' do
      RbConfig::CONFIG['host_os'].should match(/[a-z]+/)
    end
  end

  describe XDG do
    it 'has DATA_HOME' do
      # FIXME: This test could be cleaner.  We can't depend on the directory to already exist, even on systems that use
      # the XDG standard.  This seems safe enough for now.
      #
      # More info:
      #
      # * [XDG Base Directory Specification](http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html)
      XDG['DATA_HOME'].to_s.should match(%r{^/.*?/\.local/share$})
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
maid-0.3.0 spec/dependency_spec.rb
maid-0.3.0.beta.1 spec/dependency_spec.rb
maid-0.2.3.alpha.1 spec/dependency_spec.rb
maid-0.2.2 spec/dependency_spec.rb
maid-0.2.2.beta.1 spec/dependency_spec.rb
maid-0.2.1 spec/dependency_spec.rb
maid-0.2.0 spec/dependency_spec.rb
maid-0.2.0.rc.2 spec/dependency_spec.rb
maid-0.2.0.rc.1 spec/dependency_spec.rb
maid-0.2.0.beta.3 spec/dependency_spec.rb
maid-0.2.0.beta.2 spec/dependency_spec.rb