Sha256: 0f8096df7b92487dfe1765443bd8a48261c9beb65e85de3818a3d4b94c2bd485

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
require 'spec'
require 'fileutils'
require 'rack/bundle'
require 'rack/bundle/bundles/base'
require 'tmpdir'

include Rack::Utils
alias :h :escape_html

FIXTURES_PATH = File.join(File.dirname(__FILE__), 'fixtures')

def fixture name
  File.open(File.join(FIXTURES_PATH, name))
end

def make_js_bundle
  Rack::Bundle::JSBundle.new $jquery, $mylib
end

def make_css_bundle
  Rack::Bundle::CSSBundle.new $reset, $screen
end

def filename file
  File.basename file.path
end

def index_page
  lambda { |env| [200, { 'Content-Type' => 'text/html' }, [fixture('index.html').contents]] }
end

def simple_page
  lambda { |env| [200, { 'Content-Type' => 'text/html' }, [fixture('simple.html').contents]] }
end

def plain_text
  lambda { |env| [200, { 'Content-Type' => 'text/plain' }, ['plain texto']] }
end

Spec::Runner.configure do |config|
  $jquery, $mylib = fixture('jquery-1.4.1.min.js'), fixture('mylib.js')
  $reset, $screen = fixture('reset.css'), fixture('screen.css')
  $index          = fixture('index.html')
  $doc            = Nokogiri::HTML($index)
  config.after(:all) do
    `rm -f #{FIXTURES_PATH}/rack-bundle*`
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rack-bundle-0.2.3 spec/spec_helper.rb
rack-bundle-0.2.2 spec/spec_helper.rb