diff --git a/lib/webrat/core/field.rb b/lib/webrat/core/field.rb
index 065a049..27200fa 100644
--- a/lib/webrat/core/field.rb
+++ b/lib/webrat/core/field.rb
@@ -241,6 +241,10 @@ module Webrat
set(@element["value"] || "on")
end
+ def checked?
+ @element["checked"] == "checked"
+ end
+
protected
def other_options
diff --git a/spec/webrat/core/field_spec.rb b/spec/webrat/core/field_spec.rb
index 98ff995..6b7e015 100644
--- a/spec/webrat/core/field_spec.rb
+++ b/spec/webrat/core/field_spec.rb
@@ -12,4 +12,16 @@ module Webrat
checkbox.should_not be_checked
end
end
+
+ describe RadioField do
+ it "should say it is checked if it is" do
+ radio_button = RadioField.new(nil, (Webrat::XML.document("").search('input')).first)
+ radio_button.should be_checked
+ end
+
+ it "should say it is not checked if it is not" do
+ radio_button = RadioField.new(nil, (Webrat::XML.document("").search('input')).first)
+ radio_button.should_not be_checked
+ end
+ end
end