Skip to content

Instantly share code, notes, and snippets.

@mourdok
Created July 29, 2010 22:50
Show Gist options
  • Save mourdok/499455 to your computer and use it in GitHub Desktop.
Save mourdok/499455 to your computer and use it in GitHub Desktop.
Correcting the mistake Spec::Expectations::ExpectationNotMetError in Culerity
# How to solve a small problem rubygem Culerity
# Want to return false results below:
# expected exist? to return true, got false (Spec::Expectations::ExpectationNotMetError)
# Located in: #{RAILS_ROOT}/features/step_definitions/culerity_steps.rb
# We have from the line 148 that:
Then /I should see "([^\"]*)"/ do |text|
# if we simply check for the browser.html content we don't find content that has been added dynamically, e.g. after an ajax call
div = $browser.div(:text, /#{Regexp::escape(text)}/)
div.should be_exist
end
Then /I should not see "([^\"]*)"/ do |text|
div = $browser.div(:text, /#{Regexp::escape(text)}/)
div.should_not be_exist
end
# Refactoring that after we get just that:
Then /I should see "([^\"]*)"/ do |text|
$browser.text.include?(text).should be_true
end
Then /I should not see "([^\"]*)"/ do |text|
$browser.text.include?(text).should_not be_true
end
# More information
# Visit: http://github.com/langalex/culerity/
@langalex
Copy link

if you fork the repo and patch it yourself you will get the credit, if not i can just do it myself....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment