From 1c6ea8ac3e0f18aa17db24574d5215df3271ab7b Mon Sep 17 00:00:00 2001 From: Jonas Nicklas Date: Tue, 31 Jan 2012 16:43:22 +0100 Subject: [PATCH] Refactor --- lib/capybara/query.rb | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/capybara/query.rb b/lib/capybara/query.rb index d7d635b2..0e418558 100644 --- a/lib/capybara/query.rb +++ b/lib/capybara/query.rb @@ -1,6 +1,6 @@ module Capybara class Query - attr_accessor :selector, :locator, :options, :xpaths + attr_accessor :selector, :locator, :options, :xpath def initialize(*args) @options = if args.last.is_a?(Hash) then args.pop.dup else {} end @@ -19,16 +19,12 @@ module Capybara xpath = @selector.call(@locator) if xpath.respond_to?(:to_xpaths) - @xpaths = [xpath.to_xpath(:fuzzy)] + @xpath = xpath.to_xpath(:fuzzy) else - @xpaths = [xpath.to_s] + @xpath = xpath.to_s end end - def xpath - xpaths.first - end - def failure_message(type, node) message = selector.failure_message.call(node, self) if selector.failure_message message ||= options[:message]