tctcl/bootcamp — pull request #22 by thejameskyle (2013-10-12 22:23:12+00:00)
Title: Restructure Project Files and Create Methods for authoring matchers

#### Resolves #15

Keep matchers from using core variables (things that could change), and provides convenience functions.

```scss
@function should($be, $something, $when) {
$bootcamp-should-b-text: $be;
$bootcamp-should-b-value: $something;
@return $when;
}

@function actual() {
@return $bootcamp-should-a-value;
}
```

---

```scss
@function be-null() {
@return should("be", "null", actual() == null);
}

@function be-undefined() {
@return should("be", "undefined", actual() == undefined);
}

@function be-truthy() {
@return should("be", "truthy", not not actual());
}

@function be-falsy() {
@return should("be", "falsy", not actual());
}

@function be-close-to($this, $precision) {
$actual: actual();
$when: false;

@if type-of($actual) == "number" {
$when: abs($this - $actual) < (bootcamp-util-power(10, -$precision) / 2);
}

@return should("be close to", $this, $when);
}

@function be-less-than($this) {
$actual: actual();
$when: false;

@if type-of($actual) == "number" {
$when: $actual < $this;
}

@return should("be less than", $this, $when);
}
```