|
113 | 113 | end |
114 | 114 | end |
115 | 115 |
|
| 116 | +describe "URIPATH" do |
| 117 | + let(:pattern) { 'URIPATH' } |
| 118 | + |
| 119 | + context "when matching valid URIs" do |
| 120 | + context "and the URI is simple" do |
| 121 | + let(:value) { '/foo' } |
| 122 | + |
| 123 | + it "should match the path" do |
| 124 | + expect(grok_match(pattern,value)).to pass |
| 125 | + end |
| 126 | + end |
| 127 | + |
| 128 | + context "and the URI has a trailing slash" do |
| 129 | + let(:value) { '/foo/' } |
| 130 | + |
| 131 | + it "should match the path" do |
| 132 | + expect(grok_match(pattern,value)).to pass |
| 133 | + end |
| 134 | + end |
| 135 | + |
| 136 | + context "and the URI has multiple levels" do |
| 137 | + let(:value) { '/foo/bar' } |
| 138 | + |
| 139 | + it "should match the path" do |
| 140 | + expect(grok_match(pattern,value)).to pass |
| 141 | + end |
| 142 | + end |
| 143 | + |
| 144 | + context "and the URI has fancy characters" do |
| 145 | + let(:value) { '/aA1$.+!*\'(){},~:;=@#%&|-' } |
| 146 | + |
| 147 | + it "should match the path" do |
| 148 | + expect(grok_match(pattern,value)).to pass |
| 149 | + end |
| 150 | + end |
| 151 | + end |
| 152 | + |
| 153 | + context "when matching invalid URIs" do |
| 154 | + context "and the URI has no leading slash" do |
| 155 | + let(:value) { 'foo' } |
| 156 | + |
| 157 | + it "should not match the path" do |
| 158 | + expect(grok_match(pattern,value)).not_to pass |
| 159 | + end |
| 160 | + end |
| 161 | + |
| 162 | + context "and the URI has invalid characters" do |
| 163 | + let(:value) { '/`' } |
| 164 | + |
| 165 | + it "should not match the path" do |
| 166 | + expect(grok_match(pattern,value)).not_to pass |
| 167 | + end |
| 168 | + end |
| 169 | + end |
| 170 | +end |
| 171 | + |
116 | 172 | describe "IPV4" do |
117 | 173 |
|
118 | 174 | let(:pattern) { 'IPV4' } |
|
0 commit comments