Sha256: c942d9ca23083031faf1078d6e0665afcbdd6616c1c7b2ef1243e982d326fe04

Contents?: true

Size: 819 Bytes

Versions: 1

Compression:

Stored size: 819 Bytes

Contents

require 'spec_helper'

describe(Jekyll::Converters::Opal) do
  let(:bogus_opal)  { "hi.there( oatmeal" }
  let(:simple_opal) { "puts 'ohai jekyll'" }
  let(:simple_js_output) do
    <<-JS
/* Generated by Opal 0.6.2 */
(function($opal) {
  var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice;

  $opal.add_stubs(['$puts']);
  return self.$puts("ohai jekyll")
})(Opal);
JS
  end

  it "matches .opal files" do
    expect(subject.matches(".opal")).to be_truthy
  end

  it "outputs .js" do
    expect(subject.output_ext("ANYTHING AT ALL")).to eql(".js")
  end

  it "converts Ruby into Opal" do
    expect(subject.convert(simple_opal)).to eql(simple_js_output)
  end

  it "explodes on bad input" do
    expect(->{ subject.convert(bogus_opal) }).to raise_error
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jekyll-opal-0.1.0 spec/opal_converter_spec.rb