Sha256: f462b717de60f037e25cd76dba4c8ac8b169495c8b357ad65cd8cc5a3aafd4bd
Contents?: true
Size: 899 Bytes
Versions: 3
Compression:
Stored size: 899 Bytes
Contents
require 'spec_helper' require "execjs" describe 'controller assignments' do it 'are in the template' do source = get_source_of '/application/with_assignments.js' source.gsub!(/;\s*\Z/,'') # execjs eval doesn't like the trailing semicolon assignments = opal_eval(source) { :number_var => 1234, :string_var => 'hello', :array_var => [1,'a'], :hash_var => {:a => 1, :b => 2}.stringify_keys, :object_var => {:contents => 'json representation'}.stringify_keys, :local_var => 'i am local', }.each_pair do |ivar, assignment| assignments[ivar.to_s].should eq(assignment) end end def get_source_of path get path response.should be_success source = response.body end def opal_eval source opal_source = get_source_of '/assets/opal.js' context = ExecJS.compile opal_source context.eval source end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
opal-rails-0.3.1 | spec/integration/assigns_spec.rb |
opal-rails-0.3.0 | spec/integration/assigns_spec.rb |
opal-rails-0.2.1 | spec/integration/assigns_spec.rb |