assert    = require 'assert'
fs        = require 'fs'
path      = require 'path'
coffeebar = require '../lib/coffeebar'

fixturePath = path.join __dirname, 'fixtures'

describe 'Compiler options', ->

  before ->
    try fs.unlinkSync "#{fixturePath}/options/options.js"

  it 'should compile bare', ->

    coffeebar "#{fixturePath}/options/options.coffee", {bare: true}
    testFile = fs.readFileSync "#{fixturePath}/options/options.js", 'utf8'
    assert testFile.length
    assert testFile.indexOf(".call(this);") is -1

  it 'should compile without a header', ->

    coffeebar "#{fixturePath}/options/options.coffee", {header: false}
    testFile = fs.readFileSync "#{fixturePath}/options/options.js", 'utf8'
    assert testFile.length
    assert testFile.indexOf("Generated by CoffeeScript") is -1

  after ->
    try fs.unlinkSync "#{fixturePath}/options/options.js"
