Methods
T
Instance Public methods
test_match_data()
# File actionpack/test/journey/gtg/transition_table_test.rb, line 59
def test_match_data
  path_asts = asts %w{ /get /:method/foo }
  paths     = path_asts.dup

  builder = GTG::Builder.new Nodes::Or.new path_asts
  tt = builder.transition_table

  sim = GTG::Simulator.new tt

  match = sim.match '/get'
  assert_equal [paths.first], match.memos

  match = sim.match '/get/foo'
  assert_equal [paths.last], match.memos
end
test_match_data_ambiguous()
# File actionpack/test/journey/gtg/transition_table_test.rb, line 75
def test_match_data_ambiguous
  path_asts = asts %w{
    /articles(.:format)
    /articles/new(.:format)
    /articles/:id/edit(.:format)
    /articles/:id(.:format)
  }

  paths = path_asts.dup
  ast   = Nodes::Or.new path_asts

  builder = GTG::Builder.new ast
  sim     = GTG::Simulator.new builder.transition_table

  match = sim.match '/articles/new'
  assert_equal [paths[1], paths[3]], match.memos
end
test_simulate_gt()
# File actionpack/test/journey/gtg/transition_table_test.rb, line 36
def test_simulate_gt
  sim = simulator_for ['/foo', '/bar']
  assert_match sim, '/foo'
end
test_simulate_gt_regexp()
# File actionpack/test/journey/gtg/transition_table_test.rb, line 41
def test_simulate_gt_regexp
  sim = simulator_for [':foo']
  assert_match sim, 'foo'
end
test_simulate_gt_regexp_mix()
# File actionpack/test/journey/gtg/transition_table_test.rb, line 46
def test_simulate_gt_regexp_mix
  sim = simulator_for ['/get', '/:method/foo']
  assert_match sim, '/get'
  assert_match sim, '/get/foo'
end
test_simulate_optional()
# File actionpack/test/journey/gtg/transition_table_test.rb, line 52
def test_simulate_optional
  sim = simulator_for ['/foo(/bar)']
  assert_match sim, '/foo'
  assert_match sim, '/foo/bar'
  assert_no_match sim, '/foo/'
end
test_to_json()
# File actionpack/test/journey/gtg/transition_table_test.rb, line 8
def test_to_json
  table = tt %w{
    /articles(.:format)
    /articles/new(.:format)
    /articles/:id/edit(.:format)
    /articles/:id(.:format)
  }

  json = ActiveSupport::JSON.decode table.to_json
  assert json['regexp_states']
  assert json['string_states']
  assert json['accepting']
end
test_to_svg()
# File actionpack/test/journey/gtg/transition_table_test.rb, line 23
def test_to_svg
  table = tt %w{
    /articles(.:format)
    /articles/new(.:format)
    /articles/:id/edit(.:format)
    /articles/:id(.:format)
  }
  svg = table.to_svg
  assert svg
  assert_no_match(/DOCTYPE/, svg)
end