mustermann 3.0.4 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/mustermann/ast/expander.rb +4 -5
- data/lib/mustermann/ast/parser.rb +2 -3
- data/lib/mustermann/ast/translator.rb +4 -5
- data/lib/mustermann/expander.rb +1 -1
- data/lib/mustermann/rails.rb +47 -0
- data/lib/mustermann/version.rb +1 -1
- data/lib/mustermann/versions.rb +47 -0
- metadata +6 -38
- data/bench/capturing.rb +0 -57
- data/bench/regexp.rb +0 -21
- data/bench/simple_vs_sinatra.rb +0 -23
- data/bench/template_vs_addressable.rb +0 -26
- data/bench/uri_parser_object.rb +0 -16
- data/mustermann.gemspec +0 -18
- data/spec/ast_spec.rb +0 -15
- data/spec/composite_spec.rb +0 -163
- data/spec/concat_spec.rb +0 -127
- data/spec/equality_map_spec.rb +0 -42
- data/spec/expander_spec.rb +0 -123
- data/spec/identity_spec.rb +0 -127
- data/spec/mapper_spec.rb +0 -77
- data/spec/mustermann_spec.rb +0 -81
- data/spec/pattern_spec.rb +0 -54
- data/spec/regexp_based_spec.rb +0 -9
- data/spec/regular_spec.rb +0 -119
- data/spec/simple_match_spec.rb +0 -11
- data/spec/sinatra_spec.rb +0 -836
- data/spec/to_pattern_spec.rb +0 -70
data/spec/to_pattern_spec.rb
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
require 'support'
|
|
3
|
-
require 'mustermann/to_pattern'
|
|
4
|
-
require 'delegate'
|
|
5
|
-
|
|
6
|
-
describe Mustermann::ToPattern do
|
|
7
|
-
context String do
|
|
8
|
-
example { "".to_pattern .should be_a(Mustermann::Sinatra) }
|
|
9
|
-
example { "".to_pattern(type: :rails) .should be_a(Mustermann::Rails) }
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
context Regexp do
|
|
13
|
-
example { //.to_pattern .should be_a(Mustermann::Regular) }
|
|
14
|
-
example { //.to_pattern(type: :rails) .should be_a(Mustermann::Regular) }
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
context Symbol do
|
|
18
|
-
example { :foo.to_pattern .should be_a(Mustermann::Sinatra) }
|
|
19
|
-
example { :foo.to_pattern(type: :rails) .should be_a(Mustermann::Sinatra) }
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
context Array do
|
|
23
|
-
example { [:foo, :bar].to_pattern .should be_a(Mustermann::Composite) }
|
|
24
|
-
example { [:foo, :bar].to_pattern(type: :rails) .should be_a(Mustermann::Composite) }
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
context Mustermann::Pattern do
|
|
28
|
-
subject(:pattern) { Mustermann.new('') }
|
|
29
|
-
example { pattern.to_pattern.should be == pattern }
|
|
30
|
-
example { pattern.to_pattern(type: :rails).should be_a(Mustermann::Sinatra) }
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
context 'custom class' do
|
|
34
|
-
let(:example_class) do
|
|
35
|
-
Class.new do
|
|
36
|
-
include Mustermann::ToPattern
|
|
37
|
-
def to_s
|
|
38
|
-
":foo/:bar"
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
example { example_class.new.to_pattern .should be_a(Mustermann::Sinatra) }
|
|
44
|
-
example { example_class.new.to_pattern(type: :rails) .should be_a(Mustermann::Rails) }
|
|
45
|
-
example { Mustermann.new(example_class.new) .should be_a(Mustermann::Sinatra) }
|
|
46
|
-
example { Mustermann.new(example_class.new, type: :rails) .should be_a(Mustermann::Rails) }
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
context 'primitive delegate' do
|
|
50
|
-
let(:example_class) do
|
|
51
|
-
Class.new(DelegateClass(Array)) do
|
|
52
|
-
include Mustermann::ToPattern
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
example { example_class.new([:foo, :bar]).to_pattern .should be_a(Mustermann::Composite) }
|
|
57
|
-
example { example_class.new([:foo, :bar]).to_pattern(type: :rails) .should be_a(Mustermann::Composite) }
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
context 'primitive subclass' do
|
|
61
|
-
let(:example_class) do
|
|
62
|
-
Class.new(Array) do
|
|
63
|
-
include Mustermann::ToPattern
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
example { example_class.new([:foo, :bar]).to_pattern .should be_a(Mustermann::Composite) }
|
|
68
|
-
example { example_class.new([:foo, :bar]).to_pattern(type: :rails) .should be_a(Mustermann::Composite) }
|
|
69
|
-
end
|
|
70
|
-
end
|