Created
September 28, 2011 15:22
-
-
Save dangalipo/1248216 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'blah' | |
| describe Foo do | |
| describe "pat_test" do | |
| context "pattern is > subject" do | |
| it 'should return [-1,0]' do | |
| Foo.pat_test("a", "ab").should == [-1,0] | |
| end | |
| end | |
| context "pattern is <= subject" do | |
| context "the first char of pattern == the current indexed char of subject" do | |
| context "the pattern matched" do | |
| context "the pattern is matched on the beginning of the string" do | |
| it 'should return [0,1]' do | |
| Foo.pat_test("ab", "ab").should == [0,1] | |
| end | |
| end | |
| end | |
| context "the pattern does not match" do | |
| it 'should return [-1,1]' do | |
| Foo.pat_test("ac", "ab").should == [-1,1] | |
| end | |
| end | |
| end | |
| context "first char of pattern is != current index of subject" do | |
| context "the pattern is matched after the beginning of the string" do | |
| it 'should return [index, 2]' do | |
| Foo.pat_test("cab", "ab").should == [1,2] | |
| end | |
| end | |
| context "the pattern does not match" do | |
| it 'should return [-1,1]' do | |
| Foo.pat_test("cd", "ab").should == [-1,1] | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment