Sha256: 37ee6291ad2e56289b3aaa44cbdf11f85e808c821062baa858084f36de5e1af3

Contents?: true

Size: 693 Bytes

Versions: 1

Compression:

Stored size: 693 Bytes

Contents

require 'opal/spec'

##
# If running in the browser then capture test output straight to the
# page.

if RUBY_ENGINE =~ /opal-browser/
  raise "Body not loaded. Add tests into <body> element" unless `document.body`

  def $stdout.puts(*a)
    a.each do |str|
      `var elem = document.createElement('pre');
      elem.textContent == null ? elem.innerText = str : elem.textContent = str;
      elem.style.margin = "0px";
      document.body.appendChild(elem);`
    end
  end # $stdout
end

##
# If autorun is the main file (entry point), then automatically load all
# specs from spec/

if $0 == __FILE__
  Dir['spec/**/*.rb'].each do |spec|
   require spec
  end
end

OpalSpec::Runner.autorun

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opal-spec-0.0.1 lib/opal/spec/autorun.rb