Sha256: b6f1bbd883702053ee589484d836d417f3b379dfcf31a50ac4af5e70755fd7d6
Contents?: true
Size: 1.31 KB
Versions: 10
Compression:
Stored size: 1.31 KB
Contents
require 'path' $root_folder ||= Path.backfind('.[Rakefile]') require 'tilt' require 'sinatra/base' # Require wlang $LOAD_PATH.unshift(($root_folder/:lib).to_s) require 'wlang' # RSpec helpers require 'rspec' module Helpers include WLang extend(self) def root_folder $root_folder end def spec_folder root_folder/:spec end def fixtures_folder spec_folder/:fixtures end def tpl_path(what) what = "#{what}.wlang" if what.is_a?(Symbol) fixtures_folder/:templates/what end def tpl(what) tpl_path(what).read end # Load fixture dialects spec_folder.glob("fixtures/dialect/*.rb").each do |f| require f.expand_path end # Install helper methods for templates fixtures_folder.glob("templates/*.wlang").each do |f| name = f.basename.without_extension define_method(:"#{name}_path") do fixtures_folder/:templates/f.basename end define_method(:"#{name}_tpl") do send(:"#{name}_path").read end define_method(:"#{name}_io") do |&b| send(:"#{name}_path").open("r") do |io| b.call(io) end end end def sinatra_app(&block) Sinatra.new(Sinatra::Base, &block).new! end end include Helpers # Configure rspec RSpec.configure do |c| c.include Helpers c.filter_run_excluding :hash_ordering => (RUBY_VERSION < "1.9") end
Version data entries
10 entries across 10 versions & 1 rubygems