diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index cf738012..74a5d211 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -93,6 +93,13 @@ module Handlebars end end + PARSER_CONTEXT = V8::Context.new + PARSER_CONTEXT.instance_eval do |context| + Handlebars::Spec.load_helpers(context); + + Handlebars::Spec.js_load(context, 'lib/handlebars/compiler/parser.js'); + end + COMPILE_CONTEXT = V8::Context.new COMPILE_CONTEXT.instance_eval do |context| Handlebars::Spec.load_helpers(context); diff --git a/spec/tokenizer_spec.rb b/spec/tokenizer_spec.rb index 9e189280..0240e631 100644 --- a/spec/tokenizer_spec.rb +++ b/spec/tokenizer_spec.rb @@ -2,12 +2,9 @@ require "spec_helper" require "timeout" describe "Tokenizer" do - let(:parser) { @context["handlebars"] } - let(:lexer) { @context["handlebars"]["lexer"] } + let(:parser) { Handlebars::Spec::PARSER_CONTEXT["handlebars"] } + let(:lexer) { Handlebars::Spec::PARSER_CONTEXT["handlebars"]["lexer"] } - before(:all) do - @compiles = true - end Token = Struct.new(:name, :text) def tokenize(string)