Sha256: c0eedadb560a632e8b8355d0aa77b41234b5f50e9d9e7a38b1a1e42dacb98d67

Contents?: true

Size: 963 Bytes

Versions: 3

Compression:

Stored size: 963 Bytes

Contents

require 'support'
require 'mustermann/regular'

describe Mustermann::Regular do
  extend Support::Pattern

  pattern '' do
    it { should     match('')  }
    it { should_not match('/') }
  end

  pattern '/' do
    it { should     match('/')    }
    it { should_not match('/foo') }
  end

  pattern '/foo' do
    it { should     match('/foo')     }
    it { should_not match('/bar')     }
    it { should_not match('/foo.bar') }
  end

  pattern '/foo/bar' do
    it { should     match('/foo/bar')   }
    it { should_not match('/foo%2Fbar') }
    it { should_not match('/foo%2fbar') }
  end

  pattern '/(?<foo>.*)' do
    it { should match('/foo')       .capturing foo: 'foo'       }
    it { should match('/bar')       .capturing foo: 'bar'       }
    it { should match('/foo.bar')   .capturing foo: 'foo.bar'   }
    it { should match('/%0Afoo')    .capturing foo: '%0Afoo'    }
    it { should match('/foo%2Fbar') .capturing foo: 'foo%2Fbar' }
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
mustermann19-0.3.1 spec/regular_spec.rb
mustermann-0.3.1 spec/regular_spec.rb
mustermann-0.3.0 spec/regular_spec.rb