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.
@@ -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