File: test_helper.rb

package info (click to toggle)
ruby-sassc 2.4.0%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 416 kB
  • sloc: ruby: 2,277; makefile: 3
file content (45 lines) | stat: -rw-r--r-- 800 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# frozen_string_literal: true

require "minitest/autorun"
require "minitest/pride"
require "minitest/around/unit"
require "test_construct"
require "pry"

require "sassc"

module FixtureHelper
  FIXTURE_ROOT = File.expand_path(File.join(File.dirname(__FILE__), "fixtures"))

  def fixture(path)
    IO.read(fixture_path(path))
  end

  def fixture_path(path)
    if path.match(FIXTURE_ROOT)
      path
    else
      File.join(FIXTURE_ROOT, path)
    end
  end
end

module TempFileTest
  include TestConstruct::Helpers

  def around
    within_construct do |construct|
      @construct = construct
      yield
    end
    @construct = nil
  end

  def temp_file(filename, contents)
    @construct.file(filename, contents)
  end

  def temp_dir(directory)
    @construct.directory(directory)
  end
end