Skip to content

Instantly share code, notes, and snippets.

@dangalipo
Created September 28, 2011 15:22
Show Gist options
  • Select an option

  • Save dangalipo/1248216 to your computer and use it in GitHub Desktop.

Select an option

Save dangalipo/1248216 to your computer and use it in GitHub Desktop.
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