Created
April 27, 2009 23:13
-
-
Save jaredatron/102814 to your computer and use it in GitHub Desktop.
This file contains 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
# I should see that challenge | |
# I should see a challenge | |
# I should not see any challenges | |
# I should see a challenge issued to me by erica | |
# I should see a challenge called "whatever" issued to me by erica | |
# I should see that I am participating in that challenge | |
Then /^I (should|should not)? see (a|any|that|that I am participating in (?:a|that)) challenge(?:s)?(?: called "([^\"]+)")?(?: issued to me by (\w+))?$/ do |should, what, called, issuer| | |
tag = what.match(/^that I am participating in/) ? '#participating .challenge .header' : '.challenge .header' | |
title = @challenge.title if what.match(/that/) | |
title = called if called.present? | |
html = begin | |
if issuer.present? and title.present? | |
/#{title}.*#{issuer}/ | |
elsif issuer.present? and !title.present? | |
/#{issuer}/ | |
elsif !issuer.present? and title.present? | |
/#{title}/ | |
end | |
end | |
response.send should.sub(' ','_').to_sym, have_tag(tag, html) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment