Created
December 7, 2010 22:08
-
-
Save rubysolo/732523 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
| module ResponseHelpers | |
| def response_dom | |
| html = response.try(:body) || page.try(:body) | |
| $stderr.puts "WARNING: No response HTML!" if html.blank? | |
| Nokogiri::HTML(html) | |
| end | |
| end | |
| World(ResponseHelpers) |
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
| Then /^"([^\"]*)" should be disabled$/ do |element| | |
| e = response_dom.search("//input[@id='#{ element }']").first || | |
| response_dom.search("//input[@name='#{ element }']").first || | |
| response_dom.search("//input[contains(@value, '#{ element }')]") | |
| if defined?(Spec::Rails::Matchers) | |
| e.should_not be_nil | |
| e.attr('disabled').to_s.should eql('disabled') | |
| else | |
| assert_not_nil e | |
| assert_equal 'disabled', e.attr('disabled').to_s | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment