Sha256: 1a8c7f19fbfd115861d73c4846ef26a96c92bfd2a3be142ac9e6adb709b2596b

Contents?: true

Size: 758 Bytes

Versions: 1

Compression:

Stored size: 758 Bytes

Contents

require 'spec_helper'

describe StrawberryCough::RoutesCompiler do
  let(:compiler) { StrawberryCough::RoutesCompiler }
  let(:interpreter) { V8::Context.new }

  it "makes an empty JavaScript object when given an empty route set" do
    routes_object = compiler.compile([])
    interpreter.eval(routes_object)
    interpreter.eval("Routes.rootPath === undefined").should be_true
  end

  it "makes a Routes JavaScript object when given an array of routes" do
    route = double('route')
    route.stub(:path) { "/parent/:id/edit(.:format)" }
    route.stub(:name) { "edit_parent" }
    routes_object = compiler.compile([route])
    interpreter.eval(routes_object)
    interpreter.eval("typeof Routes.editParentPath === 'function'").should be_true
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
strawberry_cough-0.1.0 spec/routes_compiler_spec.rb