Sha256: 975a5be16dd0805dcfecd35ad4bb13bd798bd0a05e2e9fed42ac1f9561e06ced
Contents?: true
Size: 1.23 KB
Versions: 19
Compression:
Stored size: 1.23 KB
Contents
require 'test_helper' describe Merit::RulesMatcher do describe 'rules actions are treated as a regexp' do it 'selects matching rules (suffix)' do matcher = Merit::RulesMatcher.new('comments', 'update') selected = matcher.select_from( 'comments#update' => 'comments#update', 'comments#up' => 'comments#up', 'comments#up$' => 'comments#up$', 'comments#up.+$' => 'comments#up.+$', ) _(selected).must_be :==, ['comments#update', 'comments#up.+$'] matcher = Merit::RulesMatcher.new('comments', 'up') selected = matcher.select_from( 'comments#update' => 'comments#update', 'comments#up' => 'comments#up', 'comments#up$' => 'comments#up$', 'comments#up.+$' => 'comments#up.+$', ) _(selected).must_be :==, ['comments#up', 'comments#up$'] end it 'selects matching rules (prefix)' do matcher = Merit::RulesMatcher.new('/posts/1/comments', 'create') selected = matcher.select_from( 'comments#create' => 'comments#create', '^comments#create' => '^comments#create', '^.*/comments#create' => '^.*/comments#create', ) _(selected).must_be :==, ['^.*/comments#create'] end end end
Version data entries
19 entries across 19 versions & 2 rubygems