Class: Webrat::RadioField

Inherits:
Field show all
Defined in:
lib/webrat/core/elements/field.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from Field

#value

Attributes inherited from Element

#element

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Field

#disabled?, field_class, field_classes, #id, inherited, #initialize, #label_text, load, #raise_error_if_disabled, #set, #unset, xpath_search_excluding_hidden

Methods inherited from Element

#initialize, #inspect, load, load_all, #path

Constructor Details

This class inherits a constructor from Webrat::Field

Class Method Details

.xpath_searchObject



273
274
275
# File 'lib/webrat/core/elements/field.rb', line 273

def self.xpath_search
  ".//input[@type = 'radio']"
end

Instance Method Details

#checked?Boolean

Returns:

  • (Boolean)


291
292
293
# File 'lib/webrat/core/elements/field.rb', line 291

def checked?
  @element["checked"] == "checked"
end

#chooseObject



282
283
284
285
286
287
288
289
# File 'lib/webrat/core/elements/field.rb', line 282

def choose
  raise_error_if_disabled
  other_options.each do |option|
    option.set(nil)
  end

  set(@element["value"] || "on")
end

#to_query_stringObject



277
278
279
280
# File 'lib/webrat/core/elements/field.rb', line 277

def to_query_string
  return nil if @value.nil?
  super
end