Sha256: 2bb569ee249c22716c3b08b016a2908b50b78410d14a88cf79a208893241bf4f

Contents?: true

Size: 1.14 KB

Versions: 4

Compression:

Stored size: 1.14 KB

Contents

module Helpers
  def create_routes
    destination = File.join(destination_root, "config")

    FileUtils.mkdir_p(destination)
    FileUtils.touch File.join(destination, 'routes.rb')
  end

  def create_app(options = {})
    Rails.application = nil

    Class.new(Rails::Application).tap do |app|
      assets = app.config.assets
      assets.cache_store = :memory_store
      assets.enabled  = options.fetch(:enabled, true)
      assets.compress = true if options[:compress]
      assets.debug    = true if options[:debug]
      assets.paths << fixture_root
      assets.paths << File.expand_path('javascripts')
      app.config.active_support.deprecation = :log
      app.initialize!
    end
  end

  def fixture_root
    File.expand_path('../../stylesheets', __FILE__)
  end

  def output_root
    File.expand_path('../../cases', __FILE__)
  end

  def fixture(name)
    source = fixture_path(name)
    output = css_path(name)
    [source, output].map do |path|
      File.read(path) if File.file?(path)
    end
  end

  def css_path(name)
    File.join(output_root, "#{name}.css")
  end

  def fixture_path(name)
    File.join(fixture_root, "#{name}.styl")
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
stylus-0.6.2 spec/support/helpers.rb
stylus-0.6.0 spec/support/helpers.rb
stylus-0.5.1 spec/support/helpers.rb
stylus-0.5.0 spec/support/helpers.rb