Sha256: e128241f430e2cd8f5321cdaf40c0233b5c39bee43d367f46d2f4e69706e1193

Contents?: true

Size: 1.7 KB

Versions: 3

Compression:

Stored size: 1.7 KB

Contents

# Packaging caches files in $HOME/.furoshiki/cache by default.
# For testing, we override $HOME using $FUROSHIKI_HOME
FUROSHIKI_SPEC_DIR = Pathname.new(__FILE__).dirname.expand_path.to_s
ENV['FUROSHIKI_HOME'] = FUROSHIKI_SPEC_DIR

SHOES_PACKAGE_SPEC_ROOT= File.expand_path('..', __FILE__)

$LOAD_PATH << File.expand_path(SHOES_PACKAGE_SPEC_ROOT)
$LOAD_PATH << File.expand_path('../../lib', __FILE__)
$LOAD_PATH << File.expand_path('../../../shoes-core/lib', __FILE__)

require 'pathname'
require 'rspec/its'

Dir["#{SHOES_PACKAGE_SPEC_ROOT}/support/**/*.rb"].each {|f| require f}

module PackageHelpers
  # need these values from a context block, so let doesn't work
  def spec_dir
    Pathname.new(__FILE__).join('..').cleanpath
  end

  def input_dir
    spec_dir.join 'support', 'zip'
  end
end

# Guards for running or not running specs. Specs in the guarded block only
# run if the guard conditions are met.
#
module Guard
  # Runs specs only if platform matches
  #
  # @example
  # platform_is :windows do
  #   it "does something only on windows" do
  #     # specification
  #   end
  # end
  def platform_is(platform)
    yield if self.send "platform_is_#{platform}"
  end

  # Runs specs only if platform does not match
  #
  # @example
  # platform_is_not :windows do
  #   it "does something only on posix systems" do
  #     # specification
  #   end
  # end
  def platform_is_not(platform)
    yield unless self.send "platform_is_#{platform}"
  end

  def platform_is_windows
    return RbConfig::CONFIG['host_os'] =~ /windows|mswin/i
  end

  def platform_is_linux
    return RbConfig::CONFIG['host_os'] =~ /linux/i
  end

  def platform_is_osx
    return RbConfig::CONFIG['host_os'] =~ /darwin/i
  end
end

include Guard

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
shoes-package-4.0.0.pre6 spec/spec_helper.rb
shoes-package-4.0.0.pre5 spec/spec_helper.rb
shoes-package-4.0.0.pre4 spec/spec_helper.rb