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
module FieldMatchers | |
def i_should_see_field(name, options = {}) | |
field = find_field(name) | |
field.should_not be_nil | |
case options[:type] | |
when nil | |
when 'textarea' | |
field.tag_name.should == type | |
else | |
field.tag_name.should == 'input' |
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
module SectionHelper | |
def selector_of_section(section_name) | |
case section_name | |
when 'recent podcasts' | |
[:css, 'ul.podcasts'] | |
when /^the row containing "[\"]+"$/ | |
[:xpath, "//*[.='#{$1}']/ancestor::tr"] | |
else | |
raise "Can't find mapping from \"#{section_name}\" to a section." | |
end |
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
module PathHelpers | |
# Takes a URL path (with optional query string), and asserts that it matches the current URL. | |
def i_should_be_on(path_with_query, options = {}) | |
expected = URI.parse(path_with_query) | |
current = URI.parse(current_url) | |
current.path.should == expected.path | |
unless options[:ignore_query] | |
Rack::Utils.parse_query(current.query).should == Rack::Utils.parse_query(expected.query) | |
end |
NewerOlder