Sha256: 1f48acde6ed4d0a0f478c96b368cb178090b168b2425a74d163e0f6bd807e9ff

Contents?: true

Size: 1.6 KB

Versions: 17

Compression:

Stored size: 1.6 KB

Contents

$TESTING=true
$:.push File.join(File.dirname(__FILE__), '..', 'lib')

def template_path(template)
  File.expand_path(File.join(File.dirname(__FILE__), 'templates', template))
end

def result_path(result)
  File.expand_path(File.join(File.dirname(__FILE__), 'results', result))
end

require 'templater.rb'
require 'rubygems'
require 'spec'
require 'spec/autorun'
require 'fileutils'

# Added a cross-platform temporary directory helper
# This was taken from MSpec
# http://github.com/rubyspec/mspec/tree/master
# http://github.com/rubyspec/mspec/tree/master/lib/mspec/helpers/tmp.rb
module TmpDirHelper
  def tmp(name)
    unless @spec_temp_directory
      [ "/private/tmp", "/tmp", "/var/tmp", ENV["TMPDIR"], ENV["TMP"],
        ENV["TEMP"], ENV["USERPROFILE"] ].each do |dir|
        if dir and File.directory?(dir) and File.writable?(dir)
          temp = File.expand_path dir
          temp = File.readlink temp if File.symlink? temp
          @spec_temp_directory = temp
          break
        end
      end
    end

    File.join @spec_temp_directory, name
  end
end

# Add it to Object
Object.send(:include, TmpDirHelper)

class MatchActionNames
  def initialize(*names)
    @names = names.map{|n| n.to_s}
  end

  def matches?(actual)
    @actual = actual
    @actual.map{|a| a.name.to_s}.sort == @names.sort
  end

  def failure_message
    "expected #{@actual.inspect} to have action names #{@names.inspect}, but they didn't"
  end

  def negative_failure_message
    "expected #{@actual.inspect} not to have action names #{@names.inspect}, but they did"
  end
end

def have_names(*names)
  MatchActionNames.new(*names)
end

Version data entries

17 entries across 16 versions & 3 rubygems

Version Path
middleman-0.13.1 lib/middleman/vendor/gems/ruby/1.9.1/gems/templater-1.0.0/spec/spec_helper.rb
middleman-0.13.1 lib/middleman/vendor/gems/ruby/1.8/gems/templater-1.0.0/spec/spec_helper.rb
middleman-0.12.2 lib/middleman/vendor/gems/gems/templater-1.0.0/spec/spec_helper.rb
middleman-0.12.1 lib/middleman/vendor/gems/gems/templater-1.0.0/spec/spec_helper.rb
ginst-2009.12.8 vendor/gems/templater-1.0.0/spec/spec_helper.rb
middleman-0.12.0.pre3 lib/middleman/vendor/gems/gems/templater-1.0.0/spec/spec_helper.rb
middleman-0.12.0.pre2 lib/middleman/vendor/gems/gems/templater-1.0.0/spec/spec_helper.rb
middleman-0.12.0.pre lib/middleman/vendor/gems/gems/templater-1.0.0/spec/spec_helper.rb
ginst-2009.11.24 vendor/gems/templater-1.0.0/spec/spec_helper.rb
ginst-2009.11.23 vendor/gems/templater-1.0.0/spec/spec_helper.rb
middleman-0.10.17 vendor/gems/gems/templater-1.0.0/spec/spec_helper.rb
middleman-0.10.16 vendor/gems/gems/templater-1.0.0/spec/spec_helper.rb
middleman-0.10.15 vendor/gems/gems/templater-1.0.0/spec/spec_helper.rb
middleman-0.10.14 vendor/gems/gems/templater-1.0.0/spec/spec_helper.rb
ginst-2.0.1 vendor/gems/templater-1.0.0/spec/spec_helper.rb
ginst-2.0.0 vendor/gems/templater-1.0.0/spec/spec_helper.rb
templater-1.0.0 spec/spec_helper.rb