class Wrapybara::Attribute

Public Class Methods

new(parent, attribute) click to toggle source
# File lib/wrapybara/elements/attribute.rb, line 5
def initialize(parent, attribute)
        @parent = parent
        @attribute = attribute
end

Public Instance Methods

should_be(value) click to toggle source
# File lib/wrapybara/elements/attribute.rb, line 22
def should_be(value)
        message = "Expected element #{self.parent_identifier} to have attribute '#{@attribute}' with value '#{value}'"
        raise UnmetExpectation, message unless @parent.element[@attribute] == value
end
should_exist() click to toggle source
# File lib/wrapybara/elements/attribute.rb, line 14
def should_exist
        raise UnmetExpectation, "Expected element #{self.parent_identifier} to have attribute '#{@attribute}'" if @parent.element[@attribute].nil?
end
should_not_be(value) click to toggle source
# File lib/wrapybara/elements/attribute.rb, line 27
def should_not_be(value)
        message = "Did not expect element #{self.parent_identifier} to have attribute '#{@attribute}' with value '#{value}'"
        raise UnmetExpectation, message if @parent.element[@attribute] == value
end
should_not_exist() click to toggle source
# File lib/wrapybara/elements/attribute.rb, line 18
def should_not_exist
        raise UnmetExpectation, "Did not expect element #{self.parent_identifier} to have attribute '#{@attribute}'" unless @parent.element[@attribute].nil?
end
value() click to toggle source
# File lib/wrapybara/elements/attribute.rb, line 10
def value
        self
end