Sha256: fc5436a7ddff6044e14871aae2b63f6276966f8b7dd3014a130dd5358aca9733
Contents?: true
Size: 1.07 KB
Versions: 3
Compression:
Stored size: 1.07 KB
Contents
module Prickle module Capybara module XPath class Expression CONTAINS = ".like" TEXT_IDENTIFIER = "text()" SEPARATOR = " and " def initialize identifier, value @identifier = identifier @value = value end def to_s find_exact_match? ? MatchesValue.new(@identifier, @value).to_s : ContainsValue.new(@identifier, @value).to_s end private def find_exact_match? !identifier.include? CONTAINS end def identifier @identifier.to_s end def attribute return identifier if identifier.eql? TEXT_IDENTIFIER "@#{identifier}" end end class ContainsValue < XPath::Expression def to_s "contains(#{attribute}, '#{@value}')" end private def identifier @identifier.chomp CONTAINS end end class MatchesValue < XPath::Expression def to_s "#{attribute}='#{@value}'" end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
prickle-0.1.0 | lib/prickle/capybara/xpath/expression.rb |
prickle-0.0.6 | lib/prickle/capybara/xpath/expression.rb |
prickle-0.0.5 | lib/prickle/capybara/xpath/expression.rb |