Skip to content

Instantly share code, notes, and snippets.

@hammerdr
Created March 2, 2010 09:52
Show Gist options
  • Save hammerdr/319405 to your computer and use it in GitHub Desktop.
Save hammerdr/319405 to your computer and use it in GitHub Desktop.
Feature: MyButton shows up
In order to satisfy Bob
As a awesome dude
I want to show him MyButton
Scenario: MyButton shows on load
Then MyButton should display
@import "Then.j"
var shouldDisplayRegex = /(.*) should display/;
@implementation ShouldDisplay : Then
- (BOOL)matches:(CPString)input
{
return input.match(shouldDisplayRegex);
}
- (void)parse:(CPString)lineData context:(CPDictionary)context delegate:(UITestScript)delegate
{
var tag = lineData.match(shouldDisplayRegex)[1];
var view = [self findViewByTag:tag];
if(view)
{
[self succeed:delegate];
}
else
{
[self failure:delegate];
}
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment