Created
February 21, 2013 10:51
-
-
Save alext/5003890 to your computer and use it in GitHub Desktop.
Field matchers
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' | |
field['type'].should == options[:type] | |
end | |
if options.has_key?(:value) | |
field.value.should == options[:value] | |
elsif options.has_key?(:checked) | |
field['checked'].should == options[:checked] | |
end | |
end | |
end | |
RSpec.configuration.include FieldMatchers, :type => :feature |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment