File: pattern_matching_test.rb

package info (click to toggle)
ruby-globalid 1.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 300 kB
  • sloc: ruby: 1,675; makefile: 6
file content (31 lines) | stat: -rw-r--r-- 772 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
require 'helper'

class URI::PatternMatchingTest < ActiveSupport::TestCase
  setup do
    @gid = URI::GID.parse('gid://bcx/Person/5?hello=worlds&param=value')
  end

  test 'URI::GID pattern matching' do
    case @gid
    in app: 'bcx', model_name: 'Person', model_id: '5', params: { hello: _ => world, param: _ => _ }
      assert_equal world, 'worlds'
    else
      raise
    end
  end
end

class GlobalIDPatternMatchingTest < ActiveSupport::TestCase
  setup do
    @gid = GlobalID.parse('gid://bcx/Person/5?hello=worlds&param=value')
  end

  test 'GlobalID pattern matching' do
    case @gid
    in app: 'bcx', model_name: 'Person', model_id: '5', params: { hello: _ => world, param: _ => _ }
      assert_equal world, 'worlds'
    else
      raise
    end
  end
end