Created
January 17, 2011 21:50
-
-
Save vertiginous/783552 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
| def parse(name) | |
| raise "Write the parse method." | |
| end | |
| describe "parse" do | |
| it "should list all permutations, text in brackets is optional" do | |
| strings = parse("foo[bar]") | |
| strings.should include('foo') | |
| strings.should include('foobar') | |
| strings.should_not include('bar') | |
| strings.size.should == 2 | |
| end | |
| it "should list all permutations, text in brackets is optional" do | |
| strings = parse("[foo]bar") | |
| strings.should include('bar') | |
| strings.should include('foobar') | |
| strings.should_not include('foo') | |
| strings.size.should == 2 | |
| end | |
| it "should list all permutations, text in brackets is optional" do | |
| strings = parse("[foo]bar[baz]") | |
| strings.should include('foobar') | |
| strings.should include('bar') | |
| strings.should include('barbaz') | |
| strings.should include('foobarbaz') | |
| strings.should_not include('foo') | |
| strings.should_not include('baz') | |
| strings.size.should == 4 | |
| end | |
| it "should return the string, when there are no brackets" do | |
| strings = parse("foo") | |
| strings.should include('foo') | |
| strings.size.should == 1 | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment