Sha256: 519ff48fbc5869c34aaaa3776c9e87f07a61c0f0a05a05b664be9d424016d006
Contents?: true
Size: 1.31 KB
Versions: 33
Compression:
Stored size: 1.31 KB
Contents
require 'lib/spec_helper' require 'opal/builder_processors' RSpec.describe Opal::BuilderProcessors::JsProcessor do it 'maps to one fragment per line' do processor = described_class.new("line1\n line2\n line3", 'file.js') expect(processor.source_map.fragments.map(&:code)).to eq([ "line1\n", " line2\n", " line3\n", "Opal.loaded([\"file.js\"]);", ]) end it 'adds loading code at the end of the source' do processor = described_class.new("line1\n line2\n line3", 'file.js') expect(processor.source).to eq(%Q{line1\n line2\n line3\nOpal.loaded(["file.js"]);}) end end RSpec.describe Opal::BuilderProcessors::RubyProcessor do it 'compiles ruby to js' do processor = described_class.new('puts 5', '-e') expect(processor.to_s).to include('$puts(5)') end describe ':requirable option' do it 'is respected' do processor = described_class.new('puts 5', '-e', requirable: true) expect(processor.to_s).to include('Opal.modules[') end it 'defaults to "false"' do processor = described_class.new('puts 5', '-e') expect(processor.to_s).not_to include('Opal.modules[') end end it 'fills required_trees' do processor = described_class.new('require_tree "./pippo"', '-e') expect(processor.required_trees).to eq(['./pippo']) end end
Version data entries
33 entries across 33 versions & 1 rubygems